Keyan 146b60278c
cowboy credits (aka nov-5 (aka jan-3)) (#1678)
* wip adding cowboy credits

* invite gift paid action

* remove balance limit

* remove p2p zap withdrawal notifications

* credits typedefs

* squash migrations

* remove wallet limit stuff

* CCs in item detail

* comments with meCredits

* begin including CCs in item stats/notifications

* buy credits ui/mutation

* fix old /settings/wallets paths

* bios don't get sats

* fix settings

* make invites work with credits

* restore migration from master

* inform backend of send wallets on zap

* satistics header

* default receive options to true and squash migrations

* fix paidAction query

* add nav for credits

* fix forever stacked count

* ek suggested fixes

* fix lint

* fix freebies wrt CCs

* add back disable freebies

* trigger cowboy hat job on CC depletion

* fix meMsats+meMcredits

* Update api/paidAction/README.md

Co-authored-by: ekzyis <ek@stacker.news>

* remove expireBoost migration that doesn't work

---------

Co-authored-by: ekzyis <ek@stacker.news>
2025-01-03 10:33:07 -06:00

205 lines
3.1 KiB
JavaScript

import { gql } from '@apollo/client'
import { COMMENTS } from './comments'
// we can't import from users because of circular dependency
const STREAK_FIELDS = gql`
fragment StreakFields on User {
optional {
streak
gunStreak
horseStreak
}
}
`
export const ITEM_FIELDS = gql`
${STREAK_FIELDS}
fragment ItemFields on Item {
id
parentId
createdAt
deletedAt
title
url
user {
id
name
meMute
...StreakFields
}
sub {
name
userId
moderated
meMuteSub
meSubscription
nsfw
}
otsHash
position
sats
credits
meAnonSats @client
boost
bounty
bountyPaidTo
noteId
path
upvotes
meSats
meCredits
meDontLikeSats
meBookmark
meSubscription
meForward
outlawed
freebie
bio
ncomments
commentSats
commentCredits
lastCommentAt
isJob
status
company
location
remote
subName
pollCost
pollExpiresAt
uploadId
mine
imgproxyUrls
rel
apiKey
invoice {
id
actionState
confirmedAt
}
cost
}`
export const ITEM_FULL_FIELDS = gql`
${ITEM_FIELDS}
${STREAK_FIELDS}
fragment ItemFullFields on Item {
...ItemFields
text
root {
id
title
bounty
bountyPaidTo
subName
mine
user {
id
name
...StreakFields
}
sub {
name
userId
moderated
meMuteSub
meSubscription
}
}
forwards {
userId
pct
user {
name
}
}
}`
export const ITEM_OTS_FIELDS = gql`
fragment ItemOtsFields on Item {
id
title
text
url
parentOtsHash
otsHash
deletedAt
}`
export const ITEM_OTS = gql`
${ITEM_OTS_FIELDS}
query Item($id: ID!) {
item(id: $id) {
...ItemOtsFields
}
}`
export const POLL_FIELDS = gql`
fragment PollFields on Item {
poll {
meVoted
meInvoiceId
meInvoiceActionState
count
options {
id
option
count
}
}
}`
export const ITEM = gql`
${ITEM_FULL_FIELDS}
${POLL_FIELDS}
query Item($id: ID!) {
item(id: $id) {
...ItemFullFields
...PollFields
}
}`
export const ITEM_FULL = gql`
${ITEM_FULL_FIELDS}
${POLL_FIELDS}
${COMMENTS}
query Item($id: ID!, $sort: String) {
item(id: $id) {
...ItemFullFields
prior
...PollFields
comments(sort: $sort) {
...CommentsRecursive
}
}
}`
export const RELATED_ITEMS = gql`
${ITEM_FIELDS}
query Related($title: String, $id: ID, $cursor: String, $limit: Limit) {
related(title: $title, id: $id, cursor: $cursor, limit: $limit) {
cursor
items {
...ItemFields
}
}
}
`
export const RELATED_ITEMS_WITH_ITEM = gql`
${ITEM_FIELDS}
query Related($title: String, $id: ID!, $cursor: String, $limit: Limit) {
item(id: $id) {
...ItemFields
}
related(title: $title, id: $id, cursor: $cursor, limit: $limit) {
cursor
items {
...ItemFields
}
}
}
`