mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-07-22 02:52:20 +02:00
Diffs. Cleanup.
This commit is contained in:
@ -1,8 +1,8 @@
|
|||||||
--- template/app/src/file-upload/operations.ts
|
--- template/app/src/file-upload/operations.ts
|
||||||
+++ opensaas-sh/app/src/file-upload/operations.ts
|
+++ opensaas-sh/app/src/file-upload/operations.ts
|
||||||
@@ -18,6 +18,18 @@
|
@@ -25,6 +25,18 @@
|
||||||
throw new HttpError(401);
|
|
||||||
}
|
const args = ensureArgsSchemaOrThrowHttpError(createFileInputSchema, rawArgs);
|
||||||
|
|
||||||
+ const numberOfFilesByUser = await context.entities.File.count({
|
+ const numberOfFilesByUser = await context.entities.File.count({
|
||||||
+ where: {
|
+ where: {
|
||||||
@ -16,6 +16,6 @@
|
|||||||
+ throw new HttpError(403, 'Thanks for trying Open SaaS. This demo only allows 2 file uploads per user.');
|
+ 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: args.fileType,
|
||||||
const { uploadUrl, key } = await getUploadFileSignedURLFromS3({ fileType, userInfo });
|
fileName: args.fileName,
|
||||||
|
@ -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;
|
|
@ -1,8 +1,8 @@
|
|||||||
--- template/app/src/user/operations.ts
|
--- template/app/src/user/operations.ts
|
||||||
+++ opensaas-sh/app/src/user/operations.ts
|
+++ opensaas-sh/app/src/user/operations.ts
|
||||||
@@ -38,7 +38,10 @@
|
@@ -41,7 +41,10 @@
|
||||||
subscriptionStatus?: SubscriptionStatus[];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type GetPaginatedUsersOutput = {
|
type GetPaginatedUsersOutput = {
|
||||||
- users: Pick<User, 'id' | 'email' | 'username' | 'subscriptionStatus' | 'paymentProcessorUserId'>[];
|
- users: Pick<User, 'id' | 'email' | 'username' | 'subscriptionStatus' | 'paymentProcessorUserId'>[];
|
||||||
+ users: Pick<
|
+ users: Pick<
|
||||||
@ -12,20 +12,7 @@
|
|||||||
totalPages: number;
|
totalPages: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -51,8 +54,10 @@
|
@@ -82,6 +85,7 @@
|
||||||
}
|
|
||||||
|
|
||||||
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 @@
|
|
||||||
mode: 'insensitive',
|
mode: 'insensitive',
|
||||||
},
|
},
|
||||||
isAdmin: args.isAdmin,
|
isAdmin: args.isAdmin,
|
||||||
@ -33,7 +20,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
OR: [
|
OR: [
|
||||||
@@ -88,7 +94,7 @@
|
@@ -105,7 +109,7 @@
|
||||||
username: true,
|
username: true,
|
||||||
isAdmin: true,
|
isAdmin: true,
|
||||||
subscriptionStatus: true,
|
subscriptionStatus: true,
|
||||||
@ -42,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
orderBy: {
|
orderBy: {
|
||||||
id: 'desc',
|
id: 'desc',
|
||||||
@@ -104,6 +110,7 @@
|
@@ -121,6 +125,7 @@
|
||||||
mode: 'insensitive',
|
mode: 'insensitive',
|
||||||
},
|
},
|
||||||
isAdmin: args.isAdmin,
|
isAdmin: args.isAdmin,
|
||||||
|
@ -3,6 +3,8 @@ import { createFile } from 'wasp/client/operations';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ALLOWED_FILE_TYPES, MAX_FILE_SIZE } from './validation';
|
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 {
|
interface FileUploadProgress {
|
||||||
file: FileWithValidType;
|
file: FileWithValidType;
|
||||||
setUploadProgressPercent: Dispatch<SetStateAction<number>>;
|
setUploadProgressPercent: Dispatch<SetStateAction<number>>;
|
||||||
@ -28,9 +30,6 @@ export interface FileUploadError {
|
|||||||
code: 'NO_FILE' | 'INVALID_FILE_TYPE' | 'FILE_TOO_LARGE' | 'UPLOAD_FAILED';
|
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 =
|
type FileParseResult =
|
||||||
| { kind: 'success'; file: FileWithValidType }
|
| { kind: 'success'; file: FileWithValidType }
|
||||||
| {
|
| {
|
||||||
|
Reference in New Issue
Block a user