get id create

This commit is contained in:
kittapath 2025-01-29 10:15:19 +07:00
parent 871e2e5247
commit 0b8f9b6c23
36 changed files with 42 additions and 46 deletions

View file

@ -127,23 +127,18 @@ export class ProfileDevelopmentController extends Controller {
public async developmentDetail(
@Path() developmentId: string,
@Path() type: string,
@Request() req: RequestWithUser
@Request() req: RequestWithUser,
) {
const data = await this.developmentRequestRepository.findOne({
where: { id: developmentId },
relations: ["developmentProjects"],
});
if (!data)
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบรายการพัฒนารายบุคคลดังกล่าว");
if (!data) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบรายการพัฒนารายบุคคลดังกล่าว");
if (type.trim().toLocaleUpperCase() == "OFFICER") {
let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_OFFICER");
if (_workflow == false)
await new permission().PermissionOrgUserGet(
req,
"SYS_REGISTRY_OFFICER",
data.profileId,
);
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", data.profileId);
} else if (type.trim().toLocaleUpperCase() == "EMPLOYEE") {
let _workflow = await new permission().Workflow(req, developmentId, "SYS_REGISTRY_EMP");
if (_workflow == false)
@ -183,8 +178,8 @@ export class ProfileDevelopmentController extends Controller {
reasonDevelopment10: data.reasonDevelopment10,
selectType: null,
selectTypeYear: null,
selectTypeId: null
}
selectTypeId: null,
};
const _data = {
..._mapData,
developmentProjects: data.developmentProjects.map((x) => x.name),
@ -249,7 +244,7 @@ export class ProfileDevelopmentController extends Controller {
);
}
return new HttpSuccess();
return new HttpSuccess(data.id);
}
@Patch("{developmentId}")