log sso and comment
This commit is contained in:
parent
9f48e5df1d
commit
577e228165
2 changed files with 55 additions and 24 deletions
|
|
@ -252,30 +252,30 @@ export class OrgChild1Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rootIdExits.orgRootRankSub != "DISTRICT" && rootIdExits.orgRootRankSub != "OFFICE") {
|
// if (rootIdExits.orgRootRankSub != "DISTRICT" && rootIdExits.orgRootRankSub != "OFFICE") {
|
||||||
const chkCode = await this.child1Repository.findOne({
|
// const chkCode = await this.child1Repository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
id: Not(id),
|
// id: Not(id),
|
||||||
orgRevisionId: rootIdExits.orgRevisionId,
|
// orgRevisionId: rootIdExits.orgRevisionId,
|
||||||
orgRootId: requestBody.orgRootId,
|
// orgRootId: requestBody.orgRootId,
|
||||||
orgChild1Code: requestBody.orgChild1Code,
|
// orgChild1Code: requestBody.orgChild1Code,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
if (chkCode != null) {
|
// if (chkCode != null) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "รหัสส่วนราชการนี้มีอยู่ในระบบแล้ว");
|
// throw new HttpError(HttpStatusCode.NOT_FOUND, "รหัสส่วนราชการนี้มีอยู่ในระบบแล้ว");
|
||||||
}
|
// }
|
||||||
const chkShort = await this.child1Repository.findOne({
|
// const chkShort = await this.child1Repository.findOne({
|
||||||
where: {
|
// where: {
|
||||||
id: Not(id),
|
// id: Not(id),
|
||||||
orgRevisionId: rootIdExits.orgRevisionId,
|
// orgRevisionId: rootIdExits.orgRevisionId,
|
||||||
orgRootId: requestBody.orgRootId,
|
// orgRootId: requestBody.orgRootId,
|
||||||
orgChild1ShortName: requestBody.orgChild1ShortName,
|
// orgChild1ShortName: requestBody.orgChild1ShortName,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
if (chkShort != null) {
|
// if (chkShort != null) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "อักษรย่อนี้มีอยู่ในระบบแล้ว");
|
// throw new HttpError(HttpStatusCode.NOT_FOUND, "อักษรย่อนี้มีอยู่ในระบบแล้ว");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// if(requestBody.orgChild1Code == rootIdExits.orgRootCode){
|
// if(requestBody.orgChild1Code == rootIdExits.orgRootCode){
|
||||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "รหัสส่วนราชการนี้ซ้ำกับรหัสหน่วยงาน");
|
// throw new HttpError(HttpStatusCode.NOT_FOUND, "รหัสส่วนราชการนี้ซ้ำกับรหัสหน่วยงาน");
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ import { Brackets, In } from "typeorm";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import { RoleKeycloak } from "../entities/RoleKeycloak";
|
import { RoleKeycloak } from "../entities/RoleKeycloak";
|
||||||
|
import { addLogSequence } from "../interfaces/utils";
|
||||||
// import * as io from "../lib/websocket";
|
// import * as io from "../lib/websocket";
|
||||||
// import elasticsearch from "../elasticsearch";
|
// import elasticsearch from "../elasticsearch";
|
||||||
// import { StorageFolder } from "../interfaces/storage-fs";
|
// import { StorageFolder } from "../interfaces/storage-fs";
|
||||||
|
|
@ -497,6 +498,36 @@ export class KeycloakController extends Controller {
|
||||||
const result = await createGroup(body.name);
|
const result = await createGroup(body.name);
|
||||||
if (!result) throw new Error("Failed. Cannot create group.");
|
if (!result) throw new Error("Failed. Cannot create group.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Post("log/sso")
|
||||||
|
async addLogSSO(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body() body: {
|
||||||
|
text: string,
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
addLogSequence(req, {
|
||||||
|
action: "request",
|
||||||
|
status: "success",
|
||||||
|
description: "connected",
|
||||||
|
request: {
|
||||||
|
response: JSON.stringify(body.text),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return new HttpSuccess();
|
||||||
|
} catch (error) {
|
||||||
|
addLogSequence(req, {
|
||||||
|
action: "request",
|
||||||
|
status: "error",
|
||||||
|
description: "unconnected",
|
||||||
|
request: {
|
||||||
|
response: JSON.stringify(error),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Delete("group/{groupId}")
|
@Delete("group/{groupId}")
|
||||||
async deleteGroup(@Path() groupId: string) {
|
async deleteGroup(@Path() groupId: string) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue