From f82e9aa7bff5aa03f04d57a9315e08a2c5e490dd Mon Sep 17 00:00:00 2001 From: Karol Krawczykiewicz <26karol26@gmail.com> Date: Tue, 2 Jan 2024 21:36:25 +0100 Subject: [PATCH] Run prettier --- .github/workflows/docker.yml | 1 - backend/src/server.ts | 2 +- frontend/src/components/ProfilePageForm.tsx | 3 +- frontend/src/components/RegisterBox.tsx | 13 +++-- frontend/src/models/RegisterUserSchema.ts | 54 ++++++++++----------- 5 files changed, 37 insertions(+), 36 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 07f0d995..b9988fa0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -33,7 +33,6 @@ jobs: - name: Test the backend run: cd backend; npm i && npm run test run - # - name: Format files # run: cd ..; npm i && npm run prettier:fix diff --git a/backend/src/server.ts b/backend/src/server.ts index 81effbcf..da7dc5e8 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -25,7 +25,7 @@ app.use((_req, res, next) => { next(); }); app.use(cookieParser()); -app.use(express.json({ limit: '10mb' })); +app.use(express.json({ limit: "10mb" })); const expressServer = createServer(app); diff --git a/frontend/src/components/ProfilePageForm.tsx b/frontend/src/components/ProfilePageForm.tsx index a2f48875..90491743 100644 --- a/frontend/src/components/ProfilePageForm.tsx +++ b/frontend/src/components/ProfilePageForm.tsx @@ -119,7 +119,7 @@ function ProfilePageForm(props: ProfilePageFormProps) { - + {showDeleteModal && ( - ); diff --git a/frontend/src/components/RegisterBox.tsx b/frontend/src/components/RegisterBox.tsx index 199fe8e8..0ad3749c 100644 --- a/frontend/src/components/RegisterBox.tsx +++ b/frontend/src/components/RegisterBox.tsx @@ -60,7 +60,6 @@ function RegisterBox() { const encodePicture = async (file: File): Promise => { return new Promise((resolve) => { - const reader = new FileReader(); reader.onloadend = () => { const base64 = reader.result as string; @@ -106,7 +105,7 @@ function RegisterBox() { throw new Error("Failed to fetch image"); } } catch (error) { - throw new Error("Error fetching image: "+ error) + throw new Error("Error fetching image: " + error); } }; @@ -187,9 +186,8 @@ function RegisterBox() { onChange={handleFileChange} className="opacity-0 absolute top-0 left-0 w-full h-full cursor-pointer" /> - - + {profilePictureBase64 && ( <> Profile - + )} diff --git a/frontend/src/models/RegisterUserSchema.ts b/frontend/src/models/RegisterUserSchema.ts index 5d7157d1..c6650580 100644 --- a/frontend/src/models/RegisterUserSchema.ts +++ b/frontend/src/models/RegisterUserSchema.ts @@ -1,30 +1,30 @@ -import * as z from "zod" +import * as z from "zod"; import { FrontendUser } from "./User"; export const userSchema: z.ZodType> = z.object({ - first_name: z - .string() - .min(2, "First name should be at least two characters long"), - last_name: z - .string() - .min(2, "Last name should be at least two characters long"), - country: z - .string() - .length(2, "Country code should be 2 characters long") - .toUpperCase(), - // profile_picture: z - // .any() - // .refine((obj) => (!obj ? "Profile picture is required" : "")) - // .refine((obj) => obj && obj.length <= 0, "Profile picture not provided") - // .transform((obj) => { - // if (obj && obj.length > 0 && (obj as FileList)[0].size <= 5 * 1024 * 1024) { - // return (obj as FileList)[0].name; - // } else { - // throw new Error("File is too big (>5 MB)"); - // } - // }), - mail: z.string().email(), - password: z - .string() - .min(8, "Password should be at least eight characters long"), - }); \ No newline at end of file + first_name: z + .string() + .min(2, "First name should be at least two characters long"), + last_name: z + .string() + .min(2, "Last name should be at least two characters long"), + country: z + .string() + .length(2, "Country code should be 2 characters long") + .toUpperCase(), + // profile_picture: z + // .any() + // .refine((obj) => (!obj ? "Profile picture is required" : "")) + // .refine((obj) => obj && obj.length <= 0, "Profile picture not provided") + // .transform((obj) => { + // if (obj && obj.length > 0 && (obj as FileList)[0].size <= 5 * 1024 * 1024) { + // return (obj as FileList)[0].name; + // } else { + // throw new Error("File is too big (>5 MB)"); + // } + // }), + mail: z.string().email(), + password: z + .string() + .min(8, "Password should be at least eight characters long"), +});