This commit is contained in:
AdisakKanthawilang 2025-03-07 12:36:03 +07:00
parent 9d167d0050
commit 3344826fb9
2 changed files with 26 additions and 20 deletions

View file

@ -77,6 +77,9 @@ import { ProfileActposition } from "../entities/ProfileActposition";
import { ProfileDuty } from "../entities/ProfileDuty"; import { ProfileDuty } from "../entities/ProfileDuty";
import { ProfileAssessment } from "../entities/ProfileAssessment"; import { ProfileAssessment } from "../entities/ProfileAssessment";
import { ProfileAbility } from "../entities/ProfileAbility"; import { ProfileAbility } from "../entities/ProfileAbility";
import { sendWebSocket } from "../services/webSocket";
@Route("api/v1/org/profile") @Route("api/v1/org/profile")
@Tags("Profile") @Tags("Profile")
@Security("bearerAuth") @Security("bearerAuth")
@ -1643,12 +1646,15 @@ export class ProfileController extends Controller {
profileAbility, profileAbility,
otherIncome otherIncome
}; };
const metaData = { template: "new_kk1",
return new HttpSuccess({
template: "new_kk1",
reportName: "docx-report", reportName: "docx-report",
data: data, data: data};
}); sendWebSocket(metaData)
// return new HttpSuccess({
// template: "new_kk1",
// reportName: "docx-report",
// data: data,
// });
} }
/** /**

View file

@ -1,16 +1,16 @@
// import { WebSocket } from "ws"; import { WebSocket } from "ws";
// import { wss } from "../app"; import { wss } from "../app";
// export async function sendWebSocket(data:any){ export async function sendWebSocket(data:any){
// wss.clients.forEach((client: any) => { wss.clients.forEach((client: any) => {
// if (client.readyState === WebSocket.OPEN) { if (client.readyState === WebSocket.OPEN) {
// const message = JSON.stringify(data); const message = JSON.stringify(data);
// console.log("📤 Sending data to client:", message); console.log("📤 Sending data to client:", message);
// client.send(message, (err:any) => { client.send(message, (err:any) => {
// if (err) { if (err) {
// console.error("❌ Error sending message:", err); console.error("❌ Error sending message:", err);
// } }
// }); });
// } }
// }); });
// } }