no message
This commit is contained in:
parent
6311c9cb0d
commit
fa6b7c91bf
1 changed files with 38 additions and 38 deletions
|
|
@ -114,34 +114,34 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
return new HttpSuccess(record);
|
return new HttpSuccess(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
*
|
// *
|
||||||
* @summary เพิ่มข้อมูลราชการ
|
// * @summary เพิ่มข้อมูลราชการ
|
||||||
*
|
// *
|
||||||
*/
|
// */
|
||||||
@Post()
|
// @Post()
|
||||||
public async newGov(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeGovernment) {
|
// public async newGov(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeGovernment) {
|
||||||
if (!body.profileEmployeeId) {
|
// if (!body.profileEmployeeId) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
// throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||||
}
|
// }
|
||||||
|
|
||||||
const profile = await this.profileEmployeeRepo.findOneBy({ id: body.profileEmployeeId });
|
// const profile = await this.profileEmployeeRepo.findOneBy({ id: body.profileEmployeeId });
|
||||||
if (!profile) {
|
// if (!profile) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
// throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
// }
|
||||||
|
|
||||||
const data = new ProfileGovernment();
|
// const data = new ProfileGovernment();
|
||||||
const meta = {
|
// const meta = {
|
||||||
createdUserId: req.user.sub,
|
// createdUserId: req.user.sub,
|
||||||
createdFullName: req.user.name,
|
// createdFullName: req.user.name,
|
||||||
lastUpdateUserId: req.user.sub,
|
// lastUpdateUserId: req.user.sub,
|
||||||
lastUpdateFullName: req.user.name,
|
// lastUpdateFullName: req.user.name,
|
||||||
};
|
// };
|
||||||
|
|
||||||
Object.assign(data, { ...body, ...meta });
|
// Object.assign(data, { ...body, ...meta });
|
||||||
await this.govRepo.save(data);
|
// await this.govRepo.save(data);
|
||||||
return new HttpSuccess();
|
// return new HttpSuccess();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -172,17 +172,17 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
*
|
// *
|
||||||
* @summary ลบข้อมูลราชการ
|
// * @summary ลบข้อมูลราชการ
|
||||||
*
|
// *
|
||||||
*/
|
// */
|
||||||
@Delete("{profileEmployeeId}")
|
// @Delete("{profileEmployeeId}")
|
||||||
public async deleteGov(@Path() profileEmployeeId: string) {
|
// public async deleteGov(@Path() profileEmployeeId: string) {
|
||||||
const result = await this.govRepo.delete({ profileEmployeeId: profileEmployeeId });
|
// const result = await this.govRepo.delete({ profileEmployeeId: profileEmployeeId });
|
||||||
if (result.affected == undefined || result.affected <= 0) {
|
// if (result.affected == undefined || result.affected <= 0) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
// throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
// }
|
||||||
return new HttpSuccess();
|
// return new HttpSuccess();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue