stacker.news/fragments/items.js

126 lines
1.9 KiB
JavaScript
Raw Normal View History

2021-04-22 22:14:32 +00:00
import { gql } from '@apollo/client'
2021-09-30 15:46:58 +00:00
import { COMMENTS } from './comments'
2021-04-22 22:14:32 +00:00
export const ITEM_FIELDS = gql`
fragment ItemFields on Item {
id
parentId
createdAt
title
url
user {
name
2021-08-10 22:59:06 +00:00
id
2021-04-22 22:14:32 +00:00
}
2022-04-19 18:32:39 +00:00
fwdUser {
name
id
}
2021-04-22 22:14:32 +00:00
sats
upvotes
2021-04-27 21:30:58 +00:00
boost
2021-12-05 17:37:55 +00:00
meSats
2021-04-22 22:14:32 +00:00
ncomments
2022-02-17 17:23:43 +00:00
maxBid
2022-03-07 21:50:13 +00:00
company
location
remote
2022-02-17 17:23:43 +00:00
sub {
name
baseCost
}
2022-02-26 16:41:30 +00:00
status
2021-11-27 18:01:02 +00:00
mine
2021-07-08 00:15:27 +00:00
root {
id
title
2022-02-17 17:23:43 +00:00
sub {
name
}
2021-10-27 18:26:34 +00:00
user {
name
id
}
2021-07-08 00:15:27 +00:00
}
2021-04-22 22:14:32 +00:00
}`
2022-02-17 17:23:43 +00:00
export const ITEMS = gql`
2021-06-22 17:47:49 +00:00
${ITEM_FIELDS}
2022-02-17 17:23:43 +00: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 17:47:49 +00:00
cursor
items {
...ItemFields
position
2022-01-07 16:32:31 +00:00
},
pins {
...ItemFields
position
2021-06-22 17:47:49 +00:00
}
}
2021-10-26 20:49:37 +00:00
}`
export const ITEM = gql`
${ITEM_FIELDS}
query Item($id: ID!) {
item(id: $id) {
...ItemFields
text
}
}`
2021-06-22 17:47:49 +00:00
2021-12-21 21:29:42 +00:00
export const COMMENTS_QUERY = gql`
${COMMENTS}
query Comments($id: ID!, $sort: String) {
comments(id: $id, sort: $sort) {
...CommentsRecursive
}
}
`
2021-10-26 20:49:37 +00:00
export const ITEM_FULL = gql`
2021-04-22 22:14:32 +00:00
${ITEM_FIELDS}
2021-09-30 15:46:58 +00:00
${COMMENTS}
2021-10-26 20:49:37 +00:00
query Item($id: ID!) {
item(id: $id) {
2021-04-22 22:14:32 +00:00
...ItemFields
prior
meComments
2022-01-07 16:32:31 +00:00
position
2021-09-30 15:46:58 +00:00
text
comments {
...CommentsRecursive
}
2021-04-22 22:14:32 +00:00
}
}`
2021-04-24 21:05:07 +00:00
2021-09-30 15:46:58 +00:00
export const ITEM_WITH_COMMENTS = gql`
2021-04-24 21:05:07 +00:00
${ITEM_FIELDS}
2021-09-30 15:46:58 +00:00
${COMMENTS}
fragment ItemWithComments on Item {
2021-04-24 21:05:07 +00:00
...ItemFields
2021-09-30 15:46:58 +00:00
text
meComments
2021-09-30 15:46:58 +00:00
comments {
...CommentsRecursive
}
}`
2022-01-27 19:18:48 +00: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 22:01:42 +00:00
searchTitle
searchText
2022-01-27 19:18:48 +00:00
}
}
}
`