path รูป
This commit is contained in:
parent
3429fa29a2
commit
566b4db692
2 changed files with 12 additions and 2 deletions
|
|
@ -42,6 +42,11 @@ export class ProfileAvatarController extends Controller {
|
|||
Object.assign(data, { ...body, ...meta });
|
||||
|
||||
await this.avatarRepository.save(data);
|
||||
let avatar = `ทะเบียนประวัติ/โปรไฟล์/${profile.id}/profile-${data.id}`;
|
||||
data.avatar = avatar;
|
||||
await this.avatarRepository.save(data);
|
||||
profile.avatar = avatar;
|
||||
await this.profileRepository.save(profile);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
|
|||
@Route("api/v1/org/profile-employee/avatar")
|
||||
@Tags("ProfileAvatar")
|
||||
@Security("bearerAuth")
|
||||
export class ProfileAvatarController extends Controller {
|
||||
export class ProfileAvatarEmployeeController extends Controller {
|
||||
private profileRepository = AppDataSource.getRepository(ProfileEmployee);
|
||||
private avatarRepository = AppDataSource.getRepository(ProfileAvatar);
|
||||
|
||||
|
|
@ -45,8 +45,13 @@ export class ProfileAvatarController extends Controller {
|
|||
Object.assign(data, { ...body, ...meta });
|
||||
|
||||
await this.avatarRepository.save(data);
|
||||
let avatar = `ทะเบียนประวัติ/โปรไฟล์/${profile.id}/profile-employee-${data.id}`;
|
||||
data.avatar = avatar;
|
||||
await this.avatarRepository.save(data);
|
||||
profile.avatar = avatar;
|
||||
await this.profileRepository.save(profile);
|
||||
|
||||
return new HttpSuccess();
|
||||
return new HttpSuccess(avatar);
|
||||
}
|
||||
|
||||
@Delete("{avatarId}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue