api โครงสร้างล่าสุด
This commit is contained in:
parent
a7fb4e87b3
commit
e8b14c648e
2 changed files with 155 additions and 9 deletions
|
|
@ -2863,4 +2863,45 @@ export class OrganizationController extends Controller {
|
|||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* API หาสำนักทั้งหมด by revision
|
||||
*
|
||||
* @summary หาสำนักทั้งหมด by revision
|
||||
*
|
||||
*/
|
||||
@Get("active/root/{revisionId}")
|
||||
async GetActiveRootByRevision(@Path() revisionId: string) {
|
||||
try {
|
||||
const data = await this.orgRootRepository.find({
|
||||
where: { orgRevisionId: revisionId },
|
||||
relations: [
|
||||
"orgRevision",
|
||||
"orgChild1s",
|
||||
"orgChild1s.orgChild2s",
|
||||
"orgChild1s.orgChild2s.orgChild3s",
|
||||
"orgChild1s.orgChild2s.orgChild3s.orgChild4s",
|
||||
],
|
||||
});
|
||||
return new HttpSuccess(data);
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* API หา revision ล่าสุด
|
||||
*
|
||||
* @summary หา revision ล่าสุด
|
||||
*
|
||||
*/
|
||||
@Get("revision/latest")
|
||||
async salaryGen() {
|
||||
const findRevision = await this.orgRevisionRepository.findOne({
|
||||
where: { orgRevisionIsCurrent: true },
|
||||
});
|
||||
if (!findRevision) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบโครงสร้างล่าสุด");
|
||||
}
|
||||
return new HttpSuccess(findRevision.id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue