2022-02-17 17:23:43 +00:00
|
|
|
import { gql } from '@apollo/client'
|
2023-07-23 15:08:43 +00:00
|
|
|
import { ITEM_FIELDS, ITEM_FULL_FIELDS } from './items'
|
|
|
|
import { COMMENTS_ITEM_EXT_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-07-23 15:08:43 +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-07-23 15:08:43 +00:00
|
|
|
${COMMENTS_ITEM_EXT_FIELDS}
|
|
|
|
|
2023-11-09 00:15:36 +00:00
|
|
|
query SubItems($sub: String, $sort: String, $cursor: String, $type: String, $name: String, $when: String, $from: String, $to: String, $by: String, $limit: Int, $includeComments: Boolean = false) {
|
2022-02-17 17:23:43 +00:00
|
|
|
sub(name: $sub) {
|
|
|
|
...SubFields
|
|
|
|
}
|
2023-07-23 15:08:43 +00:00
|
|
|
|
2023-11-09 00:15:36 +00:00
|
|
|
items(sub: $sub, sort: $sort, cursor: $cursor, type: $type, name: $name, when: $when, from: $from, to: $to, by: $by, limit: $limit) {
|
2022-02-17 17:23:43 +00:00
|
|
|
cursor
|
|
|
|
items {
|
|
|
|
...ItemFields
|
2023-07-23 15:08:43 +00:00
|
|
|
...CommentItemExtFields @include(if: $includeComments)
|
2022-07-21 22:55:05 +00:00
|
|
|
position
|
|
|
|
},
|
|
|
|
pins {
|
|
|
|
...ItemFields
|
2023-07-23 15:08:43 +00:00
|
|
|
...CommentItemExtFields @include(if: $includeComments)
|
2022-07-21 22:55:05 +00:00
|
|
|
position
|
2022-02-17 17:23:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
export const SUB_SEARCH = gql`
|
|
|
|
${SUB_FIELDS}
|
2023-07-23 15:08:43 +00:00
|
|
|
${ITEM_FULL_FIELDS}
|
2023-10-04 19:44:06 +00:00
|
|
|
query SubSearch($sub: String, $q: String, $cursor: String, $sort: String, $what: String, $when: String, $from: String, $to: String) {
|
2022-02-17 17:23:43 +00:00
|
|
|
sub(name: $sub) {
|
|
|
|
...SubFields
|
|
|
|
}
|
2023-10-04 19:44:06 +00:00
|
|
|
search(sub: $sub, q: $q, cursor: $cursor, sort: $sort, what: $what, when: $when, from: $from, to: $to) {
|
2022-02-17 17:23:43 +00:00
|
|
|
cursor
|
|
|
|
items {
|
2023-07-23 15:08:43 +00:00
|
|
|
...ItemFullFields
|
2022-02-17 17:23:43 +00:00
|
|
|
searchTitle
|
|
|
|
searchText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|