1518 Commits

Author SHA1 Message Date
keyan
4688962abc keep item ids on uploads 2023-11-05 14:38:34 -06:00
ekzyis
17b39d9982 Add image fees in calling context 2023-11-02 01:48:34 +01:00
ekzyis
11fa9e4d10 Fix rescheduling of other jobs
* also update schedule from every minute to every hour
2023-11-02 01:48:34 +01:00
ekzyis
90c563d921 Update image fees in onChange 2023-11-02 01:48:34 +01:00
ekzyis
f523c9b55d Refactor avatar upload control flow 2023-11-02 01:48:34 +01:00
ekzyis
ecd1dca361 Fix invoice amount 2023-11-02 01:48:34 +01:00
ekzyis
227e1737da Use debounce instead of onBlur to update image fees info 2023-11-02 01:48:34 +01:00
ekzyis
d8f502254c Add comment about e.target.value = null 2023-11-02 01:48:34 +01:00
ekzyis
619461c15d Update upload limits 2023-11-02 01:48:34 +01:00
ekzyis
5bcc18594c Fix line break in receipt 2023-11-02 01:48:34 +01:00
ekzyis
fe267cd3b9 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`
2023-11-02 01:48:34 +01:00
ekzyis
31fa3dcf26 Add avatar cache busting using random query param 2023-11-02 01:48:34 +01:00
ekzyis
7043b4f1d1 refactor: Unify <ImageUpload> and <Upload> component 2023-11-02 01:48:34 +01:00
ekzyis
1708c77458 Remove unnecessary text field in query 2023-11-02 01:48:34 +01:00
ekzyis
6b840258c0 Fix NULL returned for size24h, sizeNow 2023-11-02 01:48:34 +01:00
ekzyis
30a413e494 Fix multiplication with feesPerImage 2023-11-02 01:48:34 +01:00
ekzyis
d8511ba6d2 Fix bad image fee return statements 2023-11-02 01:48:34 +01:00
ekzyis
7f38d750b9 Fix stale image fees served 2023-11-02 01:48:34 +01:00
ekzyis
cb56ee8b58 Fix free upload quota 2023-11-02 01:48:34 +01:00
ekzyis
4e3e1a4a6a Increase max upload size to 10MB to allow HQ camera pictures 2023-11-02 01:48:34 +01:00
ekzyis
fe503140e9 Remove dragOver style on drop 2023-11-02 01:48:34 +01:00
ekzyis
d6f6cd8b0b Use Drag and Drop API for image upload 2023-11-02 01:48:34 +01:00
ekzyis
e9b3ac43dc Fix image fee display in receipts 2023-11-02 01:48:34 +01:00
ekzyis
fe7d78038b Add schedule to delete unused images 2023-11-02 01:48:34 +01:00
ekzyis
9885f7d768 Support upload of multiple files at once 2023-11-02 01:48:34 +01:00
ekzyis
1b7b869fdb Remove 'Uploading <name>...' from text input on error 2023-11-02 01:48:34 +01:00
ekzyis
af7cbd0846 Remove unnecessary async 2023-11-02 01:48:34 +01:00
ekzyis
8890517f40 Remove 's' from 'image fees' in receipts 2023-11-02 01:48:34 +01:00
ekzyis
008510ee15 Add 0 base fee in edit receipt 2023-11-02 01:48:34 +01:00
ekzyis
1272e15a0e 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.
2023-11-02 01:48:34 +01:00
ekzyis
b3c9e9ebf2 Fix image fees in edit receipt 2023-11-02 01:48:34 +01:00
ekzyis
bcadbb2dcd Fix algebraic order of fees
Spam fees must come immediately after the base fee since it multiplies the base fee.
2023-11-02 01:48:34 +01:00
ekzyis
b71f320b59 Fix fees in sats deducted from msats 2023-11-02 01:48:34 +01:00
ekzyis
28bde328fc Show amount of unpaid images in receipt 2023-11-02 01:48:34 +01:00
ekzyis
a8998df4b0 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.
2023-11-02 01:48:34 +01:00
ekzyis
221dd5bb1d Show image fees in frontend 2023-11-02 01:48:34 +01:00
ekzyis
1af6a5c98d Remove unnecessary avatar check during image fees calculation 2023-11-02 01:48:34 +01:00
ekzyis
e7175fbe87 Use megabytes in error message 2023-11-02 01:48:34 +01:00
ekzyis
78c756a42c Add comments regarding avatar upload 2023-11-02 01:48:34 +01:00
ekzyis
726f10c396 Allow anons to get presigned URLs 2023-11-02 01:48:34 +01:00
ekzyis
ed3a681950 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
2023-11-02 01:48:34 +01:00
ekzyis
900592020f 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.
2023-11-02 01:48:34 +01:00
ekzyis
30aed4e805 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
2023-11-02 01:48:34 +01:00
ekzyis
167a4189ca Add fees for presigned URLs 2023-11-02 01:48:34 +01:00
ekzyis
eb4700070f Overwrite old avatar 2023-11-02 01:48:34 +01:00
ekzyis
ef0506d7c6 Allow items to have multiple uploads linked 2023-11-02 01:48:34 +01:00
ekzyis
51bc4b82d0 Also delete objects in S3 2023-11-02 01:48:34 +01:00
ekzyis
086e1aea3a Mark images as submitted on client after successful mutation 2023-11-02 01:48:34 +01:00
ekzyis
f79792cd4d Add margin-top 2023-11-02 01:48:34 +01:00
ekzyis
db525e9195 Mark S3 images as submitted in imgproxy job 2023-11-02 01:48:34 +01:00