Skip to content

Commit

Permalink
fix: put path
Browse files Browse the repository at this point in the history
  • Loading branch information
Celesca committed Nov 25, 2024
1 parent 4d749ca commit 3b69696
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/controllers/userController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ export const userController = new Elysia({ prefix: "/user" })
return user;
})




// Get user details by userID
.get(
"/:userID",
Expand Down Expand Up @@ -147,7 +144,7 @@ export const userController = new Elysia({ prefix: "/user" })
.put(
"/:userID",
async ({ params: { userID }, body, error }) => {
const { userName, email, workingStyle, profileImage, bio } = body;
const { userName, email, workingStyle, profileImage, bio, age, location } = body;

// Check if the user exists
const user = await prisma.user.findUnique({
Expand All @@ -167,6 +164,8 @@ export const userController = new Elysia({ prefix: "/user" })
WorkingStyle: workingStyle || user.WorkingStyle,
ProfileImage: profileImage || user.ProfileImage,
Bio: bio || user.Bio,
Age: age || user.Age,
Location: location || user.Location,
},
});

Expand All @@ -182,6 +181,8 @@ export const userController = new Elysia({ prefix: "/user" })
workingStyle: t.Optional(t.String()),
profileImage: t.Optional(t.String()),
bio: t.Optional(t.String()),
age: t.Optional(t.Number()),
location: t.Optional(t.String()),
}),
}
)
Expand Down

0 comments on commit 3b69696

Please sign in to comment.