WIP forward
This commit is contained in:
parent
ae916ecb97
commit
2b594109ea
|
@ -19,10 +19,7 @@ export default gql`
|
||||||
}
|
}
|
||||||
|
|
||||||
extend type Mutation {
|
extend type Mutation {
|
||||||
createLink(title: String!, url: String, boost: Int): Item!
|
upsertStory(title: String!, text: String, url: String, boost: Int): Item!
|
||||||
updateLink(id: ID!, title: String!, url: String): Item!
|
|
||||||
createDiscussion(title: String!, text: String, boost: Int): Item!
|
|
||||||
updateDiscussion(id: ID!, title: String!, text: String): Item!
|
|
||||||
createComment(text: String!, parentId: ID!): Item!
|
createComment(text: String!, parentId: ID!): Item!
|
||||||
updateComment(id: ID!, text: String!): Item!
|
updateComment(id: ID!, text: String!): Item!
|
||||||
upsertJob(id: ID, sub: ID!, title: String!, company: String!, location: String, remote: Boolean, text: String!, url: String!, maxBid: Int!, status: String): Item!
|
upsertJob(id: ID, sub: ID!, title: String!, company: String!, location: String, remote: Boolean, text: String!, url: String!, maxBid: Int!, status: String): Item!
|
||||||
|
|
|
@ -6,11 +6,13 @@ import { BOOST_MIN } from '../lib/constants'
|
||||||
|
|
||||||
export const AdvPostSchema = {
|
export const AdvPostSchema = {
|
||||||
boost: Yup.number().typeError('must be a number')
|
boost: Yup.number().typeError('must be a number')
|
||||||
.min(BOOST_MIN, `must be at least ${BOOST_MIN}`).integer('must be whole')
|
.min(BOOST_MIN, `must be at least ${BOOST_MIN}`).integer('must be whole'),
|
||||||
|
forward: Yup.string().required('required').trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AdvPostInitial = {
|
export const AdvPostInitial = {
|
||||||
boost: ''
|
boost: '',
|
||||||
|
forward: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AdvPostForm () {
|
export default function AdvPostForm () {
|
||||||
|
@ -18,12 +20,20 @@ export default function AdvPostForm () {
|
||||||
<AccordianItem
|
<AccordianItem
|
||||||
header={<div style={{ fontWeight: 'bold', fontSize: '92%' }}>options</div>}
|
header={<div style={{ fontWeight: 'bold', fontSize: '92%' }}>options</div>}
|
||||||
body={
|
body={
|
||||||
|
<>
|
||||||
<Input
|
<Input
|
||||||
label='boost'
|
label='boost'
|
||||||
name='boost'
|
name='boost'
|
||||||
hint={<span className='text-muted'>ranks posts higher temporarily based on the amount</span>}
|
hint={<span className='text-muted'>ranks posts higher temporarily based on the amount</span>}
|
||||||
append={<InputGroup.Text className='text-monospace'>sats</InputGroup.Text>}
|
append={<InputGroup.Text className='text-monospace'>sats</InputGroup.Text>}
|
||||||
/>
|
/>
|
||||||
|
<Input
|
||||||
|
label='forward sats to'
|
||||||
|
name='forward'
|
||||||
|
hint={<span className='text-muted'>100% of sats earned will be sent to this user</span>}
|
||||||
|
prepend=<InputGroup.Text>@</InputGroup.Text>
|
||||||
|
/>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
|
@ -20,16 +20,16 @@ export function DiscussionForm ({
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [createDiscussion] = useMutation(
|
const [createDiscussion] = useMutation(
|
||||||
gql`
|
gql`
|
||||||
mutation createDiscussion($title: String!, $text: String, $boost: Int) {
|
mutation createDiscussion($title: String!, $text: String, $boost: Int, $forward: String) {
|
||||||
createDiscussion(title: $title, text: $text, boost: $boost) {
|
createDiscussion(title: $title, text: $text, boost: $boost, forward: $forward) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
const [updateDiscussion] = useMutation(
|
const [updateDiscussion] = useMutation(
|
||||||
gql`
|
gql`
|
||||||
mutation updateDiscussion($id: ID!, $title: String!, $text: String!) {
|
mutation updateDiscussion($id: ID!, $title: String!, $text: String!, $forward: String) {
|
||||||
updateDiscussion(id: $id, title: $title, text: $text) {
|
updateDiscussion(id: $id, title: $title, text: $text, forward: $forward) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}`, {
|
}`, {
|
||||||
|
|
|
@ -38,8 +38,8 @@ export function LinkForm ({ item, editThreshold }) {
|
||||||
|
|
||||||
const [createLink] = useMutation(
|
const [createLink] = useMutation(
|
||||||
gql`
|
gql`
|
||||||
mutation createLink($title: String!, $url: String!, $boost: Int) {
|
mutation createLink($title: String!, $url: String!, $boost: Int, $forward: String) {
|
||||||
createLink(title: $title, url: $url, boost: $boost) {
|
createLink(title: $title, url: $url, boost: $boost, forward: $forward) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
@ -47,8 +47,8 @@ export function LinkForm ({ item, editThreshold }) {
|
||||||
|
|
||||||
const [updateLink] = useMutation(
|
const [updateLink] = useMutation(
|
||||||
gql`
|
gql`
|
||||||
mutation updateLink($id: ID!, $title: String!, $url: String!) {
|
mutation updateLink($id: ID!, $title: String!, $url: String!, $forward: String) {
|
||||||
updateLink(id: $id, title: $title, url: $url) {
|
updateLink(id: $id, title: $title, url: $url, forward: $forward) {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
url
|
url
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Item" ADD COLUMN "fwdUserId" INTEGER;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "Item" ADD FOREIGN KEY ("fwdUserId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@ -18,7 +18,8 @@ model User {
|
||||||
email String? @unique
|
email String? @unique
|
||||||
emailVerified DateTime? @map(name: "email_verified")
|
emailVerified DateTime? @map(name: "email_verified")
|
||||||
image String?
|
image String?
|
||||||
items Item[]
|
items Item[] @relation("UserItems")
|
||||||
|
fwdItems Item[] @relation("FwdItem")
|
||||||
mentions Mention[]
|
mentions Mention[]
|
||||||
messages Message[]
|
messages Message[]
|
||||||
actions ItemAct[]
|
actions ItemAct[]
|
||||||
|
@ -27,7 +28,7 @@ model User {
|
||||||
invites Invite[] @relation(name: "Invites")
|
invites Invite[] @relation(name: "Invites")
|
||||||
invite Invite? @relation(fields: [inviteId], references: [id])
|
invite Invite? @relation(fields: [inviteId], references: [id])
|
||||||
inviteId String?
|
inviteId String?
|
||||||
bio Item? @relation(name: "Item", fields: [bioId], references: [id])
|
bio Item? @relation(fields: [bioId], references: [id])
|
||||||
bioId Int?
|
bioId Int?
|
||||||
msats Int @default(0)
|
msats Int @default(0)
|
||||||
stackedMsats Int @default(0)
|
stackedMsats Int @default(0)
|
||||||
|
@ -113,8 +114,10 @@ model Item {
|
||||||
title String?
|
title String?
|
||||||
text String?
|
text String?
|
||||||
url String?
|
url String?
|
||||||
user User @relation(fields: [userId], references: [id])
|
user User @relation("UserItems", fields: [userId], references: [id])
|
||||||
userId Int
|
userId Int
|
||||||
|
fwdUser User? @relation(name: "FwdItem", fields: [fwdUserId], references: [id])
|
||||||
|
fwdUserId Int?
|
||||||
parent Item? @relation("ParentChildren", fields: [parentId], references: [id])
|
parent Item? @relation("ParentChildren", fields: [parentId], references: [id])
|
||||||
parentId Int?
|
parentId Int?
|
||||||
children Item[] @relation("ParentChildren")
|
children Item[] @relation("ParentChildren")
|
||||||
|
@ -140,8 +143,7 @@ model Item {
|
||||||
longitude Float?
|
longitude Float?
|
||||||
remote Boolean?
|
remote Boolean?
|
||||||
|
|
||||||
User User[] @relation("Item")
|
User User[]
|
||||||
|
|
||||||
@@index([createdAt])
|
@@index([createdAt])
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@index([parentId])
|
@@index([parentId])
|
||||||
|
|
Loading…
Reference in New Issue