no message
This commit is contained in:
parent
5a634b4dd3
commit
b11be3364f
7 changed files with 201 additions and 125 deletions
|
|
@ -117,8 +117,8 @@ export class OrganizationDotnetController extends Controller {
|
|||
}),
|
||||
);
|
||||
}
|
||||
const profileEmp = await queryBuilder.getMany();
|
||||
return new HttpSuccess(profileEmp);
|
||||
const profileEmp = await queryBuilder.getMany();
|
||||
return new HttpSuccess(profileEmp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -154,7 +154,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
if (!orgRoot) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
return new HttpSuccess(orgRoot);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 3. API Get Profile จาก keycloak id
|
||||
*
|
||||
|
|
@ -168,14 +168,14 @@ export class OrganizationDotnetController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
profileSalary: true
|
||||
profileSalary: true,
|
||||
},
|
||||
where: { keycloak: keycloakId },
|
||||
order:{
|
||||
profileSalary:{
|
||||
date: "DESC"
|
||||
}
|
||||
}
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -184,26 +184,26 @@ export class OrganizationDotnetController extends Controller {
|
|||
avatar: profile.avatar,
|
||||
avatarName: profile.avatarName,
|
||||
rank: profile.rank,
|
||||
prefix: profile.prefix,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
citizenId: profile.citizenId,
|
||||
position: profile.position,
|
||||
posLevelId: profile.posLevelId,
|
||||
email: profile.email,
|
||||
phone: profile.phone,
|
||||
prefix: profile.prefix,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
citizenId: profile.citizenId,
|
||||
position: profile.position,
|
||||
posLevelId: profile.posLevelId,
|
||||
email: profile.email,
|
||||
phone: profile.phone,
|
||||
keycloak: profile.keycloak,
|
||||
isProbation: profile.isProbation,
|
||||
isLeave: profile.isLeave,
|
||||
leaveReason: profile.leaveReason,
|
||||
dateRetire: profile.dateRetire,
|
||||
leaveReason: profile.leaveReason,
|
||||
dateRetire: profile.dateRetire,
|
||||
dateAppoint: profile.dateAppoint,
|
||||
dateRetireLaw: profile.dateRetireLaw,
|
||||
dateStart: profile.dateStart,
|
||||
govAgeAbsent: profile.govAgeAbsent,
|
||||
govAgePlus: profile.govAgePlus,
|
||||
birthDate: profile.birthDate,
|
||||
reasonSameDate: profile.reasonSameDate,
|
||||
dateStart: profile.dateStart,
|
||||
govAgeAbsent: profile.govAgeAbsent,
|
||||
govAgePlus: profile.govAgePlus,
|
||||
birthDate: profile.birthDate,
|
||||
reasonSameDate: profile.reasonSameDate,
|
||||
telephoneNumber: profile.telephoneNumber,
|
||||
nationality: profile.nationality,
|
||||
gender: profile.gender,
|
||||
|
|
@ -215,18 +215,16 @@ export class OrganizationDotnetController extends Controller {
|
|||
registrationDistrictId: profile.registrationDistrictId,
|
||||
registrationSubDistrictId: profile.registrationSubDistrictId,
|
||||
registrationZipCode: profile.registrationZipCode,
|
||||
currentAddress: profile.currentAddress,
|
||||
currentProvinceId: profile.currentProvinceId,
|
||||
currentSubDistrictId: profile.currentSubDistrictId,
|
||||
currentZipCode: profile.currentZipCode,
|
||||
dutyTimeId: profile.dutyTimeId,
|
||||
currentAddress: profile.currentAddress,
|
||||
currentProvinceId: profile.currentProvinceId,
|
||||
currentSubDistrictId: profile.currentSubDistrictId,
|
||||
currentZipCode: profile.currentZipCode,
|
||||
dutyTimeId: profile.dutyTimeId,
|
||||
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
|
||||
posLevel: profile.posLevel? profile.posLevel : null,
|
||||
posType: profile.posType? profile.posType : null,
|
||||
profileSalary: profile.profileSalary.length > 0
|
||||
? profile.profileSalary[0]
|
||||
: null
|
||||
}
|
||||
posLevel: profile.posLevel ? profile.posLevel : null,
|
||||
posType: profile.posType ? profile.posType : null,
|
||||
profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null,
|
||||
};
|
||||
|
||||
return new HttpSuccess(mapProfile);
|
||||
}
|
||||
|
|
@ -242,10 +240,10 @@ export class OrganizationDotnetController extends Controller {
|
|||
async GetUserFullName(@Path() keycloakId: string) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { keycloak: keycloakId },
|
||||
select: ["prefix", "firstName", "lastName"]
|
||||
select: ["prefix", "firstName", "lastName"],
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
const fullName = profile? `${profile.prefix}${profile.firstName} ${profile.lastName}` : "-";
|
||||
const fullName = profile ? `${profile.prefix}${profile.firstName} ${profile.lastName}` : "-";
|
||||
return new HttpSuccess(fullName);
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +294,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
root: root == null ? null : root.orgRootName,
|
||||
rootShortName: root == null ? null : root.orgRootShortName,
|
||||
};
|
||||
return new HttpSuccess(profile);
|
||||
return new HttpSuccess(_profile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -380,7 +378,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: {
|
||||
posMasterId: posMaster?.id,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
const _profile: any = {
|
||||
profileId: profile.id,
|
||||
|
|
@ -462,7 +460,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: { id: ocId },
|
||||
});
|
||||
if (!orgRoot) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
const root = orgRoot? orgRoot.id : "";
|
||||
const root = orgRoot ? orgRoot.id : "";
|
||||
return new HttpSuccess(root);
|
||||
}
|
||||
|
||||
|
|
@ -475,25 +473,26 @@ export class OrganizationDotnetController extends Controller {
|
|||
@Get("keycloak")
|
||||
async GetProfileWithKeycloak() {
|
||||
const profile = await this.profileRepo.find({
|
||||
where: { keycloak: Not(IsNull()) || Not(""), },
|
||||
where: { keycloak: Not(IsNull()) || Not("") },
|
||||
});
|
||||
return new HttpSuccess(profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. API Update รอบการลงเวลา ในตาราง profile
|
||||
* 4. API Update รอบการลงเวลา ในตาราง profile
|
||||
*
|
||||
* @summary 4. API Update รอบการลงเวลา ในตาราง profile
|
||||
* @summary 4. API Update รอบการลงเวลา ในตาราง profile
|
||||
*
|
||||
*/
|
||||
@Put("update-dutytime")
|
||||
async UpdateDutyTimeAsync(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body() body: {
|
||||
@Body()
|
||||
body: {
|
||||
profileId: string;
|
||||
roundId: string;
|
||||
effectiveDate: Date;
|
||||
}
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: body.profileId },
|
||||
|
|
@ -507,5 +506,4 @@ export class OrganizationDotnetController extends Controller {
|
|||
await this.profileRepo.save(profile);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue