Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-11-12 17:11:31 +07:00
commit da9e89147c
4 changed files with 72 additions and 28 deletions

View file

@ -3451,6 +3451,7 @@ export class CommandController extends Controller {
posMasterId: posMaster.id, posMasterId: posMaster.id,
positionIsSelected: true, positionIsSelected: true,
}, },
relations: ["posType", "posLevel"]
}); });
const dest_item = await this.salaryRepo.findOne({ const dest_item = await this.salaryRepo.findOne({
where: { profileId: profile?.id }, where: { profileId: profile?.id },
@ -3468,8 +3469,8 @@ export class CommandController extends Controller {
mouthSalaryAmount: item.mouthSalaryAmount, mouthSalaryAmount: item.mouthSalaryAmount,
posNo: shortName ?? null, posNo: shortName ?? null,
position: position?.positionName ?? null, position: position?.positionName ?? null,
positionType: position?.posTypeId ?? null, positionType: position?.posType.posTypeName ?? null,
positionLevel: position?.posLevelId ?? null, positionLevel: position?.posLevel.posLevelName ?? null,
refCommandNo: `${item.commandNo}/${Extension.ToThaiYear(item.commandYear)}`, refCommandNo: `${item.commandNo}/${Extension.ToThaiYear(item.commandYear)}`,
templateDoc: item.templateDoc, templateDoc: item.templateDoc,
order: dest_item == null ? 1 : dest_item.order + 1, order: dest_item == null ? 1 : dest_item.order + 1,
@ -3521,13 +3522,13 @@ export class CommandController extends Controller {
body: { body: {
refIds: { refIds: {
refId: string; refId: string;
commandAffectDate: Date | null; // commandAffectDate: Date | null;
commandNo: string | null; // commandNo: string | null;
commandYear: number; // commandYear: number;
templateDoc: string | null; // templateDoc: string | null;
amount: Double | null; // amount: Double | null;
positionSalaryAmount: Double | null; // positionSalaryAmount: Double | null;
mouthSalaryAmount: Double | null; // mouthSalaryAmount: Double | null;
}[]; }[];
}, },
) { ) {

View file

@ -69,6 +69,7 @@ import { ProfileFamilyMotherHistory } from "../entities/ProfileFamilyMotherHisto
import { ProfileFamilyCoupleHistory } from "../entities/ProfileFamilyCoupleHistory"; import { ProfileFamilyCoupleHistory } from "../entities/ProfileFamilyCoupleHistory";
import { viewDirector } from "../entities/view/viewDirector"; import { viewDirector } from "../entities/view/viewDirector";
import { viewDirectorActing } from "../entities/view/viewDirectorActing"; import { viewDirectorActing } from "../entities/view/viewDirectorActing";
import CallAPI from "../interfaces/call-api";
@Route("api/v1/org/profile") @Route("api/v1/org/profile")
@Tags("Profile") @Tags("Profile")
@Security("bearerAuth") @Security("bearerAuth")
@ -228,7 +229,8 @@ export class ProfileController extends Controller {
where: { profileId: id }, where: { profileId: id },
order: { lastUpdatedAt: "DESC" }, order: { lastUpdatedAt: "DESC" },
}); });
const Education = educations && educations.length > 0 const Education =
educations && educations.length > 0
? educations.map((item) => ({ ? educations.map((item) => ({
institute: item.institute ? item.institute : "-", institute: item.institute ? item.institute : "-",
date: date:
@ -237,11 +239,13 @@ export class ProfileController extends Controller {
: "-", : "-",
degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-", degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-",
})) }))
: [{ : [
{
institute: "-", institute: "-",
date: "-", date: "-",
degree: "-", degree: "-",
}] },
];
const mapData = { const mapData = {
// Id: profile.id, // Id: profile.id,
@ -7874,4 +7878,43 @@ export class ProfileController extends Controller {
]); ]);
return new HttpSuccess(); return new HttpSuccess();
} }
@Post("noti-admin")
public async notiAllAdmin(
@Request() req: RequestWithUser,
@Body()
body: {
subject: string;
body: string;
},
) {
if (!req.user.role.includes("SUPER_ADMIN"))
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ส่งข้อความ");
const profileNoti = await this.profileRepo.find({
where: {
roleKeycloaks: {
name: "ADMIN",
},
},
});
profileNoti.map((x) => ({
receiverUserId: x.id,
notiLink: "",
}));
await new CallAPI()
.PostData(req, "/placement/noti/profiles", {
subject: body.subject,
body: body.body,
receiverUserIds: profileNoti,
payload: "", //แนบไฟล์
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.catch((error) => {
console.error("Error calling API:", error);
});
return new HttpSuccess();
}
} }

View file

@ -120,9 +120,9 @@ export class CreateProfileLeave {
dateLeaveStart: Date | null; dateLeaveStart: Date | null;
dateLeaveEnd: Date | null; dateLeaveEnd: Date | null;
leaveDays: number | null; leaveDays: number | null;
leaveCount: number | null; leaveCount?: number | null;
totalLeave: number | null; totalLeave?: number | null;
status: string | null; status?: string | null;
reason: string | null; reason: string | null;
} }

View file

@ -194,7 +194,7 @@ export class CreateProfileSalary {
positionType: string | null; positionType: string | null;
positionLevel: string | null; positionLevel: string | null;
refCommandNo: string | null; refCommandNo: string | null;
commandId: string | null; commandId?: string | null;
// commandType?: string | null; // commandType?: string | null;
templateDoc: string | null; templateDoc: string | null;
isGovernment?: boolean | null; isGovernment?: boolean | null;
@ -204,7 +204,7 @@ export class CreateProfileSalaryEmployee {
profileEmployeeId: string | null; profileEmployeeId: string | null;
date?: Date | null; date?: Date | null;
amount?: Double | null; amount?: Double | null;
commandId: string | null; commandId?: string | null;
positionSalaryAmount?: Double | null; positionSalaryAmount?: Double | null;
mouthSalaryAmount?: Double | null; mouthSalaryAmount?: Double | null;
posNo: string | null; posNo: string | null;