no message
This commit is contained in:
parent
9365c6c62e
commit
277805791d
1 changed files with 15 additions and 0 deletions
|
|
@ -22,6 +22,21 @@ export class ProfileAvatarController extends Controller {
|
|||
return new HttpSuccess(lists);
|
||||
}
|
||||
|
||||
@Get("select/{profileId}/{id}")
|
||||
public async selectAvatar(@Path() profileId: string, @Path() id: string) {
|
||||
const result = await this.avatarRepository.findOneBy({ id: id });
|
||||
if (!result) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
const profile = await this.profileRepository.findOneBy({ id: profileId });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
profile.avatar = result.avatar;
|
||||
profile.avatarName = result.avatarName;
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
@Post()
|
||||
public async newAvatar(@Request() req: RequestWithUser, @Body() body: CreateProfileAvatar) {
|
||||
const profile = await this.profileRepository.findOneBy({ id: body.profileId });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue