From f911384242c75f5e4bc0f14d1191a2b926f1beaa Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Fri, 6 Sep 2024 13:38:18 +0700 Subject: [PATCH] fix: missing field input --- src/controllers/02-user-controller.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/controllers/02-user-controller.ts b/src/controllers/02-user-controller.ts index bdadf33..5f3c8b1 100644 --- a/src/controllers/02-user-controller.ts +++ b/src/controllers/02-user-controller.ts @@ -85,6 +85,8 @@ type UserCreate = { districtId?: string | null; provinceId?: string | null; + selectedImage?: string; + branchId: string | string[]; }; @@ -126,6 +128,8 @@ type UserUpdate = { email?: string; telephoneNo?: string; + selectedImage?: string; + subDistrictId?: string | null; districtId?: string | null; provinceId?: string | null; @@ -284,17 +288,7 @@ export class UserController extends Controller { ]); return { - result: await Promise.all( - result.map(async (v) => ({ - ...v, - branch: includeBranch ? v.branch.map((a) => a.branch) : undefined, - profileImageUrl: await presignedGetObjectIfExist( - MINIO_BUCKET, - imageLocation(v.id), - 12 * 60 * 60, - ), - })), - ), + result, page, pageSize, total, @@ -841,7 +835,7 @@ export class UserProfileController extends Controller { } @Delete("{name}") - async deleteAttachment(@Path() userId: string, @Path() name: string) { + async deleteImage(@Path() userId: string, @Path() name: string) { await minio.removeObject(MINIO_BUCKET, fileLocation.user.profile(userId, name), { forceDelete: true, });