upd: profile

Deskripsi
- tampilan edit profile
- integrasi api edit profile
- tampilan edit password
- integrasi api update password

No Issues
This commit is contained in:
2025-11-13 16:34:01 +08:00
parent 6e1d3ecb56
commit cc293d3bad
3 changed files with 247 additions and 35 deletions

View File

@@ -47,5 +47,59 @@ const UserRoute = new Elysia({
description: "upsert user",
}
})
.post("/update-password", async ({ body }) => {
const { password, id } = body
const update = await prisma.user.update({
where: {
id
},
data: {
password
}
})
return {
success: true,
message: "Password updated successfully",
}
}, {
body: t.Object({
password: t.String({ minLength: 1, error: "password is required" }),
id: t.String({ minLength: 1, error: "id is required" })
}),
detail: {
summary: "update password",
description: "update password user",
}
})
.post("/update", async ({ body }) => {
const { name, phone, id, roleId } = body
const update = await prisma.user.update({
where: {
id
},
data: {
name,
phone,
roleId
}
})
return {
success: true,
message: "User updated successfully",
}
}, {
body: t.Object({
name: t.String({ minLength: 1, error: "name is required" }),
phone: t.String({ minLength: 1, error: "phone is required" }),
id: t.String({ minLength: 1, error: "id is required" }),
roleId: t.String({ minLength: 1, error: "roleId is required" })
}),
detail: {
summary: "update",
description: "update user",
}
})
export default UserRoute