Diffs. Cleanup.

This commit is contained in:
Mihovil Ilakovac 2025-02-20 22:38:54 +01:00
parent ae3782bd15
commit 077bede063
4 changed files with 13 additions and 38 deletions

View File

@ -1,8 +1,8 @@
--- template/app/src/file-upload/operations.ts
+++ opensaas-sh/app/src/file-upload/operations.ts
@@ -18,6 +18,18 @@
throw new HttpError(401);
}
@@ -25,6 +25,18 @@
const args = ensureArgsSchemaOrThrowHttpError(createFileInputSchema, rawArgs);
+ const numberOfFilesByUser = await context.entities.File.count({
+ where: {
@ -16,6 +16,6 @@
+ throw new HttpError(403, 'Thanks for trying Open SaaS. This demo only allows 2 file uploads per user.');
+ }
+
const userInfo = context.user.id;
const { uploadUrl, key } = await getUploadFileSignedURLFromS3({ fileType, userInfo });
const { uploadUrl, key } = await getUploadFileSignedURLFromS3({
fileType: args.fileType,
fileName: args.fileName,

View File

@ -1,11 +0,0 @@
--- template/app/src/payment/plans.ts
+++ opensaas-sh/app/src/payment/plans.ts
@@ -9,7 +9,7 @@
}
export interface PaymentPlan {
- // Returns the id under which this payment plan is identified on your payment processor.
+ // Returns the id under which this payment plan is identified on your payment processor.
// E.g. this might be price id on Stripe, or variant id on LemonSqueezy.
getPaymentProcessorPlanId: () => string;
effect: PaymentPlanEffect;

View File

@ -1,8 +1,8 @@
--- template/app/src/user/operations.ts
+++ opensaas-sh/app/src/user/operations.ts
@@ -38,7 +38,10 @@
subscriptionStatus?: SubscriptionStatus[];
@@ -41,7 +41,10 @@
};
type GetPaginatedUsersOutput = {
- users: Pick<User, 'id' | 'email' | 'username' | 'subscriptionStatus' | 'paymentProcessorUserId'>[];
+ users: Pick<
@ -12,20 +12,7 @@
totalPages: number;
};
@@ -51,8 +54,10 @@
}
const allSubscriptionStatusOptions = args.subscriptionStatus as Array<string | null> | undefined;
- const hasNotSubscribed = allSubscriptionStatusOptions?.find((status) => status === null)
- let subscriptionStatusStrings = allSubscriptionStatusOptions?.filter((status) => status !== null) as string[] | undefined
+ const hasNotSubscribed = allSubscriptionStatusOptions?.find((status) => status === null);
+ let subscriptionStatusStrings = allSubscriptionStatusOptions?.filter((status) => status !== null) as
+ | string[]
+ | undefined;
const queryResults = await context.entities.User.findMany({
skip: args.skip,
@@ -65,6 +70,7 @@
@@ -82,6 +85,7 @@
mode: 'insensitive',
},
isAdmin: args.isAdmin,
@ -33,7 +20,7 @@
},
{
OR: [
@@ -88,7 +94,7 @@
@@ -105,7 +109,7 @@
username: true,
isAdmin: true,
subscriptionStatus: true,
@ -42,7 +29,7 @@
},
orderBy: {
id: 'desc',
@@ -104,6 +110,7 @@
@@ -121,6 +125,7 @@
mode: 'insensitive',
},
isAdmin: args.isAdmin,

View File

@ -3,6 +3,8 @@ import { createFile } from 'wasp/client/operations';
import axios from 'axios';
import { ALLOWED_FILE_TYPES, MAX_FILE_SIZE } from './validation';
type AllowedFileType = (typeof ALLOWED_FILE_TYPES)[number];
type FileWithValidType = Omit<File, 'type'> & { type: AllowedFileType };
interface FileUploadProgress {
file: FileWithValidType;
setUploadProgressPercent: Dispatch<SetStateAction<number>>;
@ -28,9 +30,6 @@ export interface FileUploadError {
code: 'NO_FILE' | 'INVALID_FILE_TYPE' | 'FILE_TOO_LARGE' | 'UPLOAD_FAILED';
}
type AllowedFileType = (typeof ALLOWED_FILE_TYPES)[number];
type FileWithValidType = Omit<File, 'type'> & { type: AllowedFileType };
type FileParseResult =
| { kind: 'success'; file: FileWithValidType }
| {