stacker.news/fragments/subs.js

92 lines
1.6 KiB
JavaScript
Raw Normal View History

2022-02-17 17:23:43 +00:00
import { gql } from '@apollo/client'
import { ITEM_FIELDS } from './items'
2023-05-01 20:58:30 +00:00
import { COMMENT_FIELDS } from './comments'
2022-02-17 17:23:43 +00:00
export const SUB_FIELDS = gql`
fragment SubFields on Sub {
name
postTypes
rankingType
baseCost
}`
export const SUB = gql`
${SUB_FIELDS}
2023-05-01 20:58:30 +00:00
query Sub($sub: String!) {
2022-02-17 17:23:43 +00:00
sub(name: $sub) {
...SubFields
}
}`
export const SUB_ITEMS = gql`
${SUB_FIELDS}
${ITEM_FIELDS}
2023-05-01 20:58:30 +00:00
query SubItems($sub: String!, $sort: String, $type: String) {
2022-02-17 17:23:43 +00:00
sub(name: $sub) {
...SubFields
}
2023-05-01 20:58:30 +00:00
items(sub: $sub, sort: $sort, type: $type) {
2022-02-17 17:23:43 +00:00
cursor
items {
...ItemFields
2022-07-21 22:55:05 +00:00
position
},
pins {
...ItemFields
position
2022-02-17 17:23:43 +00:00
}
}
}
`
export const SUB_SEARCH = gql`
${SUB_FIELDS}
${ITEM_FIELDS}
2023-05-01 20:58:30 +00:00
query SubSearch($sub: String!, $q: String, $cursor: String) {
2022-02-17 17:23:43 +00:00
sub(name: $sub) {
...SubFields
}
2023-05-01 20:58:30 +00:00
search(q: $q, cursor: $cursor) {
2022-02-17 17:23:43 +00:00
cursor
items {
...ItemFields
text
searchTitle
searchText
}
}
}
`
2023-05-01 20:58:30 +00:00
export const SUB_FLAT_COMMENTS = gql`
${SUB_FIELDS}
${COMMENT_FIELDS}
query SubFlatComments($sub: String!, $sort: String!, $cursor: String) {
sub(name: $sub) {
...SubFields
}
moreFlatComments(sub: $sub, sort: $sort, cursor: $cursor) {
cursor
comments {
...CommentFields
2023-05-06 21:51:17 +00:00
root {
id
title
bounty
bountyPaidTo
subName
user {
name
streak
hideCowboyHat
id
}
}
2023-05-01 20:58:30 +00:00
}
}
}
`