ค้นหาลำดับโครงสร้าง
This commit is contained in:
parent
6a4f032b01
commit
068dabe792
1 changed files with 42 additions and 5 deletions
|
|
@ -36,6 +36,8 @@ import { EmployeePosition } from "../entities/EmployeePosition";
|
||||||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||||
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
|
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
|
||||||
import { AuthRole } from "../entities/AuthRole";
|
import { AuthRole } from "../entities/AuthRole";
|
||||||
|
import { PosType } from "../entities/PosType";
|
||||||
|
import { PosLevel } from "../entities/PosLevel";
|
||||||
|
|
||||||
@Route("api/v1/org")
|
@Route("api/v1/org")
|
||||||
@Tags("Organization")
|
@Tags("Organization")
|
||||||
|
|
@ -60,6 +62,8 @@ export class OrganizationController extends Controller {
|
||||||
private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
|
private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
|
||||||
private employeePositionRepository = AppDataSource.getRepository(EmployeePosition);
|
private employeePositionRepository = AppDataSource.getRepository(EmployeePosition);
|
||||||
private employeeTempPosMasterRepository = AppDataSource.getRepository(EmployeeTempPosMaster);
|
private employeeTempPosMasterRepository = AppDataSource.getRepository(EmployeeTempPosMaster);
|
||||||
|
private posTypeRepository = AppDataSource.getRepository(PosType);
|
||||||
|
private posLevelRepository = AppDataSource.getRepository(PosLevel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API ล้างข้อมูล
|
* API ล้างข้อมูล
|
||||||
|
|
@ -152,14 +156,17 @@ export class OrganizationController extends Controller {
|
||||||
data: {
|
data: {
|
||||||
requestBody: requestBody,
|
requestBody: requestBody,
|
||||||
request: request.user,
|
request: request.user,
|
||||||
revision: revision
|
revision: revision,
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
try {
|
try {
|
||||||
await sendToQueueOrgDraft(msg);
|
await sendToQueueOrgDraft(msg);
|
||||||
return new HttpSuccess ('Draft is being created... Processing in the background.');
|
return new HttpSuccess("Draft is being created... Processing in the background.");
|
||||||
} catch (error:any) {
|
} catch (error: any) {
|
||||||
return new HttpError (HttpStatusCode.NOT_FOUND,'Failed to process the draft. Please try again later.');
|
return new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"Failed to process the draft. Please try again later.",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7544,4 +7551,34 @@ export class OrganizationController extends Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ลำดับโครงสร้าง
|
||||||
|
*
|
||||||
|
* @summary - ลำดับโครงสร้าง (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Get("root/search/sort")
|
||||||
|
async searchSortRootLevelType(@Request() request: RequestWithUser) {
|
||||||
|
const root = await this.orgRootRepository.find({
|
||||||
|
where: {
|
||||||
|
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
|
||||||
|
},
|
||||||
|
order: { orgRootOrder: "ASC" },
|
||||||
|
select: ["orgRootName"],
|
||||||
|
});
|
||||||
|
const posType = await this.posTypeRepository.find({
|
||||||
|
order: { posTypeRank: "ASC" },
|
||||||
|
select: ["posTypeName"],
|
||||||
|
});
|
||||||
|
const posLevel = await this.posLevelRepository.find({
|
||||||
|
order: { posLevelRank: "ASC" },
|
||||||
|
select: ["posLevelName"],
|
||||||
|
});
|
||||||
|
return new HttpSuccess({
|
||||||
|
root: root,
|
||||||
|
posTypeNameOrder: posType,
|
||||||
|
posLevelNameOrder: posLevel,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue