Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 59s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 59s
This commit is contained in:
commit
b530e08008
1 changed files with 21 additions and 2 deletions
|
|
@ -259,7 +259,13 @@ export async function removeProfileInOrganize(profileId: string, type: string) {
|
||||||
.andWhere("orgRevision.orgRevisionIsCurrent = true")
|
.andWhere("orgRevision.orgRevisionIsCurrent = true")
|
||||||
.getOne();
|
.getOne();
|
||||||
|
|
||||||
if (!currentRevision) {
|
const draftRevision = await AppDataSource.getRepository(OrgRevision)
|
||||||
|
.createQueryBuilder("orgRevision")
|
||||||
|
.where("orgRevision.orgRevisionIsDraft = true")
|
||||||
|
.andWhere("orgRevision.orgRevisionIsCurrent = false")
|
||||||
|
.getOne();
|
||||||
|
|
||||||
|
if (!currentRevision && !draftRevision) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type === "OFFICER") {
|
if (type === "OFFICER") {
|
||||||
|
|
@ -276,7 +282,20 @@ export async function removeProfileInOrganize(profileId: string, type: string) {
|
||||||
.where("id = :id", { id: findProfileInposMaster?.id })
|
.where("id = :id", { id: findProfileInposMaster?.id })
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
if (!findProfileInposMaster) {
|
const findProfileInposMasterDraft = await AppDataSource.getRepository(PosMaster)
|
||||||
|
.createQueryBuilder("posMaster")
|
||||||
|
.where("posMaster.orgRevisionId = :orgRevisionId", { orgRevisionId: draftRevision?.id })
|
||||||
|
.andWhere("posMaster.current_holderId = :profileId", { profileId })
|
||||||
|
.getOne();
|
||||||
|
|
||||||
|
await AppDataSource.getRepository(PosMaster)
|
||||||
|
.createQueryBuilder()
|
||||||
|
.update(PosMaster)
|
||||||
|
.set({ next_holderId: null })
|
||||||
|
.where("id = :id", { id: findProfileInposMasterDraft?.id })
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
if (!findProfileInposMaster && !findProfileInposMasterDraft) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const findPosition = await AppDataSource.getRepository(Position)
|
const findPosition = await AppDataSource.getRepository(Position)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue