diff --git a/src/controllers/ProfileAvatarController.ts b/src/controllers/ProfileAvatarController.ts index 85bc4adc..73374070 100644 --- a/src/controllers/ProfileAvatarController.ts +++ b/src/controllers/ProfileAvatarController.ts @@ -159,13 +159,14 @@ export class ProfileAvatarController extends Controller { "SYS_REGISTRY_OFFICER", _record.profileId, ); + if (_record.isActive) { const profile = await this.profileRepository.findOne({ where: { id: _record.profileId }, }); if (profile) { - profile.avatar = ''; - profile.avatarName = ''; + profile.avatar = null; + profile.avatarName = null; await this.profileRepository.save(profile, { data: req }); } } diff --git a/src/controllers/ProfileAvatarEmployeeController.ts b/src/controllers/ProfileAvatarEmployeeController.ts index e36b699a..72c652f1 100644 --- a/src/controllers/ProfileAvatarEmployeeController.ts +++ b/src/controllers/ProfileAvatarEmployeeController.ts @@ -160,8 +160,8 @@ export class ProfileAvatarEmployeeController extends Controller { where: { id: _record.profileEmployeeId }, }); if (profile) { - profile.avatar = ''; - profile.avatarName = ''; + profile.avatar = ""; + profile.avatarName = ""; await this.profileRepository.save(profile, { data: req }); } } diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index 994fcfbe..aae4273f 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -58,14 +58,14 @@ export class Profile extends EntityBase { comment: "รูปถ่าย", default: null, }) - avatar: string; + avatar: string | null; @Column({ nullable: true, comment: "รูปถ่าย", default: null, }) - avatarName: string; + avatarName: string | null; @Column({ nullable: true,