161 lines
2.5 KiB
JavaScript
Raw Normal View History

2021-04-22 17:14:32 -05:00
import { gql } from '@apollo/client'
2021-09-30 10:46:58 -05:00
import { COMMENTS } from './comments'
2021-04-22 17:14:32 -05:00
export const ITEM_FIELDS = gql`
fragment ItemFields on Item {
id
parentId
createdAt
2023-01-12 17:53:09 -06:00
deletedAt
2021-04-22 17:14:32 -05:00
title
url
user {
name
2023-02-01 08:44:35 -06:00
streak
2023-05-01 16:49:47 -05:00
hideCowboyHat
2021-08-10 17:59:06 -05:00
id
2021-04-22 17:14:32 -05:00
}
fwdUserId
otsHash
2023-02-03 18:08:08 -06:00
position
2021-04-22 17:14:32 -05:00
sats
2023-07-13 05:08:32 +02:00
meAnonSats @client
2021-04-27 16:30:58 -05:00
boost
2023-01-26 10:11:55 -06:00
bounty
2023-01-26 13:09:57 -06:00
bountyPaidTo
2022-05-17 17:09:15 -05:00
path
2023-05-06 18:17:47 -05:00
upvotes
2021-12-05 11:37:55 -06:00
meSats
2022-09-21 14:57:36 -05:00
meDontLike
meBookmark
meSubscription
2022-09-22 13:44:50 -05:00
outlawed
2022-09-27 16:19:15 -05:00
freebie
2021-04-22 17:14:32 -05:00
ncomments
2022-09-01 16:06:11 -05:00
commentSats
lastCommentAt
2022-02-17 11:23:43 -06:00
maxBid
2022-09-29 15:42:33 -05:00
isJob
2022-03-07 15:50:13 -06:00
company
location
remote
2023-05-05 12:38:56 -05:00
subName
2022-07-30 08:25:46 -05:00
pollCost
2022-02-26 10:41:30 -06:00
status
2022-07-21 17:55:05 -05:00
uploadId
2021-11-27 12:01:02 -06:00
mine
2023-02-03 18:08:08 -06:00
}`
export const ITEM_FULL_FIELDS = gql`
${ITEM_FIELDS}
fragment ItemFullFields on Item {
...ItemFields
text
fwdUser {
name
streak
2023-05-01 16:49:47 -05:00
hideCowboyHat
2023-02-03 18:08:08 -06:00
id
}
2021-07-07 19:15:27 -05:00
root {
id
title
2023-02-03 18:08:08 -06:00
bounty
bountyPaidTo
2023-05-05 12:38:56 -05:00
subName
2021-10-27 13:26:34 -05:00
user {
name
2023-02-01 08:44:35 -06:00
streak
2023-05-01 16:49:47 -05:00
hideCowboyHat
2021-10-27 13:26:34 -05:00
id
}
2021-07-07 19:15:27 -05:00
}
2021-04-22 17:14:32 -05:00
}`
2023-01-22 14:17:50 -06:00
export const ITEM_OTS_FIELDS = gql`
fragment ItemOtsFields on Item {
id
title
text
url
parentOtsHash
otsHash
deletedAt
}`
export const ITEM_OTS = gql`
${ITEM_OTS_FIELDS}
query Item($id: ID!) {
item(id: $id) {
...ItemOtsFields
}
}`
2022-08-18 13:15:24 -05:00
export const POLL_FIELDS = gql`
fragment PollFields on Item {
poll {
meVoted
count
options {
id
option
count
meVoted
}
}
}`
2021-10-26 15:49:37 -05:00
export const ITEM = gql`
2023-02-03 18:08:08 -06:00
${ITEM_FULL_FIELDS}
2022-08-18 13:15:24 -05:00
${POLL_FIELDS}
2021-10-26 15:49:37 -05:00
query Item($id: ID!) {
item(id: $id) {
2023-02-03 18:08:08 -06:00
...ItemFullFields
2022-08-18 13:15:24 -05:00
...PollFields
2021-10-26 15:49:37 -05:00
}
}`
2021-06-22 12:47:49 -05:00
2021-10-26 15:49:37 -05:00
export const ITEM_FULL = gql`
2023-02-03 18:08:08 -06:00
${ITEM_FULL_FIELDS}
2022-08-18 13:15:24 -05:00
${POLL_FIELDS}
2021-09-30 10:46:58 -05:00
${COMMENTS}
2023-07-25 19:45:35 -05:00
query Item($id: ID!, $sort: String) {
2021-10-26 15:49:37 -05:00
item(id: $id) {
2023-02-03 18:08:08 -06:00
...ItemFullFields
prior
2022-08-18 13:15:24 -05:00
...PollFields
2023-07-25 19:45:35 -05:00
comments(sort: $sort) {
2021-09-30 10:46:58 -05:00
...CommentsRecursive
}
2021-04-22 17:14:32 -05:00
}
}`
2021-04-24 16:05:07 -05:00
2022-10-26 17:46:01 -05:00
export const RELATED_ITEMS = gql`
${ITEM_FIELDS}
query Related($title: String, $id: ID, $cursor: String, $limit: Int) {
related(title: $title, id: $id, cursor: $cursor, limit: $limit) {
cursor
items {
...ItemFields
}
}
}
`
export const RELATED_ITEMS_WITH_ITEM = gql`
${ITEM_FIELDS}
query Related($title: String, $id: ID, $cursor: String, $limit: Int) {
item(id: $id) {
...ItemFields
}
related(title: $title, id: $id, cursor: $cursor, limit: $limit) {
cursor
items {
...ItemFields
}
}
}
`