Skip to content

Commit

Permalink
fix: userController
Browse files Browse the repository at this point in the history
  • Loading branch information
Celesca committed Nov 7, 2024
1 parent 3f86ba0 commit 898b2b6
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/controllers/userController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const userController = new Elysia({ prefix: "/user" })
.put(
"/:userID",
async ({ params: { userID }, body, error }) => {
const { userName } = body;
const { userName, email, password, workingStyle, profileImage, bio } = body;

// Check if the user exists
const user = await prisma.user.findUnique({
Expand All @@ -99,6 +99,11 @@ export const userController = new Elysia({ prefix: "/user" })
where: { UserID: userID },
data: {
UserName: userName,
Email: email,
Password: password,
WorkingStyle: workingStyle,
ProfileImage: profileImage,
Bio: bio,
},
});

Expand All @@ -109,9 +114,14 @@ export const userController = new Elysia({ prefix: "/user" })
userID: t.String(),
}),
body: t.Object({
userName: t.String(),
}),
}
userName: t.Optional(t.String()),
email: t.Optional(t.String()),
password: t.Optional(t.String()),
workingStyle: t.Optional(t.String()),
profileImage: t.Optional(t.String()),
bio: t.Optional(t.String()),
}),
}
)

// Delete user profile
Expand Down

0 comments on commit 898b2b6

Please sign in to comment.