Merge branch 'adiDev' into develop
This commit is contained in:
commit
afc97292d3
1 changed files with 30 additions and 5 deletions
|
|
@ -47,7 +47,7 @@ export class PositionController extends Controller {
|
||||||
private posLevelRepository = AppDataSource.getRepository(PosLevel);
|
private posLevelRepository = AppDataSource.getRepository(PosLevel);
|
||||||
private posDictRepository = AppDataSource.getRepository(PosDict);
|
private posDictRepository = AppDataSource.getRepository(PosDict);
|
||||||
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
||||||
private posPositionRepository = AppDataSource.getRepository(Position);
|
private positionRepository = AppDataSource.getRepository(Position);
|
||||||
|
|
||||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||||
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
||||||
|
|
@ -491,7 +491,7 @@ export class PositionController extends Controller {
|
||||||
position.createdFullName = request.user.name;
|
position.createdFullName = request.user.name;
|
||||||
position.lastUpdateUserId = request.user.sub;
|
position.lastUpdateUserId = request.user.sub;
|
||||||
position.lastUpdateFullName = request.user.name;
|
position.lastUpdateFullName = request.user.name;
|
||||||
await this.posPositionRepository.save(position);
|
await this.positionRepository.save(position);
|
||||||
});
|
});
|
||||||
return new HttpSuccess(posMaster.id);
|
return new HttpSuccess(posMaster.id);
|
||||||
}
|
}
|
||||||
|
|
@ -599,7 +599,7 @@ export class PositionController extends Controller {
|
||||||
posMaster.lastUpdateFullName = request.user.name;
|
posMaster.lastUpdateFullName = request.user.name;
|
||||||
await this.posMasterRepository.save(posMaster);
|
await this.posMasterRepository.save(posMaster);
|
||||||
|
|
||||||
await this.posPositionRepository.delete({ posMasterId: posMaster.id });
|
await this.positionRepository.delete({ posMasterId: posMaster.id });
|
||||||
requestBody.positions.forEach(async (x: any) => {
|
requestBody.positions.forEach(async (x: any) => {
|
||||||
const position = Object.assign(new Position());
|
const position = Object.assign(new Position());
|
||||||
position.positionName = x.posDictName;
|
position.positionName = x.posDictName;
|
||||||
|
|
@ -615,7 +615,7 @@ export class PositionController extends Controller {
|
||||||
position.createdFullName = request.user.name;
|
position.createdFullName = request.user.name;
|
||||||
position.lastUpdateUserId = request.user.sub;
|
position.lastUpdateUserId = request.user.sub;
|
||||||
position.lastUpdateFullName = request.user.name;
|
position.lastUpdateFullName = request.user.name;
|
||||||
await this.posPositionRepository.save(position);
|
await this.positionRepository.save(position);
|
||||||
});
|
});
|
||||||
return new HttpSuccess(posMaster.id);
|
return new HttpSuccess(posMaster.id);
|
||||||
}
|
}
|
||||||
|
|
@ -636,7 +636,7 @@ export class PositionController extends Controller {
|
||||||
if (!posMaster) {
|
if (!posMaster) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
}
|
||||||
const positions = await this.posPositionRepository.find({
|
const positions = await this.positionRepository.find({
|
||||||
where: { posMasterId: posMaster.id },
|
where: { posMasterId: posMaster.id },
|
||||||
});
|
});
|
||||||
const formattedData = {
|
const formattedData = {
|
||||||
|
|
@ -665,4 +665,29 @@ export class PositionController extends Controller {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ลบอัตรากำลัง
|
||||||
|
*
|
||||||
|
* @summary ORG_035 - ลบอัตรากำลัง (ADMIN) #38
|
||||||
|
*
|
||||||
|
* @param {string} id Id ตำแหน่ง
|
||||||
|
*/
|
||||||
|
@Delete("master/{id}")
|
||||||
|
async deletePosMaster(@Path() id: string) {
|
||||||
|
const delPosMaster = await this.posMasterRepository.findOne({
|
||||||
|
where: { id },
|
||||||
|
// relations: ["position"],
|
||||||
|
});
|
||||||
|
if (!delPosMaster) {
|
||||||
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await this.positionRepository.delete({ posMasterId: id });
|
||||||
|
await this.posMasterRepository.delete({ id });
|
||||||
|
return new HttpSuccess();
|
||||||
|
} catch (error) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue