This commit is contained in:
wayanrivan
2026-05-28 16:58:46 +07:00
parent 0da7950c01
commit 9443e8fb82

View File

@ -884,7 +884,7 @@ export class UserController {
password: { type: "string", description: "Password" },
name: { type: "string", description: "name" },
status: { type: "string", description: "Status" },
profile_picture: { type: "string", format: "binary", description: "Image file (max 1MB, jpg/png/webp)" }
profile_picture: { type: "string", description: "String" }
}
}
}
@ -913,15 +913,15 @@ export class UserController {
const data = await userRepository.findOneBy({ id: param.id });
if (data != null) {
const doctorprofile = await UserController.uploadFile(req.files, "");
if (doctorprofile) {
if (data.profile_picture) {
const oldFilePath = path.join(STORAGE_DIR, data.profile_picture);
await UserController.deleteFile(oldFilePath);
}
data.profile_picture = doctorprofile;
}
// const doctorprofile = await UserController.uploadFile(req.files, "");
// if (doctorprofile) {
// if (data.profile_picture) {
// const oldFilePath = path.join(STORAGE_DIR, data.profile_picture);
// await UserController.deleteFile(oldFilePath);
// }
// }
data.profile_picture = param.profile_picture || data.profile_picture;
data.name = param.name;
data.username = param.username;
data.email = param.email;