Fix
This commit is contained in:
parent
83406751c7
commit
ac1599485a
4 changed files with 28 additions and 11 deletions
|
|
@ -176,6 +176,7 @@ export class EmployeePosLevelController extends Controller {
|
|||
const mapEmpPosLevel = {
|
||||
id: getEmpPosLevel.id,
|
||||
posLevelName: getEmpPosLevel.posLevelName,
|
||||
posTypeId: getEmpPosLevel.posType == null ? null : getEmpPosLevel.posType.id,
|
||||
posTypeName: getEmpPosLevel.posType == null ? null : getEmpPosLevel.posType.posTypeName, //กลุ่มงาน
|
||||
commander: null, //ผู้มีอำนาจสั่งบรรจุ
|
||||
};
|
||||
|
|
@ -197,6 +198,7 @@ export class EmployeePosLevelController extends Controller {
|
|||
const mapEmpPosLevel = empPosLevel.map((item) => ({
|
||||
id: item.id,
|
||||
posLevelName: item.posLevelName,
|
||||
posTypeId: item.posType == null ? null : item.posType.id,
|
||||
posTypeName: item.posType == null ? null : item.posType.posTypeName, //กลุ่มงาน
|
||||
commander: null, //ผู้มีอำนาจสั่งบรรจุ
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ export class EmployeePosTypeController extends Controller {
|
|||
async GetEmpTypeById(@Path() id: string) {
|
||||
const getEmpPosType = await this.employeePosTypeRepository.findOne({
|
||||
relations: ["posLevels"],
|
||||
select: ["id", "posTypeName", "posTypeRank"],
|
||||
select: ["id", "posTypeName", "posTypeRank", "posTypeShortName"],
|
||||
where: { id: id },
|
||||
});
|
||||
if (!getEmpPosType) {
|
||||
|
|
@ -165,6 +165,7 @@ export class EmployeePosTypeController extends Controller {
|
|||
id: getEmpPosType.id,
|
||||
posTypeName: getEmpPosType.posTypeName,
|
||||
posTypeRank: getEmpPosType.posTypeRank,
|
||||
posTypeShortName: getEmpPosType.posTypeShortName,
|
||||
posLevels: getEmpPosType.posLevels.map((empPosLevel) => ({
|
||||
id: empPosLevel.id,
|
||||
posLevelName: empPosLevel.posLevelName,
|
||||
|
|
@ -185,13 +186,14 @@ export class EmployeePosTypeController extends Controller {
|
|||
async GetEmpPosType() {
|
||||
const empPosType = await this.employeePosTypeRepository.find({
|
||||
relations: ["posLevels"],
|
||||
select: ["id", "posTypeName", "posTypeRank"],
|
||||
select: ["id", "posTypeName", "posTypeRank", "posTypeShortName"],
|
||||
});
|
||||
|
||||
const mapEmpPosType = empPosType.map((item) => ({
|
||||
id: item.id,
|
||||
posTypeName: item.posTypeName,
|
||||
posTypeRank: item.posTypeRank,
|
||||
posTypeShortName: item.posTypeShortName,
|
||||
posLevels: item.posLevels.map((empPosLevel) => ({
|
||||
id: empPosLevel.id,
|
||||
posLevelName: empPosLevel.posLevelName,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import { Equal, ILike, In, IsNull, Like, Not, Brackets, Between } from "typeorm"
|
|||
import { InsigniaType, CreateInsigniaType, UpdateInsigniaType } from "../entities/InsigniaType";
|
||||
import { Insignia, CreateInsignias, UpdateInsignias } from "../entities/Insignia";
|
||||
|
||||
@Route("api/v1/org/insignia/Insignias")
|
||||
@Route("api/v1/org/insignia/insignia")
|
||||
@Tags("Insignia")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
|
|
@ -180,10 +180,9 @@ export class InsigniaController extends Controller {
|
|||
const insigniaAll = await this.insigniaRepository.find({
|
||||
relations: ["insigniaType"],
|
||||
select: ["id", "name", "shortName", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive", "note"],
|
||||
order: { "level": "ASC" }
|
||||
});
|
||||
if (!insigniaAll) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลเครื่องราชอิสริยาภรณ์นี้");
|
||||
}
|
||||
|
||||
const mapInsigniaAll = insigniaAll.map((item) => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
|
|
|
|||
|
|
@ -132,6 +132,22 @@ export class InsigniaTypeController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายการลำดับชั้นเครื่องราชอิสริยาภรณ์ Active
|
||||
*
|
||||
* @summary ORG_ - รายการลำดับชั้นเครื่องราชอิสริยาภรณ์ Active (ADMIN) #
|
||||
*
|
||||
*/
|
||||
@Get("active")
|
||||
async GetInsigniaType_Active() {
|
||||
const insigniaType_Active = await this.insigniaTypeRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"],
|
||||
where: { isActive: true },
|
||||
order: { "name": "ASC" }
|
||||
});
|
||||
return new HttpSuccess(insigniaType_Active);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายละเอียดข้อมูลลำดับชั้นเครื่องราชอิสริยาภรณ์
|
||||
*
|
||||
|
|
@ -142,6 +158,7 @@ export class InsigniaTypeController extends Controller {
|
|||
@Get("{id}")
|
||||
async GetInsigniaTypeById(@Path() id: string) {
|
||||
const insigniaType = await this.insigniaTypeRepository.findOne({
|
||||
relations: ["insignias"],
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"],
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -159,13 +176,10 @@ export class InsigniaTypeController extends Controller {
|
|||
*/
|
||||
@Get("")
|
||||
async GetInsigniaType() {
|
||||
|
||||
const insigniaTypeAll = await this.insigniaTypeRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"]
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"],
|
||||
order: { "name": "ASC" }
|
||||
});
|
||||
if (!insigniaTypeAll) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลลำดับชั้นเครื่องราชอิสริยาภรณ์ นี้");
|
||||
}
|
||||
return new HttpSuccess(insigniaTypeAll);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue