118 lines
3.5 KiB
JavaScript
Raw Normal View History

import { gql } from 'graphql-tag'
2021-03-25 14:29:24 -05:00
export default gql`
extend type Query {
2023-10-23 18:19:36 -05:00
me: User
2022-06-02 17:55:23 -05:00
settings: User
2021-05-21 17:32:21 -05:00
user(name: String!): User
2021-03-25 14:29:24 -05:00
users: [User!]
2021-05-21 17:32:21 -05:00
nameAvailable(name: String!): Boolean!
topUsers(cursor: String, when: String, from: String, to: String, by: String, limit: Int): Users
2023-02-09 12:41:28 -06:00
topCowboys(cursor: String): Users
2022-10-25 12:13:06 -05:00
searchUsers(q: String!, limit: Int, similarity: Float): [User!]!
hasNewNotes: Boolean!
2021-12-16 18:01:02 -06:00
}
type Users {
cursor: String
users: [User!]!
2021-03-25 14:29:24 -05:00
}
2021-05-21 19:09:11 -05:00
extend type Mutation {
setName(name: String!): String
setSettings(tipDefault: Int!, turboTipping: Boolean!, fiatCurrency: String!, withdrawMaxFeeDefault: Int!, noteItemSats: Boolean!,
2022-12-09 13:25:38 -06:00
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!, imgproxyOnly: Boolean!,
wildWestMode: Boolean!, greeterMode: Boolean!, nostrPubkey: String, nostrCrossposting: Boolean, nostrRelays: [String!], hideBookmarks: Boolean!,
noteForwardedSats: Boolean!, hideWalletBalance: Boolean!, hideIsContributor: Boolean!, diagnostics: Boolean!): User
2022-05-16 15:51:22 -05:00
setPhoto(photoId: ID!): Int!
2021-09-24 16:28:21 -05:00
upsertBio(bio: String!): User!
2021-12-09 14:40:40 -06:00
setWalkthrough(tipPopover: Boolean, upvotePopover: Boolean): Boolean
2022-06-02 17:55:23 -05:00
unlinkAuth(authType: String!): AuthMethods!
linkUnverifiedEmail(email: String!): Boolean
hideWelcomeBanner: Boolean
subscribeUserPosts(id: ID): User
subscribeUserComments(id: ID): User
2023-09-28 15:02:25 -05:00
toggleMute(id: ID): User
2022-06-02 17:55:23 -05:00
}
type AuthMethods {
lightning: Boolean!
nostr: Boolean!
2022-06-02 17:55:23 -05:00
github: Boolean!
2023-01-18 12:49:20 -06:00
twitter: Boolean!
email: String
2021-05-21 19:09:11 -05:00
}
Image uploads (#576) * Add icon to add images * Open file explorer to select image * Upload images to S3 on selection * Show uploaded images below text input * Link and remove image * Fetch unsubmitted images from database * Mark S3 images as submitted in imgproxy job * Add margin-top * Mark images as submitted on client after successful mutation * Also delete objects in S3 * Allow items to have multiple uploads linked * Overwrite old avatar * Add fees for presigned URLs * Use Github style upload * removed upfront fees * removed images provider since we no longer need to keep track of unsubmitted images on the client * removed User.images resolver * removed deleteImage mutation * use Github style upload where it shows ![Uploading <filename>...]() first and then replaces that with ![<filename>](<url>) after successful upload * Add Upload.paid boolean column One item can have multiple images linked to it, but an image can also be used in multiple items (many-to-many relation). Since we don't really care to which item an image is linked and vice versa, we just use a boolean column to mark if an image was already paid for. This makes fee calculation easier since no JOINs are required. * Add image fees during item creation/update * we calculate image fees during item creation and update now * function imageFees returns queries which deduct fees from user and mark images as paid + fees * queries need to be run inside same transaction as item creation/update * Allow anons to get presigned URLs * Add comments regarding avatar upload * Use megabytes in error message * Remove unnecessary avatar check during image fees calculation * Show image fees in frontend * Also update image fees on blur This makes sure that the images fees reflect the current state. For example, if an image was removed. We could also add debounced requests. * Show amount of unpaid images in receipt * Fix fees in sats deducted from msats * Fix algebraic order of fees Spam fees must come immediately after the base fee since it multiplies the base fee. * Fix image fees in edit receipt * Fix stale fees shown If we pay for an image and then want to edit the comment, the cache might return stale date; suggesting we didn't pay for the existing image yet. * Add 0 base fee in edit receipt * Remove 's' from 'image fees' in receipts * Remove unnecessary async * Remove 'Uploading <name>...' from text input on error * Support upload of multiple files at once * Add schedule to delete unused images * Fix image fee display in receipts * Use Drag and Drop API for image upload * Remove dragOver style on drop * Increase max upload size to 10MB to allow HQ camera pictures * Fix free upload quota * Fix stale image fees served * Fix bad image fee return statements * Fix multiplication with feesPerImage * Fix NULL returned for size24h, sizeNow * Remove unnecessary text field in query * refactor: Unify <ImageUpload> and <Upload> component * Add avatar cache busting using random query param * Calculate image fee info in postgres function * we now calculate image fee info in a postgres function which is much cleaner * we use this function inside `create_item` and `update_item`: image fees are now deducted in the same transaction as creating/updating the item! * reversed changes in `serializeInvoiceable` * Fix line break in receipt * Update upload limits * Add comment about `e.target.value = null` * Use debounce instead of onBlur to update image fees info * Fix invoice amount * Refactor avatar upload control flow * Update image fees in onChange * Fix rescheduling of other jobs * also update schedule from every minute to every hour * Add image fees in calling context * keep item ids on uploads * Fix incompatible onSubmit signature * Revert "keep item ids on uploads" This reverts commit 4688962abcd54fdc5850109372a7ad054cf9b2e4. * many2many item uploads * pretty subdomain for images * handle upload conditions for profile images and job logos --------- Co-authored-by: ekzyis <ek@ekzyis.com> Co-authored-by: ekzyis <ek@stacker.news>
2023-11-06 21:53:33 +01:00
type Image {
id: ID!
createdAt: Date!
updatedAt: Date!
type: String!
size: Int!
width: Int
height: Int
itemId: Int
userId: Int!
}
2021-03-25 14:29:24 -05:00
type User {
id: ID!
2023-07-26 19:18:42 -05:00
createdAt: Date!
2021-03-25 14:29:24 -05:00
name: String
nitems(when: String, from: String, to: String): Int!
nposts(when: String, from: String, to: String): Int!
ncomments(when: String, from: String, to: String): Int!
nbookmarks(when: String, from: String, to: String): Int!
stacked(when: String, from: String, to: String): Int!
spent(when: String, from: String, to: String): Int!
referrals(when: String, from: String, to: String): Int!
2021-05-24 19:08:56 -05:00
freePosts: Int!
freeComments: Int!
2021-10-15 18:07:51 -05:00
hasInvites: Boolean!
2021-09-12 11:55:38 -05:00
tipDefault: Int!
2022-12-09 13:25:38 -06:00
turboTipping: Boolean!
2022-09-13 02:24:31 +02:00
fiatCurrency: String!
withdrawMaxFeeDefault: Int!
2023-01-06 18:53:09 -06:00
nostrPubkey: String
nostrRelays: [String!]
2021-09-23 12:42:00 -05:00
bio: Item
2022-04-28 13:11:05 -05:00
bioId: Int
2022-05-16 15:51:22 -05:00
photoId: Int
2023-02-01 08:44:35 -06:00
streak: Int
maxStreak: Int
2021-04-22 17:14:32 -05:00
sats: Int!
2023-06-02 19:55:45 -05:00
since: Int
2021-12-09 14:40:40 -06:00
upvotePopover: Boolean!
tipPopover: Boolean!
nostrCrossposting: Boolean!
2022-04-21 17:50:02 -05:00
noteItemSats: Boolean!
noteEarning: Boolean!
noteAllDescendants: Boolean!
noteMentions: Boolean!
noteDeposits: Boolean!
noteInvites: Boolean!
noteJobIndicator: Boolean!
2023-02-01 08:44:35 -06:00
noteCowboyHat: Boolean!
noteForwardedSats: Boolean!
2022-08-30 16:50:47 -05:00
hideInvoiceDesc: Boolean!
2022-12-01 15:31:04 -06:00
hideFromTopUsers: Boolean!
2023-05-01 16:49:47 -05:00
hideCowboyHat: Boolean!
hideBookmarks: Boolean!
hideWelcomeBanner: Boolean!
hideWalletBalance: Boolean!
diagnostics: Boolean!
imgproxyOnly: Boolean!
2022-09-21 14:57:36 -05:00
wildWestMode: Boolean!
2022-09-27 16:19:15 -05:00
greeterMode: Boolean!
lastCheckedJobs: String
2022-06-02 17:55:23 -05:00
authMethods: AuthMethods!
isContributor: Boolean!
hideIsContributor: Boolean!
meSubscriptionPosts: Boolean!
meSubscriptionComments: Boolean!
2023-09-28 15:02:25 -05:00
meMute: Boolean
2021-03-25 14:29:24 -05:00
}
`