Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop

This commit is contained in:
Kittapath 2024-05-17 14:17:09 +07:00
commit 92a865fd3c
10 changed files with 61 additions and 12 deletions

View file

@ -24,7 +24,7 @@ import {
ProfileChildren,
UpdateProfileChildren,
} from "../entities/ProfileChildren";
import Extension from "../interfaces/extension";
@Route("api/v1/org/profile/family/children")
@Tags("ProfileChildren")
@Security("bearerAuth")
@ -67,6 +67,7 @@ export class ProfileChildrenController extends Controller {
};
Object.assign(data, { ...body, ...meta });
data.childrenCitizenId = Extension.CheckCitizen(String(data.childrenCitizenId));
await this.childrenRepository.save(data);
if(data){
const history: ProfileChildrenHistory = Object.assign(new ProfileChildrenHistory(), {
@ -101,6 +102,7 @@ export class ProfileChildrenController extends Controller {
Object.assign(record, body);
record.lastUpdateUserId = req.user.sub;
record.lastUpdateFullName = req.user.name;
record.childrenCitizenId = Extension.CheckCitizen(String(record.childrenCitizenId));
history.profileChildrenId = record.id;
history.childrenCareer = record.childrenCareer;
history.childrenFirstName = record.childrenFirstName;

View file

@ -26,7 +26,7 @@ import {
UpdateProfileChildren,
} from "../entities/ProfileChildren";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import Extension from "../interfaces/extension";
@Route("api/v1/org/profile-employee/family/children")
@Tags("ProfileChildren")
@Security("bearerAuth")
@ -73,6 +73,7 @@ export class ProfileChildrenEmployeeController extends Controller {
};
Object.assign(data, { ...body, ...meta });
data.childrenCitizenId = Extension.CheckCitizen(String(data.childrenCitizenId));
await this.childrenRepository.save(data);
if(data){
const history: ProfileChildrenHistory = Object.assign(new ProfileChildrenHistory(), {
@ -108,6 +109,7 @@ export class ProfileChildrenEmployeeController extends Controller {
Object.assign(record, body);
record.lastUpdateUserId = req.user.sub;
record.lastUpdateFullName = req.user.name;
record.childrenCitizenId = Extension.CheckCitizen(String(record.childrenCitizenId));
history.profileChildrenId = record.id;
history.childrenCareer = record.childrenCareer;
history.childrenFirstName = record.childrenFirstName;

View file

@ -20,7 +20,7 @@ import { RequestWithUser } from "../middlewares/user";
import { Profile } from "../entities/Profile";
import { ProfileFamilyCouple, CreateProfileFamilyCouple, UpdateProfileFamilyCouple } from "../entities/ProfileFamilyCouple";
import { ProfileFamilyCoupleHistory } from "../entities/ProfileFamilyCoupleHistory";
import Extension from "../interfaces/extension";
@Route("api/v1/org/profile/family/couple")
@Tags("ProfileFamilyCouple")
@Security("bearerAuth")
@ -142,6 +142,7 @@ export class ProfileFamilyCoupleController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
familyCouple.createdUserId = req.user.sub;
familyCouple.createdFullName = req.user.name;
familyCouple.lastUpdateUserId = req.user.sub;
@ -187,6 +188,7 @@ export class ProfileFamilyCoupleController extends Controller {
Object.assign(familyCouple, body);
familyCouple.lastUpdateUserId = req.user.sub,
familyCouple.lastUpdateFullName = req.user.name;
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
history.profileFamilyCoupleId = familyCouple.id;
history.couplePrefix = familyCouple.couplePrefix,
history.coupleFirstName = familyCouple.coupleFirstName,

View file

@ -20,7 +20,7 @@ import { RequestWithUser } from "../middlewares/user";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { ProfileFamilyCouple, CreateProfileEmployeeFamilyCouple, UpdateProfileFamilyCouple } from "../entities/ProfileFamilyCouple";
import { ProfileFamilyCoupleHistory } from "../entities/ProfileFamilyCoupleHistory";
import Extension from "../interfaces/extension";
@Route("api/v1/org/profile-employee/family/couple")
@Tags("ProfileEmployeeFamilyCouple")
@Security("bearerAuth")
@ -142,6 +142,7 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
familyCouple.createdUserId = req.user.sub;
familyCouple.createdFullName = req.user.name;
familyCouple.lastUpdateUserId = req.user.sub;
@ -187,6 +188,7 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
Object.assign(familyCouple, body);
familyCouple.lastUpdateUserId = req.user.sub,
familyCouple.lastUpdateFullName = req.user.name;
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
history.profileFamilyCoupleId = familyCouple.id;
history.couplePrefix = familyCouple.couplePrefix,
history.coupleFirstName = familyCouple.coupleFirstName,

View file

@ -20,7 +20,7 @@ import { RequestWithUser } from "../middlewares/user";
import { Profile } from "../entities/Profile";
import { ProfileFamilyFather, CreateProfileFamilyFather, UpdateProfileFamilyFather } from "../entities/ProfileFamilyFather";
import { ProfileFamilyFatherHistory } from "../entities/ProfileFamilyFatherHistory";
import Extension from "../interfaces/extension";
@Route("api/v1/org/profile/family/father")
@Tags("ProfileFamilyFather")
@Security("bearerAuth")
@ -136,6 +136,7 @@ export class ProfileFamilyFatherController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId));
familyFather.createdUserId = req.user.sub;
familyFather.createdFullName = req.user.name;
familyFather.lastUpdateUserId = req.user.sub;
@ -175,7 +176,7 @@ export class ProfileFamilyFatherController extends Controller {
Object.assign(familyFather, body);
familyFather.lastUpdateUserId = req.user.sub,
familyFather.lastUpdateFullName = req.user.name;
familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId));
history.profileFamilyFatherId = familyFather.id; //profileFamilyFatherId
history.fatherPrefix = familyFather.fatherPrefix,
history.fatherFirstName = familyFather.fatherFirstName,

View file

@ -20,7 +20,7 @@ import { RequestWithUser } from "../middlewares/user";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { ProfileFamilyFather, CreateProfileEmployeeFamilyFather, UpdateProfileFamilyFather } from "../entities/ProfileFamilyFather";
import { ProfileFamilyFatherHistory } from "../entities/ProfileFamilyFatherHistory";
import Extension from "../interfaces/extension";
@Route("api/v1/org/profile-employee/family/father")
@Tags("ProfileEmployeeFamilyFather")
@Security("bearerAuth")
@ -136,6 +136,7 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId));
familyFather.createdUserId = req.user.sub;
familyFather.createdFullName = req.user.name;
familyFather.lastUpdateUserId = req.user.sub;
@ -175,7 +176,7 @@ export class ProfileFamilyFatherEmployeeController extends Controller {
Object.assign(familyFather, body);
familyFather.lastUpdateUserId = req.user.sub,
familyFather.lastUpdateFullName = req.user.name;
familyFather.fatherCitizenId = Extension.CheckCitizen(String(body.fatherCitizenId));
history.profileFamilyFatherId = familyFather.id;
history.fatherPrefix = familyFather.fatherPrefix,
history.fatherFirstName = familyFather.fatherFirstName,

View file

@ -20,7 +20,7 @@ import { RequestWithUser } from "../middlewares/user";
import { Profile } from "../entities/Profile";
import { ProfileFamilyMother, CreateProfileFamilyMother, UpdateProfileFamilyMother } from "../entities/ProfileFamilyMother";
import { ProfileFamilyMotherHistory } from "../entities/ProfileFamilyMotherHistory";
import Extension from "../interfaces/extension";
@Route("api/v1/org/profile/family/mother")
@Tags("ProfileFamilyMother")
@Security("bearerAuth")
@ -136,6 +136,7 @@ export class ProfileFamilyMotherController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId));
familyMother.createdUserId = req.user.sub;
familyMother.createdFullName = req.user.name;
familyMother.lastUpdateUserId = req.user.sub;
@ -175,7 +176,7 @@ export class ProfileFamilyMotherController extends Controller {
Object.assign(familyMother, body);
familyMother.lastUpdateUserId = req.user.sub,
familyMother.lastUpdateFullName = req.user.name;
familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId));
history.profileFamilyMotherId = familyMother.id;
history.motherPrefix = familyMother.motherPrefix,
history.motherFirstName = familyMother.motherFirstName,

View file

@ -20,7 +20,7 @@ import { RequestWithUser } from "../middlewares/user";
import { ProfileEmployee } from "../entities/ProfileEmployee";
import { ProfileFamilyMother, CreateProfileEmployeeFamilyMother, UpdateProfileFamilyMother } from "../entities/ProfileFamilyMother";
import { ProfileFamilyMotherHistory } from "../entities/ProfileFamilyMotherHistory";
import Extension from "../interfaces/extension";
@Route("api/v1/org/profile-employee/family/mother")
@Tags("ProfileEmployeeFamilyMother")
@Security("bearerAuth")
@ -136,6 +136,7 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId));
familyMother.createdUserId = req.user.sub;
familyMother.createdFullName = req.user.name;
familyMother.lastUpdateUserId = req.user.sub;
@ -175,7 +176,7 @@ export class ProfileFamilyMotherEmployeeController extends Controller {
Object.assign(familyMother, body);
familyMother.lastUpdateUserId = req.user.sub,
familyMother.lastUpdateFullName = req.user.name;
familyMother.motherCitizenId = Extension.CheckCitizen(String(body.motherCitizenId));
history.profileFamilyMotherId = familyMother.id;
history.motherPrefix = familyMother.motherPrefix,
history.motherFirstName = familyMother.motherFirstName,

View file

@ -105,6 +105,7 @@ export class ProfileGovernmentHistoryController extends Controller {
positionArea: position == null ? null : position.positionArea, //ด้าน/สาขา
positionExecutiveField: position == null ? null : position.positionExecutiveField, //ด้านทางการบริหาร
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null,
govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
dateAppoint: record.dateAppoint,
dateStart: record.dateStart,