noti admin
This commit is contained in:
parent
07e1a94da0
commit
8d5b125dd0
1 changed files with 56 additions and 14 deletions
|
|
@ -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,20 +229,23 @@ 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.map((item) => ({
|
educations && educations.length > 0
|
||||||
institute: item.institute ? item.institute : "-",
|
? educations.map((item) => ({
|
||||||
date:
|
institute: item.institute ? item.institute : "-",
|
||||||
item.startDate && item.endDate
|
date:
|
||||||
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
|
item.startDate && item.endDate
|
||||||
: "-",
|
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
|
||||||
degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-",
|
: "-",
|
||||||
}))
|
degree: item.degree && item.field ? `${item.degree} ${item.field}` : "-",
|
||||||
: [{
|
}))
|
||||||
institute: "-",
|
: [
|
||||||
date: "-",
|
{
|
||||||
degree: "-",
|
institute: "-",
|
||||||
}]
|
date: "-",
|
||||||
|
degree: "-",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const mapData = {
|
const mapData = {
|
||||||
// Id: profile.id,
|
// Id: profile.id,
|
||||||
|
|
@ -7874,4 +7878,42 @@ export class ProfileController extends Controller {
|
||||||
]);
|
]);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
@Post("state-next")
|
||||||
|
public async stateNext(
|
||||||
|
@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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue