Merge branch 'develop' into develop-Bright

This commit is contained in:
Bright 2025-03-04 18:21:57 +07:00
commit 764e07db17
5 changed files with 101 additions and 4 deletions

View file

@ -19,7 +19,7 @@ import HttpError from "../interfaces/http-error";
import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
import { RequestWithUser } from "../middlewares/user";
import { Profile } from "../entities/Profile";
import { LessThan, MoreThan } from "typeorm";
import { In, LessThan, MoreThan } from "typeorm";
import permission from "../interfaces/permission";
import { setLogDataDiff } from "../interfaces/utils";
@Route("api/v1/org/profile/salary")
@ -62,7 +62,7 @@ export class ProfileSalaryController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const record = await this.salaryRepo.find({
where: { profileId: profileId },
where: { profileId: profileId, commandCode: In(["5", "6", "7"]) },
order: { order: "ASC" },
});
return new HttpSuccess(record);
@ -74,7 +74,25 @@ export class ProfileSalaryController extends Controller {
if (_workflow == false)
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const record = await this.salaryRepo.find({
where: { profileId: profileId },
where: {
profileId: profileId,
commandCode: In([
"0",
"9",
"1",
"2",
"3",
"4",
"8",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
]),
},
order: { order: "ASC" },
});
return new HttpSuccess(record);

View file

@ -31,6 +31,9 @@ import { Profile } from "../entities/Profile";
import { viewRegistryOfficer } from "../entities/view/viewRegistryOfficer";
import { viewRegistryEmployee } from "../entities/view/viewRegistryEmployee";
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
import { WebSocket } from "ws";
import { wss } from "../app";
@Route("api/v1/org/report")
@Tags("Report")
@Security("bearerAuth")
@ -3560,7 +3563,21 @@ export class ReportController extends Controller {
}
}
}
return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } });
// console.log(">>",data);
wss.clients.forEach((client: any) => {
if (client.readyState === WebSocket.OPEN) {
const message = JSON.stringify({ template: "report2", reportName: "report2", data: { data } });
console.log("📤 Sending data to client:", message);
client.send(message, (err:any) => {
if (err) {
console.error("❌ Error sending message:", err);
}
});
}
});
// return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } });
}
/**