แก้ วันที่ update
This commit is contained in:
parent
6d36c9b05f
commit
218886b3f4
83 changed files with 1671 additions and 3483 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Example,
|
||||
Get,
|
||||
Patch,
|
||||
|
|
@ -41,16 +40,6 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
const familyFather = await this.ProfileFamilyFather.findOne({
|
||||
select: [
|
||||
"id",
|
||||
"fatherPrefix",
|
||||
"fatherFirstName",
|
||||
"fatherLastName",
|
||||
"fatherCareer",
|
||||
"fatherCitizenId",
|
||||
"fatherLive",
|
||||
"profileId",
|
||||
],
|
||||
where: { profileEmployeeId: profile.id },
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
});
|
||||
|
|
@ -59,20 +48,6 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("{profileEmployeeId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
message: "สำเร็จ",
|
||||
result: {
|
||||
id: "6207ae29-05ef-4abb-9a37-a887265d671e",
|
||||
fatherPrefix: "string",
|
||||
fatherFirstName: "string",
|
||||
fatherLastName: "string",
|
||||
fatherCareer: "string",
|
||||
fatherCitizenId: "string",
|
||||
fatherLive: true,
|
||||
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
},
|
||||
})
|
||||
public async getFamilyFather(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -83,16 +58,6 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
const familyFather = await this.ProfileFamilyFather.findOne({
|
||||
select: [
|
||||
"id",
|
||||
"fatherPrefix",
|
||||
"fatherFirstName",
|
||||
"fatherLastName",
|
||||
"fatherCareer",
|
||||
"fatherCitizenId",
|
||||
"fatherLive",
|
||||
"profileEmployeeId",
|
||||
],
|
||||
where: { profileEmployeeId },
|
||||
order: { lastUpdatedAt: "DESC" },
|
||||
});
|
||||
|
|
@ -142,30 +107,10 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
@Get("history/{profileEmployeeId}")
|
||||
@Example({
|
||||
status: 200,
|
||||
message: "สำเร็จ",
|
||||
result: [
|
||||
{
|
||||
id: "6207ae29-05ef-4abb-9a37-a887265d671e",
|
||||
createdAt: "2024-03-19T11:00:29.769Z",
|
||||
createdUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
lastUpdatedAt: "2024-03-19T11:00:29.769Z",
|
||||
lastUpdateUserId: "59134ef9-9e62-41d0-aac5-339be727f2b0",
|
||||
createdFullName: "สาวิตรี ศรีสมัย",
|
||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
||||
fatherPrefix: "string",
|
||||
fatherFirstName: "string",
|
||||
fatherLastName: "string",
|
||||
fatherCareer: "string",
|
||||
fatherCitizenId: "string",
|
||||
fatherLive: true,
|
||||
profileFamilyFatherId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
profileEmployeeId: "1526d9d3-d8b1-43ab-81b5-a84dfbe99201",
|
||||
},
|
||||
],
|
||||
})
|
||||
public async familyFatherHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
public async familyFatherHistory(
|
||||
@Path() profileEmployeeId: string,
|
||||
@Request() req: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
|
|
@ -222,6 +167,8 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
familyFather.createdFullName = req.user.name;
|
||||
familyFather.lastUpdateUserId = req.user.sub;
|
||||
familyFather.lastUpdateFullName = req.user.name;
|
||||
familyFather.createdAt = new Date();
|
||||
familyFather.lastUpdatedAt = new Date();
|
||||
|
||||
const history = new ProfileFamilyFatherHistory();
|
||||
Object.assign(history, { ...familyFather, id: undefined });
|
||||
|
|
@ -253,10 +200,13 @@ export class ProfileFamilyFatherEmployeeTempController extends Controller {
|
|||
history.profileFamilyFatherId = familyFather.id;
|
||||
familyFather.lastUpdateUserId = req.user.sub;
|
||||
familyFather.lastUpdateFullName = req.user.name;
|
||||
familyFather.lastUpdatedAt = new Date();
|
||||
history.lastUpdateUserId = req.user.sub;
|
||||
history.lastUpdateFullName = req.user.name;
|
||||
history.createdUserId = req.user.sub;
|
||||
history.createdFullName = req.user.name;
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
await Promise.all([
|
||||
this.ProfileFamilyFather.save(familyFather),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue