update_table_ProfileAvatar_add_isactive

This commit is contained in:
Kittapath 2024-05-16 10:01:59 +07:00
parent 9d240969a3
commit 73c91bd9b1
3 changed files with 30 additions and 0 deletions

View file

@ -32,6 +32,7 @@ export class ProfileAvatarController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
result.isActive = true;
profile.avatar = result.avatar;
profile.avatarName = result.avatarName;
return new HttpSuccess();
@ -59,6 +60,7 @@ export class ProfileAvatarController extends Controller {
await this.avatarRepository.save(data);
let avatar = `ทะเบียนประวัติ/โปรไฟล์/${profile.id}`;
let fileName = `profile-${data.id}`;
data.isActive = true;
data.avatar = avatar;
data.avatarName = fileName;
await this.avatarRepository.save(data);