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

This commit is contained in:
kittapath 2024-11-13 11:56:35 +07:00
commit b96b06cc0a
7 changed files with 57 additions and 448 deletions

View file

@ -3037,6 +3037,16 @@ export class CommandController extends Controller {
statusReport: "REPORT",
}));
await this.posMasterRepository.save(data);
if (posMasters && posMasters.length > 0) {
const orgRevision = await this.orgRevisionRepo.findOne({
where: { id: posMasters[0].orgRevisionId }
});
if (orgRevision != null) {
await this.orgRevisionRepo.update(orgRevision.id, {
isLock: true,
});
}
}
return new HttpSuccess();
}
@ -3531,6 +3541,19 @@ export class CommandController extends Controller {
statusReport: "PENDING",
}));
await this.posMasterRepository.save(data);
if (data && data.length > 0) {
const revisionId = data[0].orgRevisionId;
const orgRevision = await this.orgRevisionRepo.findOne({
where: { id: revisionId },
relations: ["posMasters"]
});
if (orgRevision != null && !orgRevision?.posMasters.filter(x => x.statusReport === "REPORT")
) {
await this.orgRevisionRepo.update(orgRevision.id, {
isLock: false,
});
}
}
return new HttpSuccess();
}

View file

@ -668,6 +668,28 @@ export class OrganizationController extends Controller {
return new HttpSuccess(revision);
}
/**
* API
*
* @summary API
*
* @param {string} id Id OrgRevison
*/
@Get("lock/{id}")
async GetById(
@Request() request: RequestWithUser,
@Path() id: string,
) {
//add check permission
const orgRevision = await this.orgRevisionRepository.findOne({
where: { id: id }
});
if (!orgRevision) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
}
return new HttpSuccess(orgRevision.isLock);
}
/**
* API
*

View file

@ -3112,6 +3112,8 @@ export class PositionController extends Controller {
await this.posMasterRepository.update(id, {
isSit: false,
next_holderId: null,
current_holderId: null,
statusReport: "PENDING",
});
dataMaster.positions.forEach(async (position) => {