Merge branch 'adiDev' into develop
This commit is contained in:
commit
0648eb486b
2 changed files with 44 additions and 0 deletions
|
|
@ -1576,6 +1576,16 @@ export class OrganizationController extends Controller {
|
||||||
orgRevisionDraft.orgRevisionIsCurrent = true;
|
orgRevisionDraft.orgRevisionIsCurrent = true;
|
||||||
orgRevisionDraft.orgRevisionIsDraft = false;
|
orgRevisionDraft.orgRevisionIsDraft = false;
|
||||||
await this.orgRevisionRepository.save(orgRevisionDraft);
|
await this.orgRevisionRepository.save(orgRevisionDraft);
|
||||||
|
|
||||||
|
const posMaster = await this.posMasterRepository.find({
|
||||||
|
where: { orgRevisionId: orgRevisionDraft.id },
|
||||||
|
});
|
||||||
|
posMaster.forEach(async (item) => {
|
||||||
|
item.current_holderId = item.next_holderId;
|
||||||
|
item.next_holderId = null;
|
||||||
|
await this.posMasterRepository.save(item);
|
||||||
|
});
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,9 @@ export class ProfileController extends Controller {
|
||||||
requestBody: CreateProfile,
|
requestBody: CreateProfile,
|
||||||
@Request() request: { user: Record<string, any> },
|
@Request() request: { user: Record<string, any> },
|
||||||
) {
|
) {
|
||||||
|
if (requestBody.posLevelId == "") {
|
||||||
|
requestBody.posLevelId = null;
|
||||||
|
}
|
||||||
if (requestBody.posLevelId) {
|
if (requestBody.posLevelId) {
|
||||||
const checkPosLevel = await this.posLevelRepository.findOne({
|
const checkPosLevel = await this.posLevelRepository.findOne({
|
||||||
where: { id: requestBody.posLevelId },
|
where: { id: requestBody.posLevelId },
|
||||||
|
|
@ -63,6 +66,9 @@ export class ProfileController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (requestBody.posTypeId == "") {
|
||||||
|
requestBody.posTypeId = null;
|
||||||
|
}
|
||||||
if (requestBody.posTypeId) {
|
if (requestBody.posTypeId) {
|
||||||
const checkPosType = await this.posTypeRepository.findOne({
|
const checkPosType = await this.posTypeRepository.findOne({
|
||||||
where: { id: requestBody.posTypeId },
|
where: { id: requestBody.posTypeId },
|
||||||
|
|
@ -75,6 +81,17 @@ export class ProfileController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const checkCitizenId = await this.profileRepository.findOne({
|
||||||
|
where: { citizenId: requestBody.citizenId },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (checkCitizenId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"มีรหัสประจำตัวประชาชนนี้แล้วในระบบ (citizenId)",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const profile = Object.assign(new Profile(), requestBody);
|
const profile = Object.assign(new Profile(), requestBody);
|
||||||
profile.createdUserId = request.user.sub;
|
profile.createdUserId = request.user.sub;
|
||||||
|
|
@ -107,6 +124,9 @@ export class ProfileController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id);
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้ : " + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (requestBody.posLevelId == "") {
|
||||||
|
requestBody.posLevelId = null;
|
||||||
|
}
|
||||||
if (requestBody.posLevelId) {
|
if (requestBody.posLevelId) {
|
||||||
const checkPosLevel = await this.posLevelRepository.findOne({
|
const checkPosLevel = await this.posLevelRepository.findOne({
|
||||||
where: { id: requestBody.posLevelId },
|
where: { id: requestBody.posLevelId },
|
||||||
|
|
@ -119,6 +139,9 @@ export class ProfileController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (requestBody.posTypeId == "") {
|
||||||
|
requestBody.posTypeId = null;
|
||||||
|
}
|
||||||
if (requestBody.posTypeId) {
|
if (requestBody.posTypeId) {
|
||||||
const checkPosType = await this.posTypeRepository.findOne({
|
const checkPosType = await this.posTypeRepository.findOne({
|
||||||
where: { id: requestBody.posTypeId },
|
where: { id: requestBody.posTypeId },
|
||||||
|
|
@ -131,6 +154,17 @@ export class ProfileController extends Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const checkCitizenId = await this.profileRepository.findOne({
|
||||||
|
where: { citizenId: requestBody.citizenId },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (checkCitizenId) {
|
||||||
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"มีรหัสประจำตัวประชาชนนี้แล้วในระบบ (citizenId)",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
profile.lastUpdateUserId = request.user.sub;
|
profile.lastUpdateUserId = request.user.sub;
|
||||||
profile.lastUpdateFullName = request.user.name;
|
profile.lastUpdateFullName = request.user.name;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue