271 lines
4.6 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
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-02-17 11:23:43 -06:00
export const ITEMS = gql`
2021-06-22 12:47:49 -05:00
${ITEM_FIELDS}
2022-12-01 16:22:13 -06:00
query items($sub: String, $sort: String, $type: String, $cursor: String, $name: String, $within: String) {
items(sub: $sub, sort: $sort, type: $type, cursor: $cursor, name: $name, within: $within) {
2021-06-22 12:47:49 -05:00
cursor
items {
...ItemFields
2022-01-07 10:32:31 -06:00
},
pins {
2022-10-25 16:35:32 -05:00
...ItemFields
}
}
}`
export const TOP_ITEMS = gql`
${ITEM_FIELDS}
2023-02-03 13:10:18 -06:00
query topItems($sort: String, $cursor: String, $when: String) {
2022-10-25 16:35:32 -05:00
topItems(sort: $sort, cursor: $cursor, when: $when) {
cursor
items {
...ItemFields
},
pins {
2022-01-07 10:32:31 -06:00
...ItemFields
2021-06-22 12:47:49 -05:00
}
}
2021-10-26 15:49:37 -05:00
}`
2022-09-22 13:44:50 -05:00
export const OUTLAWED_ITEMS = gql`
2023-02-03 18:08:08 -06:00
${ITEM_FULL_FIELDS}
2022-09-22 13:44:50 -05:00
query outlawedItems($cursor: String) {
outlawedItems(cursor: $cursor) {
cursor
items {
2023-02-03 18:08:08 -06:00
...ItemFullFields
2022-09-22 13:44:50 -05:00
}
}
}`
2022-09-22 15:42:04 -05:00
export const BORDERLAND_ITEMS = gql`
2023-02-03 18:08:08 -06:00
${ITEM_FULL_FIELDS}
2022-09-22 15:42:04 -05:00
query borderlandItems($cursor: String) {
borderlandItems(cursor: $cursor) {
cursor
items {
2023-02-03 18:08:08 -06:00
...ItemFullFields
2022-09-22 15:42:04 -05:00
}
}
}`
2022-09-27 16:19:15 -05:00
export const FREEBIE_ITEMS = gql`
2023-02-03 18:08:08 -06:00
${ITEM_FULL_FIELDS}
2022-09-27 16:19:15 -05:00
query freebieItems($cursor: String) {
freebieItems(cursor: $cursor) {
cursor
items {
2023-02-03 18:08:08 -06:00
...ItemFullFields
2022-09-27 16:19:15 -05:00
}
}
}`
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-12-21 15:29:42 -06:00
export const COMMENTS_QUERY = gql`
${COMMENTS}
query Comments($id: ID!, $sort: String) {
comments(id: $id, sort: $sort) {
...CommentsRecursive
}
}
`
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}
2021-10-26 15:49:37 -05:00
query Item($id: ID!) {
item(id: $id) {
2023-02-03 18:08:08 -06:00
...ItemFullFields
prior
2022-08-18 13:15:24 -05:00
...PollFields
2021-09-30 10:46:58 -05:00
comments {
...CommentsRecursive
}
2021-04-22 17:14:32 -05:00
}
}`
2021-04-24 16:05:07 -05:00
2021-09-30 10:46:58 -05:00
export const ITEM_WITH_COMMENTS = gql`
2023-02-03 18:08:08 -06:00
${ITEM_FULL_FIELDS}
2021-09-30 10:46:58 -05:00
${COMMENTS}
fragment ItemWithComments on Item {
2023-02-03 18:08:08 -06:00
...ItemFullFields
2021-09-30 10:46:58 -05:00
comments {
...CommentsRecursive
}
}`
2022-01-27 13:18:48 -06:00
2023-01-26 10:11:55 -06:00
export const BOUNTY_ITEMS_BY_USER_NAME = gql`
${ITEM_FIELDS}
query getBountiesByUserName($name: String!, $cursor: String, $limit: Int) {
getBountiesByUserName(name: $name, cursor: $cursor, limit: $limit) {
2023-01-26 10:11:55 -06:00
cursor
items {
...ItemFields
}
}
}`
2022-01-27 13:18:48 -06:00
export const ITEM_SEARCH = gql`
2023-02-03 18:08:08 -06:00
${ITEM_FULL_FIELDS}
2022-10-20 17:44:44 -05:00
query Search($q: String, $cursor: String, $sort: String, $what: String, $when: String) {
search(q: $q, cursor: $cursor, sort: $sort, what: $what, when: $when) {
2022-01-27 13:18:48 -06:00
cursor
items {
2023-02-03 18:08:08 -06:00
...ItemFullFields
2022-02-03 16:01:42 -06:00
searchTitle
searchText
2022-01-27 13:18:48 -06: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
}
}
}
`