แก้ model
This commit is contained in:
parent
24d0d06b62
commit
19dd52b4c4
4 changed files with 67 additions and 23 deletions
|
|
@ -688,12 +688,18 @@ export class OrganizationController extends Controller {
|
|||
* @summary ORG_039 - ประวัติหน่วยงาน (ADMIN) #42
|
||||
*
|
||||
*/
|
||||
@Get("/history/publish")
|
||||
async GetHistoryPublish(@Query("id") id: string, @Query("type") type: number = 1) {
|
||||
const _data = new Array();
|
||||
if (type == 1) {
|
||||
@Post("/history/publish")
|
||||
async GetHistoryPublish(
|
||||
@Body()
|
||||
requestBody: {
|
||||
id: string;
|
||||
type: number;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
if (requestBody.type == 1) {
|
||||
const orgChild1 = await this.child1Repository.findOne({
|
||||
where: { id: id },
|
||||
where: { id: requestBody.id },
|
||||
});
|
||||
if (!orgChild1) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child1");
|
||||
|
|
@ -710,9 +716,9 @@ export class OrganizationController extends Controller {
|
|||
lastUpdatedAt: item.lastUpdatedAt,
|
||||
}));
|
||||
return new HttpSuccess(_data);
|
||||
} else if (type == 2) {
|
||||
} else if (requestBody.type == 2) {
|
||||
const orgChild2 = await this.child2Repository.findOne({
|
||||
where: { id: id },
|
||||
where: { id: requestBody.id },
|
||||
});
|
||||
if (!orgChild2) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child2");
|
||||
|
|
@ -729,9 +735,9 @@ export class OrganizationController extends Controller {
|
|||
lastUpdatedAt: item.lastUpdatedAt,
|
||||
}));
|
||||
return new HttpSuccess(_data);
|
||||
} else if (type == 3) {
|
||||
} else if (requestBody.type == 3) {
|
||||
const orgChild3 = await this.child3Repository.findOne({
|
||||
where: { id: id },
|
||||
where: { id: requestBody.id },
|
||||
});
|
||||
if (!orgChild3) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child3");
|
||||
|
|
@ -748,9 +754,9 @@ export class OrganizationController extends Controller {
|
|||
lastUpdatedAt: item.lastUpdatedAt,
|
||||
}));
|
||||
return new HttpSuccess(_data);
|
||||
} else if (type == 4) {
|
||||
} else if (requestBody.type == 4) {
|
||||
const orgChild4 = await this.child4Repository.findOne({
|
||||
where: { id: id },
|
||||
where: { id: requestBody.id },
|
||||
});
|
||||
if (!orgChild4) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Child4");
|
||||
|
|
@ -769,7 +775,7 @@ export class OrganizationController extends Controller {
|
|||
return new HttpSuccess(_data);
|
||||
} else {
|
||||
const orgRoot = await this.orgRootRepository.findOne({
|
||||
where: { id: id },
|
||||
where: { id: requestBody.id },
|
||||
});
|
||||
if (!orgRoot) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Root");
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ export class PositionController extends Controller {
|
|||
@Put("master/{id}")
|
||||
@Example({
|
||||
posMasterNoPrefix: "กบ.",
|
||||
posMasterNo: 1,
|
||||
posMasterNo: "1",
|
||||
posMasterNoSuffix: "ช",
|
||||
posId: ["08db9e81-fc46-4e95-8b33-be4ca0016abf", "08db9e81-fc46-4e95-8b33-be4ca0016abf"],
|
||||
orgRootId: "08db9e81-fc46-4e95-8b33-be4ca0016abf",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue