From b24a900198a2e83d621975fe9d657157de8ffccf Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 6 Mar 2025 18:39:17 +0700 Subject: [PATCH] reverse --- src/controllers/PermissionController.ts | 3 --- src/controllers/ReportController.ts | 8 +++---- src/services/webSocket.ts | 30 ++++++++++++------------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/controllers/PermissionController.ts b/src/controllers/PermissionController.ts index 852b3beb..72b7d671 100644 --- a/src/controllers/PermissionController.ts +++ b/src/controllers/PermissionController.ts @@ -55,7 +55,6 @@ export class PermissionController extends Controller { } let reply = await getAsync("role_" + profile.id); - console.log(">>>reply",reply); if (reply != null) { reply = JSON.parse(reply); } else { @@ -85,12 +84,10 @@ export class PermissionController extends Controller { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์"); } } - console.log(">>>posMaster",posMaster); const getDetail = await this.authRoleRepo.findOne({ select: ["id", "roleName", "roleDescription"], where: { id: posMaster.authRoleId }, }); - console.log(">>>detail",getDetail); if (!getDetail) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index ea0130cc..9fab9ebb 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -31,7 +31,7 @@ import { Profile } from "../entities/Profile"; import { viewRegistryOfficer } from "../entities/view/viewRegistryOfficer"; import { viewRegistryEmployee } from "../entities/view/viewRegistryEmployee"; import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster"; -import { sendWebSocket } from "../services/webSocket"; +// import { sendWebSocket } from "../services/webSocket"; @Route("api/v1/org/report") @Tags("Report") @@ -3539,10 +3539,10 @@ export class ReportController extends Controller { } } } - const metaData = { template: "report2", reportName: "report2", data: { data } }; - sendWebSocket(metaData) + // const metaData = { template: "report2", reportName: "report2", data: { data } }; + // sendWebSocket(metaData) - // return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } }); + return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } }); } /** diff --git a/src/services/webSocket.ts b/src/services/webSocket.ts index 5dd006f0..23062aba 100644 --- a/src/services/webSocket.ts +++ b/src/services/webSocket.ts @@ -1,16 +1,16 @@ -import { WebSocket } from "ws"; -import { wss } from "../app"; +// import { WebSocket } from "ws"; +// import { wss } from "../app"; -export async function sendWebSocket(data:any){ - wss.clients.forEach((client: any) => { - if (client.readyState === WebSocket.OPEN) { - const message = JSON.stringify(data); - console.log("📤 Sending data to client:", message); - client.send(message, (err:any) => { - if (err) { - console.error("❌ Error sending message:", err); - } - }); - } - }); -} \ No newline at end of file +// export async function sendWebSocket(data:any){ +// wss.clients.forEach((client: any) => { +// if (client.readyState === WebSocket.OPEN) { +// const message = JSON.stringify(data); +// console.log("📤 Sending data to client:", message); +// client.send(message, (err:any) => { +// if (err) { +// console.error("❌ Error sending message:", err); +// } +// }); +// } +// }); +// } \ No newline at end of file