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
|
2023-12-10 21:41:20 +00:00
|
|
|
allowFreebies
|
2022-02-17 17:23:43 +00:00
|
|
|
rankingType
|
2023-11-21 23:32:22 +00:00
|
|
|
billingType
|
|
|
|
billingCost
|
2023-12-08 20:02:00 +00:00
|
|
|
billingAutoRenew
|
2023-11-21 23:32:22 +00:00
|
|
|
billedLastAt
|
2022-02-17 17:23:43 +00:00
|
|
|
baseCost
|
2023-11-21 23:32:22 +00:00
|
|
|
userId
|
|
|
|
desc
|
|
|
|
status
|
2023-12-23 20:26:16 +00:00
|
|
|
moderated
|
|
|
|
moderatedCount
|
2023-12-15 18:10:29 +00:00
|
|
|
meMuteSub
|
2024-02-10 02:35:32 +00:00
|
|
|
nsfw
|
2023-11-21 23:32:22 +00:00
|
|
|
}`
|
|
|
|
|
|
|
|
export const SUB_FULL_FIELDS = gql`
|
|
|
|
${SUB_FIELDS}
|
|
|
|
|
|
|
|
fragment SubFullFields on Sub {
|
|
|
|
...SubFields
|
|
|
|
user {
|
|
|
|
name
|
|
|
|
id
|
|
|
|
optional {
|
|
|
|
streak
|
|
|
|
}
|
|
|
|
}
|
2022-02-17 17:23:43 +00:00
|
|
|
}`
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}`
|
|
|
|
|
2023-11-21 23:32:22 +00:00
|
|
|
export const SUB_FULL = gql`
|
|
|
|
${SUB_FULL_FIELDS}
|
|
|
|
|
|
|
|
query Sub($sub: String) {
|
|
|
|
sub(name: $sub) {
|
|
|
|
...SubFullFields
|
|
|
|
}
|
|
|
|
}`
|
|
|
|
|
|
|
|
export const SUBS = gql`
|
2022-02-17 17:23:43 +00:00
|
|
|
${SUB_FIELDS}
|
2023-11-21 23:32:22 +00:00
|
|
|
|
|
|
|
query Subs {
|
|
|
|
subs {
|
|
|
|
...SubFields
|
|
|
|
}
|
|
|
|
}`
|
|
|
|
|
|
|
|
export const SUB_ITEMS = gql`
|
|
|
|
${SUB_FULL_FIELDS}
|
2022-02-17 17:23:43 +00:00
|
|
|
${ITEM_FIELDS}
|
2023-07-23 15:08:43 +00:00
|
|
|
${COMMENTS_ITEM_EXT_FIELDS}
|
|
|
|
|
2023-11-22 16:30:43 +00:00
|
|
|
query SubItems($sub: String, $sort: String, $cursor: String, $type: String, $name: String, $when: String, $from: String, $to: String, $by: String, $limit: Limit, $includeComments: Boolean = false) {
|
2022-02-17 17:23:43 +00:00
|
|
|
sub(name: $sub) {
|
2023-11-21 23:32:22 +00:00
|
|
|
...SubFullFields
|
2022-02-17 17:23:43 +00:00
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
2023-11-21 23:32:22 +00:00
|
|
|
|
|
|
|
export const SUB_PAY = gql`
|
|
|
|
${SUB_FULL_FIELDS}
|
|
|
|
mutation paySub($name: String!, $hash: String, $hmac: String) {
|
|
|
|
paySub(name: $name, hash: $hash, hmac: $hmac) {
|
|
|
|
...SubFullFields
|
|
|
|
}
|
|
|
|
}`
|