119 lines
1.8 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
title
url
user {
name
2021-08-10 17:59:06 -05:00
id
2021-04-22 17:14:32 -05:00
}
sats
upvotes
2021-04-27 16:30:58 -05:00
boost
2021-12-05 11:37:55 -06:00
meSats
2021-04-22 17:14:32 -05:00
ncomments
2022-02-17 11:23:43 -06:00
maxBid
2022-03-07 15:50:13 -06:00
company
location
remote
2022-02-17 11:23:43 -06:00
sub {
name
baseCost
}
2022-02-26 10:41:30 -06:00
status
2021-11-27 12:01:02 -06:00
mine
2021-07-07 19:15:27 -05:00
root {
id
title
2022-02-17 11:23:43 -06:00
sub {
name
}
2021-10-27 13:26:34 -05:00
user {
name
id
}
2021-07-07 19:15:27 -05:00
}
2021-04-22 17:14:32 -05:00
}`
2022-02-17 11:23:43 -06:00
export const ITEMS = gql`
2021-06-22 12:47:49 -05:00
${ITEM_FIELDS}
2022-02-17 11:23:43 -06:00
query items($sub: String, $sort: String, $cursor: String, $name: String, $within: String) {
items(sub: $sub, sort: $sort, 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 {
...ItemFields
position
2021-06-22 12:47:49 -05:00
}
}
2021-10-26 15:49:37 -05:00
}`
export const ITEM = gql`
${ITEM_FIELDS}
query Item($id: ID!) {
item(id: $id) {
...ItemFields
text
}
}`
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`
2021-04-22 17:14:32 -05:00
${ITEM_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) {
2021-04-22 17:14:32 -05:00
...ItemFields
prior
2022-01-07 10:32:31 -06:00
position
2021-09-30 10:46:58 -05:00
text
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`
2021-04-24 16:05:07 -05:00
${ITEM_FIELDS}
2021-09-30 10:46:58 -05:00
${COMMENTS}
fragment ItemWithComments on Item {
2021-04-24 16:05:07 -05:00
...ItemFields
2021-09-30 10:46:58 -05:00
text
comments {
...CommentsRecursive
}
}`
2022-01-27 13:18:48 -06:00
export const ITEM_SEARCH = gql`
${ITEM_FIELDS}
query Search($q: String!, $cursor: String) {
search(q: $q, cursor: $cursor) {
cursor
items {
...ItemFields
text
2022-02-03 16:01:42 -06:00
searchTitle
searchText
2022-01-27 13:18:48 -06:00
}
}
}
`