update sort date

This commit is contained in:
mamoss 2025-05-13 13:56:01 +07:00
parent 0266dab4ac
commit c1e7ee2542
4 changed files with 32 additions and 28 deletions

View file

@ -12,7 +12,7 @@ import {
Patch,
Put,
} from "tsoa";
import { Not } from "typeorm"
import { Not } from "typeorm";
import HttpSuccess from "../interfaces/http-success";
import HttpError from "../interfaces/http-error";
import HttpStatus from "../interfaces/http-status";
@ -119,14 +119,14 @@ export class ProfileEducationsController extends Controller {
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
if (body.isEducation) {
await this.profileEducationRepo.update(
{ profileId: body.profileId, isEducation: true },
{ isEducation: false }
{ profileId: body.profileId, isEducation: true },
{ isEducation: false },
);
}
if (body.isHigh) {
await this.profileEducationRepo.update(
{ profileId: body.profileId, isHigh: true },
{ isHigh: false }
{ profileId: body.profileId, isHigh: true },
{ isHigh: false },
);
}
const before = null;
@ -170,14 +170,14 @@ export class ProfileEducationsController extends Controller {
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", record.profileId);
if (body.isEducation) {
await this.profileEducationRepo.update(
{ profileId: record.profileId, isEducation: true, id: Not(educationId) },
{ isEducation: false }
{ profileId: record.profileId, isEducation: true, id: Not(educationId) },
{ isEducation: false },
);
}
if (body.isHigh) {
await this.profileEducationRepo.update(
{ profileId: record.profileId, isHigh: true, id: Not(educationId) },
{ isHigh: false }
{ profileId: record.profileId, isHigh: true, id: Not(educationId) },
{ isHigh: false },
);
}
const before = structuredClone(record);
@ -265,6 +265,7 @@ export class ProfileEducationsController extends Controller {
});
const sortLevel = education.map((data) => ({
...data,
id: data.id,
level: requestBody.data.findIndex((x) => x.id == data.id) + 1,
isUse: requestBody.data.find((x) => x.id == data.id)?.isUse ?? false,