From f311a206c91a9aaef79a1a2856775ce32c0696b0 Mon Sep 17 00:00:00 2001 From: Shun Usami Date: Fri, 3 Nov 2023 16:08:14 +0900 Subject: [PATCH 1/9] [backend] Add password field to user model --- .../migrations/20231103070602_user_password/migration.sql | 8 ++++++++ backend/prisma/schema.prisma | 1 + backend/src/user/user.controller.ts | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 backend/prisma/migrations/20231103070602_user_password/migration.sql diff --git a/backend/prisma/migrations/20231103070602_user_password/migration.sql b/backend/prisma/migrations/20231103070602_user_password/migration.sql new file mode 100644 index 00000000..05edc77c --- /dev/null +++ b/backend/prisma/migrations/20231103070602_user_password/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - Added the required column `password` to the `User` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "User" ADD COLUMN "password" TEXT NOT NULL; diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index e11e5421..2016f4c3 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -14,4 +14,5 @@ model User { id Int @id @default(autoincrement()) email String @unique name String? + password String } diff --git a/backend/src/user/user.controller.ts b/backend/src/user/user.controller.ts index f6735043..25ff847e 100644 --- a/backend/src/user/user.controller.ts +++ b/backend/src/user/user.controller.ts @@ -17,7 +17,7 @@ export class UserController { @Post() create( - @Body() userData: { name?: string; email: string }, + @Body() userData: { name?: string; email: string; password: string }, ): Promise { return this.userService.create(userData); } @@ -35,7 +35,7 @@ export class UserController { @Patch(':id') update( @Param('id') id: string, - @Body() userData: { name?: string; email?: string }, + @Body() userData: { name?: string; email?: string; password?: string }, ) { return this.userService.update(+id, userData); } From 97db4df93a0a7850ee395b42dffacd9b14e78db7 Mon Sep 17 00:00:00 2001 From: Shun Usami Date: Fri, 3 Nov 2023 16:24:34 +0900 Subject: [PATCH 2/9] [frontend] Add password input to user create form --- Makefile | 2 +- frontend/app/user/signup/page.tsx | 59 ++-------------------- frontend/components.json | 2 +- frontend/components/user-create-form.tsx | 63 ++++++++++++++++++++++++ frontend/next.config.js | 4 +- frontend/postcss.config.js | 2 +- frontend/tailwind.config.ts | 12 ++--- 7 files changed, 77 insertions(+), 67 deletions(-) create mode 100644 frontend/components/user-create-form.tsx diff --git a/Makefile b/Makefile index 9df7aeb4..6a55e56e 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ prod: .PHONY: fmt fmt: - npx prettier --write frontend/src backend/src + npx prettier --write frontend backend/src .PHONY: update update: diff --git a/frontend/app/user/signup/page.tsx b/frontend/app/user/signup/page.tsx index ac1d5b7c..1ac06a17 100644 --- a/frontend/app/user/signup/page.tsx +++ b/frontend/app/user/signup/page.tsx @@ -1,7 +1,3 @@ -"use client"; - -import { useRouter } from "next/navigation"; - // components import { Card, @@ -11,63 +7,14 @@ import { CardHeader, CardTitle, } from "@/components/ui/card"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { Button } from "@/components/ui/button"; -import { useToast } from "@/components/ui/use-toast"; +import Form from "@/components/user-create-form"; export default function SignUp() { - const router = useRouter(); - const { toast } = useToast(); - async function createUser(event: React.FormEvent) { - event.preventDefault(); - const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify( - Object.fromEntries(new FormData(event.currentTarget)), - ), - }); - const data = await res.json(); - if (!res.ok) { - toast({ - title: res.status + " " + res.statusText, - description: data.message, - }); - } else { - toast({ - title: "Success", - description: "User created successfully.", - }); - router.push("/user"); - router.refresh(); - } - } - return ( - Create Account + Create Account -
-
-
- - -
-
- - -
- -
-
+
); diff --git a/frontend/components.json b/frontend/components.json index 379cd70f..f335e28b 100644 --- a/frontend/components.json +++ b/frontend/components.json @@ -13,4 +13,4 @@ "components": "@/components", "utils": "@/lib/utils" } -} \ No newline at end of file +} diff --git a/frontend/components/user-create-form.tsx b/frontend/components/user-create-form.tsx new file mode 100644 index 00000000..54153b2f --- /dev/null +++ b/frontend/components/user-create-form.tsx @@ -0,0 +1,63 @@ +"use client"; + +import { useRouter } from "next/navigation"; + +// components +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Button } from "@/components/ui/button"; +import { useToast } from "@/components/ui/use-toast"; + +function CreateUser(toast: any, router: any) { + return async (event: React.FormEvent) => { + event.preventDefault(); + const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify( + Object.fromEntries(new FormData(event.currentTarget)), + ), + }); + const data = await res.json(); + if (!res.ok) { + toast({ + title: res.status + " " + res.statusText, + description: data.message, + }); + } else { + toast({ + title: "Success", + description: "User created successfully.", + }); + router.push("/user"); + router.refresh(); + } + }; +} + +export default function UserCreateForm() { + const router = useRouter(); + const { toast } = useToast(); + const createUser = CreateUser(toast, router); + return ( + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + ); +} diff --git a/frontend/next.config.js b/frontend/next.config.js index 767719fc..658404ac 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -1,4 +1,4 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {} +const nextConfig = {}; -module.exports = nextConfig +module.exports = nextConfig; diff --git a/frontend/postcss.config.js b/frontend/postcss.config.js index 33ad091d..12a703d9 100644 --- a/frontend/postcss.config.js +++ b/frontend/postcss.config.js @@ -3,4 +3,4 @@ module.exports = { tailwindcss: {}, autoprefixer: {}, }, -} +}; diff --git a/frontend/tailwind.config.ts b/frontend/tailwind.config.ts index 0377ea1d..c05b2ff6 100644 --- a/frontend/tailwind.config.ts +++ b/frontend/tailwind.config.ts @@ -2,11 +2,11 @@ module.exports = { darkMode: ["class"], content: [ - './pages/**/*.{ts,tsx}', - './components/**/*.{ts,tsx}', - './app/**/*.{ts,tsx}', - './src/**/*.{ts,tsx}', - ], + "./pages/**/*.{ts,tsx}", + "./components/**/*.{ts,tsx}", + "./app/**/*.{ts,tsx}", + "./src/**/*.{ts,tsx}", + ], theme: { container: { center: true, @@ -73,4 +73,4 @@ module.exports = { }, }, plugins: [require("tailwindcss-animate")], -} \ No newline at end of file +}; From 8d1c2540648aa1632a79ff5beb68aa1f8a31705c Mon Sep 17 00:00:00 2001 From: Shun Usami Date: Fri, 3 Nov 2023 21:49:38 +0900 Subject: [PATCH 3/9] Add app/ui folder for UI components --- frontend/app/layout.tsx | 4 +- frontend/{components => app/ui}/Nav.tsx | 2 +- frontend/app/ui/user/card.tsx | 120 +++++++++++++++++++++++ frontend/app/ui/user/create-form.tsx | 30 ++++++ frontend/app/user/[id]/page.tsx | 2 +- frontend/app/user/signup/page.tsx | 2 +- frontend/components/user-create-form.tsx | 63 ------------ frontend/lib/client-actions.ts | 33 +++++++ 8 files changed, 189 insertions(+), 67 deletions(-) rename frontend/{components => app/ui}/Nav.tsx (94%) create mode 100644 frontend/app/ui/user/card.tsx create mode 100644 frontend/app/ui/user/create-form.tsx delete mode 100644 frontend/components/user-create-form.tsx create mode 100644 frontend/lib/client-actions.ts diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index 73213b73..65fddbb0 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -4,9 +4,11 @@ import "./globals.css"; // components import { ThemeProvider } from "@/components/theme-provider"; -import Nav from "@/components/Nav"; import { Toaster } from "@/components/ui/toaster"; +// ui +import Nav from "@/app/ui/Nav"; + const inter = Inter({ subsets: ["latin"] }); export const metadata: Metadata = { diff --git a/frontend/components/Nav.tsx b/frontend/app/ui/Nav.tsx similarity index 94% rename from frontend/components/Nav.tsx rename to frontend/app/ui/Nav.tsx index 9352149e..b06ba2ce 100644 --- a/frontend/components/Nav.tsx +++ b/frontend/app/ui/Nav.tsx @@ -1,5 +1,5 @@ import Image from "next/image"; -import { ModeToggle } from "./toggle-mode"; +import { ModeToggle } from "@/components/toggle-mode"; import Link from "next/link"; export default function Nav() { diff --git a/frontend/app/ui/user/card.tsx b/frontend/app/ui/user/card.tsx new file mode 100644 index 00000000..49bc8115 --- /dev/null +++ b/frontend/app/ui/user/card.tsx @@ -0,0 +1,120 @@ +"use client"; + +import { useRouter } from "next/navigation"; + +// components +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "@/components/ui/card"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Button } from "@/components/ui/button"; +import { useToast } from "@/components/ui/use-toast"; + +export type User = { id: number; name?: string; email?: string }; + +export default function UserCard({ user }: { user: User }) { + const router = useRouter(); + const { toast } = useToast(); + async function updateUser(event: React.FormEvent) { + event.preventDefault(); + const { id, ...updateData } = Object.fromEntries( + new FormData(event.currentTarget), + ); + const res = await fetch( + `${process.env.NEXT_PUBLIC_API_URL}/user/${user.id}`, + { + method: "PATCH", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(updateData), + }, + ); + const data = await res.json(); + if (!res.ok) { + toast({ + title: res.status + " " + res.statusText, + description: data.message, + }); + } else { + toast({ + title: "Success", + description: "User updated successfully.", + }); + router.push("/user"); + router.refresh(); + } + } + async function deleteUser(event: React.SyntheticEvent) { + event.preventDefault(); + const res = await fetch( + `${process.env.NEXT_PUBLIC_API_URL}/user/${user.id}`, + { + method: "DELETE", + }, + ); + const data = await res.json(); + if (!res.ok) { + toast({ + title: res.status + " " + res.statusText, + description: data.message, + }); + } else { + toast({ + title: "Success", + description: "User deleted successfully.", + }); + router.push("/user"); + router.refresh(); + } + } + return ( + <> + + ID: {user.id} + +
+
+
+ + +
+
+ + +
+
+
+
+ + + + +
+ + ); +} diff --git a/frontend/app/ui/user/create-form.tsx b/frontend/app/ui/user/create-form.tsx new file mode 100644 index 00000000..7e9185c9 --- /dev/null +++ b/frontend/app/ui/user/create-form.tsx @@ -0,0 +1,30 @@ +"use client"; + +import { createUser } from '@/lib/client-actions'; + +// components +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Button } from "@/components/ui/button"; + +export default function UserCreateForm() { + return ( +
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ ); +} diff --git a/frontend/app/user/[id]/page.tsx b/frontend/app/user/[id]/page.tsx index 55e400d2..baf149de 100644 --- a/frontend/app/user/[id]/page.tsx +++ b/frontend/app/user/[id]/page.tsx @@ -1,4 +1,4 @@ -import UserCard from "@/components/UserCard"; +import UserCard from "@/app/ui/user/card"; async function getUser(id: number) { const res = await fetch(`${process.env.API_URL}/user/${id}`, { diff --git a/frontend/app/user/signup/page.tsx b/frontend/app/user/signup/page.tsx index 1ac06a17..0e1829f5 100644 --- a/frontend/app/user/signup/page.tsx +++ b/frontend/app/user/signup/page.tsx @@ -7,7 +7,7 @@ import { CardHeader, CardTitle, } from "@/components/ui/card"; -import Form from "@/components/user-create-form"; +import Form from "@/app/ui/user/create-form"; export default function SignUp() { return ( diff --git a/frontend/components/user-create-form.tsx b/frontend/components/user-create-form.tsx deleted file mode 100644 index 54153b2f..00000000 --- a/frontend/components/user-create-form.tsx +++ /dev/null @@ -1,63 +0,0 @@ -"use client"; - -import { useRouter } from "next/navigation"; - -// components -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { Button } from "@/components/ui/button"; -import { useToast } from "@/components/ui/use-toast"; - -function CreateUser(toast: any, router: any) { - return async (event: React.FormEvent) => { - event.preventDefault(); - const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify( - Object.fromEntries(new FormData(event.currentTarget)), - ), - }); - const data = await res.json(); - if (!res.ok) { - toast({ - title: res.status + " " + res.statusText, - description: data.message, - }); - } else { - toast({ - title: "Success", - description: "User created successfully.", - }); - router.push("/user"); - router.refresh(); - } - }; -} - -export default function UserCreateForm() { - const router = useRouter(); - const { toast } = useToast(); - const createUser = CreateUser(toast, router); - return ( -
-
-
- - -
-
- - -
-
- - -
- -
-
- ); -} diff --git a/frontend/lib/client-actions.ts b/frontend/lib/client-actions.ts new file mode 100644 index 00000000..87a45835 --- /dev/null +++ b/frontend/lib/client-actions.ts @@ -0,0 +1,33 @@ +'use client'; + +import { redirect } from "next/navigation"; +import { toast } from "@/components/ui/use-toast"; + +export async function createUser(formData: FormData) { + const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify( + { + name: formData.get("name"), + email: formData.get("email"), + password: formData.get("password"), + } + ), + }); + const data = await res.json(); + if (!res.ok) { + toast({ + title: res.status + " " + res.statusText, + description: data.message, + }); + } else { + toast({ + title: "Success", + description: "User created successfully.", + }); + redirect("/user", 'push'); + } +} From e7e1214b98d35915101e5f3c5c2bd1ea7b4d1336 Mon Sep 17 00:00:00 2001 From: Shun Usami Date: Fri, 3 Nov 2023 21:51:01 +0900 Subject: [PATCH 4/9] [frontend] Format code with prettier --- frontend/app/ui/user/create-form.tsx | 16 +++++++-- frontend/app/user/signup/page.tsx | 4 ++- frontend/lib/client-actions.ts | 50 +++++++++++++--------------- 3 files changed, 40 insertions(+), 30 deletions(-) diff --git a/frontend/app/ui/user/create-form.tsx b/frontend/app/ui/user/create-form.tsx index 7e9185c9..ec0ccacc 100644 --- a/frontend/app/ui/user/create-form.tsx +++ b/frontend/app/ui/user/create-form.tsx @@ -1,6 +1,6 @@ "use client"; -import { createUser } from '@/lib/client-actions'; +import { createUser } from "@/lib/client-actions"; // components import { Input } from "@/components/ui/input"; @@ -17,11 +17,21 @@ export default function UserCreateForm() {
- +
- +
diff --git a/frontend/app/user/signup/page.tsx b/frontend/app/user/signup/page.tsx index 0e1829f5..847aa7de 100644 --- a/frontend/app/user/signup/page.tsx +++ b/frontend/app/user/signup/page.tsx @@ -12,7 +12,9 @@ import Form from "@/app/ui/user/create-form"; export default function SignUp() { return ( - Create Account + + Create Account +
diff --git a/frontend/lib/client-actions.ts b/frontend/lib/client-actions.ts index 87a45835..b2340067 100644 --- a/frontend/lib/client-actions.ts +++ b/frontend/lib/client-actions.ts @@ -1,33 +1,31 @@ -'use client'; +"use client"; import { redirect } from "next/navigation"; import { toast } from "@/components/ui/use-toast"; export async function createUser(formData: FormData) { - const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify( - { - name: formData.get("name"), - email: formData.get("email"), - password: formData.get("password"), - } - ), + const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + name: formData.get("name"), + email: formData.get("email"), + password: formData.get("password"), + }), + }); + const data = await res.json(); + if (!res.ok) { + toast({ + title: res.status + " " + res.statusText, + description: data.message, }); - const data = await res.json(); - if (!res.ok) { - toast({ - title: res.status + " " + res.statusText, - description: data.message, - }); - } else { - toast({ - title: "Success", - description: "User created successfully.", - }); - redirect("/user", 'push'); - } + } else { + toast({ + title: "Success", + description: "User created successfully.", + }); + redirect("/user", "push"); + } } From 83149ebb3356ab66ffe8577425b9c121af367b01 Mon Sep 17 00:00:00 2001 From: Shun Usami Date: Fri, 3 Nov 2023 22:04:16 +0900 Subject: [PATCH 5/9] Fix redirect() argument's type error - Move client-actions.ts to app/lib/client-actions.ts --- frontend/app/layout.tsx | 2 +- frontend/{ => app}/lib/client-actions.ts | 4 ++-- frontend/app/ui/user/create-form.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename frontend/{ => app}/lib/client-actions.ts (87%) diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index 65fddbb0..30336c50 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -7,7 +7,7 @@ import { ThemeProvider } from "@/components/theme-provider"; import { Toaster } from "@/components/ui/toaster"; // ui -import Nav from "@/app/ui/Nav"; +import Nav from "@/app/ui/nav"; const inter = Inter({ subsets: ["latin"] }); diff --git a/frontend/lib/client-actions.ts b/frontend/app/lib/client-actions.ts similarity index 87% rename from frontend/lib/client-actions.ts rename to frontend/app/lib/client-actions.ts index b2340067..1b201152 100644 --- a/frontend/lib/client-actions.ts +++ b/frontend/app/lib/client-actions.ts @@ -1,6 +1,6 @@ "use client"; -import { redirect } from "next/navigation"; +import { RedirectType, redirect } from "next/navigation"; import { toast } from "@/components/ui/use-toast"; export async function createUser(formData: FormData) { @@ -26,6 +26,6 @@ export async function createUser(formData: FormData) { title: "Success", description: "User created successfully.", }); - redirect("/user", "push"); + redirect("/user", RedirectType.push); } } diff --git a/frontend/app/ui/user/create-form.tsx b/frontend/app/ui/user/create-form.tsx index ec0ccacc..6d3b46ba 100644 --- a/frontend/app/ui/user/create-form.tsx +++ b/frontend/app/ui/user/create-form.tsx @@ -1,6 +1,6 @@ "use client"; -import { createUser } from "@/lib/client-actions"; +import { createUser } from "@/app/lib/client-actions"; // components import { Input } from "@/components/ui/input"; From 3a9c0900dd317a9eda75e2ed7af05898d62d2392 Mon Sep 17 00:00:00 2001 From: Shun Usami Date: Fri, 3 Nov 2023 22:17:03 +0900 Subject: [PATCH 6/9] [frontend] Add nav component --- frontend/app/ui/nav.tsx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 frontend/app/ui/nav.tsx diff --git a/frontend/app/ui/nav.tsx b/frontend/app/ui/nav.tsx new file mode 100644 index 00000000..b06ba2ce --- /dev/null +++ b/frontend/app/ui/nav.tsx @@ -0,0 +1,35 @@ +import Image from "next/image"; +import { ModeToggle } from "@/components/toggle-mode"; +import Link from "next/link"; + +export default function Nav() { + return ( +
+ +
+ ); +} From da45722c0821b456d2375d1bc7fc49fb84b71ef2 Mon Sep 17 00:00:00 2001 From: Shun Usami Date: Fri, 3 Nov 2023 22:20:48 +0900 Subject: [PATCH 7/9] [frontend] fix: use redirect instead of router.push --- frontend/app/ui/user/card.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/frontend/app/ui/user/card.tsx b/frontend/app/ui/user/card.tsx index 49bc8115..f3c56f1f 100644 --- a/frontend/app/ui/user/card.tsx +++ b/frontend/app/ui/user/card.tsx @@ -1,6 +1,6 @@ "use client"; -import { useRouter } from "next/navigation"; +import { redirect, RedirectType } from "next/navigation"; // components import { @@ -14,13 +14,11 @@ import { import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Button } from "@/components/ui/button"; -import { useToast } from "@/components/ui/use-toast"; +import { toast } from "@/components/ui/use-toast"; export type User = { id: number; name?: string; email?: string }; export default function UserCard({ user }: { user: User }) { - const router = useRouter(); - const { toast } = useToast(); async function updateUser(event: React.FormEvent) { event.preventDefault(); const { id, ...updateData } = Object.fromEntries( @@ -47,8 +45,7 @@ export default function UserCard({ user }: { user: User }) { title: "Success", description: "User updated successfully.", }); - router.push("/user"); - router.refresh(); + redirect("/user", RedirectType.push); } } async function deleteUser(event: React.SyntheticEvent) { @@ -70,8 +67,7 @@ export default function UserCard({ user }: { user: User }) { title: "Success", description: "User deleted successfully.", }); - router.push("/user"); - router.refresh(); + redirect("/user", RedirectType.push); } } return ( From efbac514f1ea27959503ecd241941ad1c498ba85 Mon Sep 17 00:00:00 2001 From: Shun Usami Date: Fri, 3 Nov 2023 22:22:49 +0900 Subject: [PATCH 8/9] [frontend] Remove Nav.tsx and fix Link --- frontend/app/ui/Nav.tsx | 35 ----------------------------------- frontend/app/ui/nav.tsx | 4 +--- 2 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 frontend/app/ui/Nav.tsx diff --git a/frontend/app/ui/Nav.tsx b/frontend/app/ui/Nav.tsx deleted file mode 100644 index b06ba2ce..00000000 --- a/frontend/app/ui/Nav.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import Image from "next/image"; -import { ModeToggle } from "@/components/toggle-mode"; -import Link from "next/link"; - -export default function Nav() { - return ( -
- -
- ); -} diff --git a/frontend/app/ui/nav.tsx b/frontend/app/ui/nav.tsx index b06ba2ce..d6e3b041 100644 --- a/frontend/app/ui/nav.tsx +++ b/frontend/app/ui/nav.tsx @@ -18,9 +18,7 @@ export default function Nav() { />
  • - - Home - + Home User List Sign Up From e41d9d6553ae6f3bc745385b365eca3d55c94608 Mon Sep 17 00:00:00 2001 From: Shun Usami Date: Fri, 3 Nov 2023 22:25:31 +0900 Subject: [PATCH 9/9] [format] Format code with prettier --- Makefile | 2 +- backend/.prettierrc | 2 +- backend/test/jest-e2e.json | 2 +- frontend/app/ui/user/card.tsx | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6a55e56e..a248fb30 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ prod: .PHONY: fmt fmt: - npx prettier --write frontend backend/src + npx prettier --write frontend backend .PHONY: update update: diff --git a/backend/.prettierrc b/backend/.prettierrc index dcb72794..a20502b7 100644 --- a/backend/.prettierrc +++ b/backend/.prettierrc @@ -1,4 +1,4 @@ { "singleQuote": true, "trailingComma": "all" -} \ No newline at end of file +} diff --git a/backend/test/jest-e2e.json b/backend/test/jest-e2e.json index 049364a1..8607b62d 100644 --- a/backend/test/jest-e2e.json +++ b/backend/test/jest-e2e.json @@ -1,6 +1,6 @@ { "moduleNameMapper": { - "^src/(.*)$": "/../src/$1" + "^src/(.*)$": "/../src/$1" }, "moduleFileExtensions": ["js", "json", "ts"], "rootDir": ".", diff --git a/frontend/app/ui/user/card.tsx b/frontend/app/ui/user/card.tsx index f3c56f1f..0776dc02 100644 --- a/frontend/app/ui/user/card.tsx +++ b/frontend/app/ui/user/card.tsx @@ -45,7 +45,7 @@ export default function UserCard({ user }: { user: User }) { title: "Success", description: "User updated successfully.", }); - redirect("/user", RedirectType.push); + redirect("/user", RedirectType.push); } } async function deleteUser(event: React.SyntheticEvent) { @@ -67,7 +67,7 @@ export default function UserCard({ user }: { user: User }) { title: "Success", description: "User deleted successfully.", }); - redirect("/user", RedirectType.push); + redirect("/user", RedirectType.push); } } return (