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
|
|
|
|
2024-10-12 00:14:18 +00:00
|
|
|
// we can't import from users because of circular dependency
|
|
|
|
const STREAK_FIELDS = gql`
|
|
|
|
fragment StreakFields on User {
|
|
|
|
optional {
|
|
|
|
streak
|
|
|
|
gunStreak
|
|
|
|
horseStreak
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
2022-02-17 17:23:43 +00:00
|
|
|
export const SUB_FIELDS = gql`
|
|
|
|
fragment SubFields on Sub {
|
|
|
|
name
|
2024-04-02 23:17:32 +00:00
|
|
|
createdAt
|
2022-02-17 17:23:43 +00:00
|
|
|
postTypes
|
|
|
|
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
|
2024-02-16 18:25:12 +00:00
|
|
|
billPaidUntil
|
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-23 15:12:49 +00:00
|
|
|
meSubscription
|
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}
|
2024-10-12 00:14:18 +00:00
|
|
|
${STREAK_FIELDS}
|
2023-11-21 23:32:22 +00:00
|
|
|
fragment SubFullFields on Sub {
|
|
|
|
...SubFields
|
|
|
|
user {
|
|
|
|
name
|
|
|
|
id
|
2024-10-12 00:14:18 +00:00
|
|
|
...StreakFields
|
2023-11-21 23:32:22 +00:00
|
|
|
}
|
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
|
|
|
}
|
2024-09-19 18:13:14 +00:00
|
|
|
ad {
|
|
|
|
...ItemFields
|
|
|
|
}
|
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
|
|
|
|
2024-02-14 20:27:00 +00:00
|
|
|
export const TOP_SUBS = gql`
|
2024-02-14 21:06:42 +00:00
|
|
|
${SUB_FULL_FIELDS}
|
2024-02-14 20:27:00 +00:00
|
|
|
query TopSubs($cursor: String, $when: String, $from: String, $to: String, $by: String, ) {
|
|
|
|
topSubs(cursor: $cursor, when: $when, from: $from, to: $to, by: $by) {
|
|
|
|
subs {
|
2024-02-14 21:06:42 +00:00
|
|
|
...SubFullFields
|
2024-02-14 20:27:00 +00:00
|
|
|
ncomments(when: $when, from: $from, to: $to)
|
|
|
|
nposts(when: $when, from: $from, to: $to)
|
|
|
|
|
|
|
|
optional {
|
|
|
|
stacked(when: $when, from: $from, to: $to)
|
|
|
|
spent(when: $when, from: $from, to: $to)
|
|
|
|
revenue(when: $when, from: $from, to: $to)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cursor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|