mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-11-25 22:08:56 +01:00
22 lines
588 B
Diff
22 lines
588 B
Diff
--- template/app/src/file-upload/operations.ts
|
|
+++ opensaas-sh/app/src/file-upload/operations.ts
|
|
@@ -21,6 +21,18 @@
|
|
throw new HttpError(401);
|
|
}
|
|
|
|
+ const numberOfFilesByUser = await context.entities.File.count({
|
|
+ where: {
|
|
+ user: {
|
|
+ id: context.user.id,
|
|
+ },
|
|
+ },
|
|
+ });
|
|
+
|
|
+ if (numberOfFilesByUser >= 2) {
|
|
+ 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 });
|