แก้ วันที่ update

This commit is contained in:
kittapath 2024-08-30 18:02:34 +07:00
parent 6d36c9b05f
commit 218886b3f4
83 changed files with 1671 additions and 3483 deletions

View file

@ -22,6 +22,7 @@ export class ProfileAvatarEmployeeController extends Controller {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
const lists = await this.avatarRepository.find({
where: { profileEmployeeId },
order: { createdAt: "ASC" },
});
return new HttpSuccess(lists);
}
@ -30,7 +31,6 @@ export class ProfileAvatarEmployeeController extends Controller {
async getProfile(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", id);
const profile = await this.profileRepository.findOne({
select: ["id", "avatar", "avatarName"],
where: { id },
});
@ -42,7 +42,6 @@ export class ProfileAvatarEmployeeController extends Controller {
@Get("profileEmployeeId-admin/{id}")
async getProfileAdmin(@Path() id: string) {
const profile = await this.profileRepository.findOne({
select: ["id", "avatar", "avatarName"],
where: { id },
});
@ -103,6 +102,8 @@ export class ProfileAvatarEmployeeController extends Controller {
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,
lastUpdateFullName: req.user.name,
createdAt: new Date(),
lastUpdatedAt: new Date(),
};
Object.assign(data, { ...body, ...meta });
@ -141,7 +142,11 @@ export class ProfileAvatarEmployeeController extends Controller {
public async deleteAvatarEmployee(@Path() avatarId: string, @Request() req: RequestWithUser) {
const _record = await this.avatarRepository.findOneBy({ id: avatarId });
if (_record) {
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_EMP", _record.profileEmployeeId);
await new permission().PermissionOrgUserDelete(
req,
"SYS_REGISTRY_EMP",
_record.profileEmployeeId,
);
}
const result = await this.avatarRepository.delete({ id: avatarId });