update clear user in org draft
This commit is contained in:
parent
7739af7d44
commit
b329dcaa0e
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")
|
||||
.getOne();
|
||||
|
||||
if (!currentRevision) {
|
||||
const draftRevision = await AppDataSource.getRepository(OrgRevision)
|
||||
.createQueryBuilder("orgRevision")
|
||||
.where("orgRevision.orgRevisionIsDraft = true")
|
||||
.andWhere("orgRevision.orgRevisionIsCurrent = false")
|
||||
.getOne();
|
||||
|
||||
if (!currentRevision && !draftRevision) {
|
||||
return;
|
||||
}
|
||||
if (type === "OFFICER") {
|
||||
|
|
@ -276,7 +282,20 @@ export async function removeProfileInOrganize(profileId: string, type: string) {
|
|||
.where("id = :id", { id: findProfileInposMaster?.id })
|
||||
.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;
|
||||
}
|
||||
const findPosition = await AppDataSource.getRepository(Position)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue