211 lines
4.7 KiB
JavaScript
Raw Normal View History

2021-09-24 16:28:21 -05:00
import { gql } from '@apollo/client'
2023-07-25 19:45:35 -05:00
import { COMMENTS, COMMENTS_ITEM_EXT_FIELDS } from './comments'
import { ITEM_FIELDS, ITEM_FULL_FIELDS } from './items'
2021-09-24 16:28:21 -05:00
2021-11-28 11:29:17 -06:00
export const ME = gql`
{
me {
id
name
2023-02-01 08:44:35 -06:00
streak
sats
stacked
freePosts
freeComments
tipDefault
2022-12-09 13:25:38 -06:00
turboTipping
fiatCurrency
bioId
upvotePopover
tipPopover
noteItemSats
noteEarning
noteAllDescendants
noteMentions
noteDeposits
noteInvites
noteJobIndicator
2023-02-01 08:44:35 -06:00
noteCowboyHat
2022-08-30 16:50:47 -05:00
hideInvoiceDesc
2022-12-01 15:31:04 -06:00
hideFromTopUsers
2023-05-01 16:49:47 -05:00
hideCowboyHat
2022-09-21 14:57:36 -05:00
wildWestMode
2022-09-27 16:19:15 -05:00
greeterMode
lastCheckedJobs
}
}`
export const SETTINGS_FIELDS = gql`
fragment SettingsFields on User {
2022-06-02 17:55:23 -05:00
tipDefault
2022-12-09 13:25:38 -06:00
turboTipping
fiatCurrency
2022-06-02 17:55:23 -05:00
noteItemSats
noteEarning
noteAllDescendants
noteMentions
noteDeposits
noteInvites
noteJobIndicator
2023-02-01 08:44:35 -06:00
noteCowboyHat
2022-08-30 16:50:47 -05:00
hideInvoiceDesc
2022-12-01 15:31:04 -06:00
hideFromTopUsers
2023-05-01 16:49:47 -05:00
hideCowboyHat
2023-01-06 18:53:09 -06:00
nostrPubkey
nostrRelays
2022-09-21 14:57:36 -05:00
wildWestMode
2022-09-27 16:19:15 -05:00
greeterMode
2022-06-02 17:55:23 -05:00
authMethods {
lightning
2023-01-18 12:49:20 -06:00
slashtags
nostr
2022-06-02 17:55:23 -05:00
github
2023-01-18 12:49:20 -06:00
twitter
email
2022-06-02 17:55:23 -05:00
}
}`
export const SETTINGS = gql`
${SETTINGS_FIELDS}
{
settings {
...SettingsFields
2022-06-02 17:55:23 -05:00
}
}`
export const SET_SETTINGS =
gql`
${SETTINGS_FIELDS}
2022-12-09 13:25:38 -06:00
mutation setSettings($tipDefault: Int!, $turboTipping: Boolean!, $fiatCurrency: String!, $noteItemSats: Boolean!,
$noteEarning: Boolean!, $noteAllDescendants: Boolean!, $noteMentions: Boolean!, $noteDeposits: Boolean!,
2023-05-01 16:49:47 -05:00
$noteInvites: Boolean!, $noteJobIndicator: Boolean!, $noteCowboyHat: Boolean!, $hideInvoiceDesc: Boolean!,
$hideFromTopUsers: Boolean!, $hideCowboyHat: Boolean!,
2023-01-06 18:53:09 -06:00
$wildWestMode: Boolean!, $greeterMode: Boolean!, $nostrPubkey: String, $nostrRelays: [String!]) {
2022-12-09 13:25:38 -06:00
setSettings(tipDefault: $tipDefault, turboTipping: $turboTipping, fiatCurrency: $fiatCurrency,
noteItemSats: $noteItemSats, noteEarning: $noteEarning, noteAllDescendants: $noteAllDescendants,
noteMentions: $noteMentions, noteDeposits: $noteDeposits, noteInvites: $noteInvites,
2023-05-01 16:49:47 -05:00
noteJobIndicator: $noteJobIndicator, noteCowboyHat: $noteCowboyHat, hideInvoiceDesc: $hideInvoiceDesc,
hideFromTopUsers: $hideFromTopUsers, hideCowboyHat: $hideCowboyHat,
2023-01-06 18:53:09 -06:00
wildWestMode: $wildWestMode, greeterMode: $greeterMode, nostrPubkey: $nostrPubkey, nostrRelays: $nostrRelays) {
...SettingsFields
}
}
`
2022-04-19 13:32:39 -05:00
export const NAME_QUERY =
gql`
query nameAvailable($name: String!) {
nameAvailable(name: $name)
}
`
export const NAME_MUTATION =
gql`
mutation setName($name: String!) {
setName(name: $name)
}
`
2022-08-26 17:20:09 -05:00
export const USER_SEARCH =
gql`
2022-10-25 12:13:06 -05:00
query searchUsers($q: String!, $limit: Int, $similarity: Float) {
searchUsers(q: $q, limit: $limit, similarity: $similarity) {
2023-08-11 14:12:18 -05:00
id
2022-08-26 17:20:09 -05:00
name
2023-02-01 08:44:35 -06:00
streak
2023-05-01 16:49:47 -05:00
hideCowboyHat
2022-10-25 12:13:06 -05:00
photoId
stacked
spent
ncomments
nposts
2023-07-10 12:59:21 -05:00
referrals
2022-08-26 17:20:09 -05:00
}
}`
2021-09-24 16:28:21 -05:00
export const USER_FIELDS = gql`
fragment UserFields on User {
id
name
2023-02-01 08:44:35 -06:00
streak
maxStreak
2023-05-01 16:49:47 -05:00
hideCowboyHat
2021-09-24 16:28:21 -05:00
nitems
stacked
since
2022-05-16 15:51:22 -05:00
photoId
2021-09-24 16:28:21 -05:00
}`
2021-09-30 10:46:58 -05:00
2021-12-16 18:39:19 -06:00
export const TOP_USERS = gql`
query TopUsers($cursor: String, $when: String, $by: String) {
topUsers(cursor: $cursor, when: $when, by: $by) {
2021-12-16 18:39:19 -06:00
users {
2023-08-11 14:12:18 -05:00
id
2021-12-16 18:39:19 -06:00
name
2023-02-01 08:44:35 -06:00
streak
2023-05-01 16:49:47 -05:00
hideCowboyHat
2022-10-25 16:35:32 -05:00
photoId
2022-10-26 09:56:22 -05:00
stacked(when: $when)
spent(when: $when)
ncomments(when: $when)
nposts(when: $when)
2022-12-19 17:00:53 -06:00
referrals(when: $when)
2021-12-16 18:39:19 -06:00
}
cursor
}
}
`
2023-02-09 12:41:28 -06:00
export const TOP_COWBOYS = gql`
query TopCowboys($cursor: String) {
topCowboys(cursor: $cursor) {
users {
2023-08-11 14:12:18 -05:00
id
2023-02-09 12:41:28 -06:00
name
streak
2023-05-01 16:49:47 -05:00
hideCowboyHat
2023-02-09 12:41:28 -06:00
photoId
stacked(when: "forever")
spent(when: "forever")
ncomments(when: "forever")
nposts(when: "forever")
2023-02-09 12:41:28 -06:00
referrals(when: "forever")
}
cursor
}
}
`
2021-10-26 15:49:37 -05:00
export const USER_FULL = gql`
2021-09-30 10:46:58 -05:00
${USER_FIELDS}
2023-07-25 19:45:35 -05:00
${ITEM_FULL_FIELDS}
${COMMENTS}
query User($name: String!, $sort: String) {
2021-10-26 15:49:37 -05:00
user(name: $name) {
2021-09-30 10:46:58 -05:00
...UserFields
bio {
2023-07-25 19:45:35 -05:00
...ItemFullFields
comments(sort: $sort) {
...CommentsRecursive
}
2021-09-30 10:46:58 -05:00
}
}
}`
2021-10-26 15:49:37 -05:00
export const USER_WITH_ITEMS = gql`
2021-10-26 15:49:37 -05:00
${USER_FIELDS}
${ITEM_FIELDS}
${COMMENTS_ITEM_EXT_FIELDS}
query UserWithItems($name: String!, $sub: String, $cursor: String, $type: String, $when: String, $by: String, $limit: Int, $includeComments: Boolean = false) {
2021-10-26 15:49:37 -05:00
user(name: $name) {
...UserFields
}
items(sub: $sub, sort: "user", cursor: $cursor, type: $type, name: $name, when: $when, by: $by, limit: $limit) {
2021-10-26 15:49:37 -05:00
cursor
items {
...ItemFields
...CommentItemExtFields @include(if: $includeComments)
2021-10-26 15:49:37 -05:00
}
}
}`