ลบคนออกจากโครงสร้าง
This commit is contained in:
parent
2a9f69f736
commit
7eae9d2c8d
1 changed files with 27 additions and 0 deletions
|
|
@ -7915,4 +7915,31 @@ export class OrganizationController extends Controller {
|
|||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API ลบคนในโครงสร้าง
|
||||
*
|
||||
* @summary - ลบคนในโครงสร้าง (ADMIN)
|
||||
*
|
||||
*/
|
||||
@Get("delete/profile/org/{orgRevisionId}")
|
||||
async deleteRetireInOrg(@Path() orgRevisionId: string, @Request() request: RequestWithUser) {
|
||||
const posMasters = await this.posMasterRepository.find({
|
||||
where: {
|
||||
orgRevisionId: orgRevisionId,
|
||||
current_holder: {
|
||||
isLeave: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
posMasters.map(async (posMaster) => {
|
||||
posMaster.current_holderId = null;
|
||||
await this.posMasterRepository.save(posMaster);
|
||||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue