update sort date
This commit is contained in:
parent
0266dab4ac
commit
c1e7ee2542
4 changed files with 32 additions and 28 deletions
|
|
@ -309,6 +309,7 @@ export class InsigniaController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
const sortLevel = insignia.map((data) => ({
|
const sortLevel = insignia.map((data) => ({
|
||||||
|
...data,
|
||||||
id: data.id,
|
id: data.id,
|
||||||
level: requestBody.id.indexOf(data.id) + 1,
|
level: requestBody.id.indexOf(data.id) + 1,
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import {
|
||||||
Patch,
|
Patch,
|
||||||
Put,
|
Put,
|
||||||
} from "tsoa";
|
} from "tsoa";
|
||||||
import { Not } from "typeorm"
|
import { Not } from "typeorm";
|
||||||
import HttpSuccess from "../interfaces/http-success";
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
|
|
@ -120,13 +120,13 @@ export class ProfileEducationsController extends Controller {
|
||||||
if (body.isEducation) {
|
if (body.isEducation) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileId: body.profileId, isEducation: true },
|
{ profileId: body.profileId, isEducation: true },
|
||||||
{ isEducation: false }
|
{ isEducation: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (body.isHigh) {
|
if (body.isHigh) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileId: body.profileId, isHigh: true },
|
{ profileId: body.profileId, isHigh: true },
|
||||||
{ isHigh: false }
|
{ isHigh: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const before = null;
|
const before = null;
|
||||||
|
|
@ -171,13 +171,13 @@ export class ProfileEducationsController extends Controller {
|
||||||
if (body.isEducation) {
|
if (body.isEducation) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileId: record.profileId, isEducation: true, id: Not(educationId) },
|
{ profileId: record.profileId, isEducation: true, id: Not(educationId) },
|
||||||
{ isEducation: false }
|
{ isEducation: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (body.isHigh) {
|
if (body.isHigh) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileId: record.profileId, isHigh: true, id: Not(educationId) },
|
{ profileId: record.profileId, isHigh: true, id: Not(educationId) },
|
||||||
{ isHigh: false }
|
{ isHigh: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const before = structuredClone(record);
|
const before = structuredClone(record);
|
||||||
|
|
@ -265,6 +265,7 @@ export class ProfileEducationsController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
const sortLevel = education.map((data) => ({
|
const sortLevel = education.map((data) => ({
|
||||||
|
...data,
|
||||||
id: data.id,
|
id: data.id,
|
||||||
level: requestBody.data.findIndex((x) => x.id == data.id) + 1,
|
level: requestBody.data.findIndex((x) => x.id == data.id) + 1,
|
||||||
isUse: requestBody.data.find((x) => x.id == data.id)?.isUse ?? false,
|
isUse: requestBody.data.find((x) => x.id == data.id)?.isUse ?? false,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import {
|
||||||
Patch,
|
Patch,
|
||||||
Put,
|
Put,
|
||||||
} from "tsoa";
|
} from "tsoa";
|
||||||
import { Not } from "typeorm"
|
import { Not } from "typeorm";
|
||||||
import HttpSuccess from "../interfaces/http-success";
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
|
|
@ -128,13 +128,13 @@ export class ProfileEducationsEmployeeController extends Controller {
|
||||||
if (body.isEducation) {
|
if (body.isEducation) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileEmployeeId: body.profileEmployeeId, isEducation: true },
|
{ profileEmployeeId: body.profileEmployeeId, isEducation: true },
|
||||||
{ isEducation: false }
|
{ isEducation: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (body.isHigh) {
|
if (body.isHigh) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileEmployeeId: body.profileEmployeeId, isHigh: true },
|
{ profileEmployeeId: body.profileEmployeeId, isHigh: true },
|
||||||
{ isHigh: false }
|
{ isHigh: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const before = null;
|
const before = null;
|
||||||
|
|
@ -183,13 +183,13 @@ export class ProfileEducationsEmployeeController extends Controller {
|
||||||
if (body.isEducation) {
|
if (body.isEducation) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileEmployeeId: record.profileEmployeeId, isEducation: true, id: Not(educationId) },
|
{ profileEmployeeId: record.profileEmployeeId, isEducation: true, id: Not(educationId) },
|
||||||
{ isEducation: false }
|
{ isEducation: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (body.isHigh) {
|
if (body.isHigh) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileEmployeeId: record.profileEmployeeId, isHigh: true, id: Not(educationId) },
|
{ profileEmployeeId: record.profileEmployeeId, isHigh: true, id: Not(educationId) },
|
||||||
{ isHigh: false }
|
{ isHigh: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const before = structuredClone(record);
|
const before = structuredClone(record);
|
||||||
|
|
@ -283,6 +283,7 @@ export class ProfileEducationsEmployeeController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
const sortLevel = education.map((data) => ({
|
const sortLevel = education.map((data) => ({
|
||||||
|
...data,
|
||||||
id: data.id,
|
id: data.id,
|
||||||
level: requestBody.data.findIndex((x) => x.id == data.id) + 1,
|
level: requestBody.data.findIndex((x) => x.id == data.id) + 1,
|
||||||
isUse: requestBody.data.find((x) => x.id == data.id)?.isUse ?? false,
|
isUse: requestBody.data.find((x) => x.id == data.id)?.isUse ?? false,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import {
|
||||||
Patch,
|
Patch,
|
||||||
Put,
|
Put,
|
||||||
} from "tsoa";
|
} from "tsoa";
|
||||||
import { Not } from "typeorm"
|
import { Not } from "typeorm";
|
||||||
import HttpSuccess from "../interfaces/http-success";
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
|
|
@ -118,17 +118,17 @@ export class ProfileEducationsEmployeeTempController extends Controller {
|
||||||
if (body.isEducation) {
|
if (body.isEducation) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileEmployeeId: body.profileEmployeeId, isEducation: true },
|
{ profileEmployeeId: body.profileEmployeeId, isEducation: true },
|
||||||
{ isEducation: false }
|
{ isEducation: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (body.isHigh) {
|
if (body.isHigh) {
|
||||||
const existing = await this.profileEducationRepo.find({
|
const existing = await this.profileEducationRepo.find({
|
||||||
where: { profileId: body.profileEmployeeId, isHigh: true },
|
where: { profileId: body.profileEmployeeId, isHigh: true },
|
||||||
});
|
});
|
||||||
console.log("isHigh ",existing)
|
console.log("isHigh ", existing);
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileEmployeeId: body.profileEmployeeId, isHigh: true },
|
{ profileEmployeeId: body.profileEmployeeId, isHigh: true },
|
||||||
{ isHigh: false }
|
{ isHigh: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const before = null;
|
const before = null;
|
||||||
|
|
@ -173,13 +173,13 @@ export class ProfileEducationsEmployeeTempController extends Controller {
|
||||||
if (body.isEducation) {
|
if (body.isEducation) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileEmployeeId: record.profileEmployeeId, isEducation: true, id: Not(educationId) },
|
{ profileEmployeeId: record.profileEmployeeId, isEducation: true, id: Not(educationId) },
|
||||||
{ isEducation: false }
|
{ isEducation: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (body.isHigh) {
|
if (body.isHigh) {
|
||||||
await this.profileEducationRepo.update(
|
await this.profileEducationRepo.update(
|
||||||
{ profileEmployeeId: record.profileEmployeeId, isHigh: true, id: Not(educationId) },
|
{ profileEmployeeId: record.profileEmployeeId, isHigh: true, id: Not(educationId) },
|
||||||
{ isHigh: false }
|
{ isHigh: false },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const before = structuredClone(record);
|
const before = structuredClone(record);
|
||||||
|
|
@ -266,6 +266,7 @@ export class ProfileEducationsEmployeeTempController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
const sortLevel = education.map((data) => ({
|
const sortLevel = education.map((data) => ({
|
||||||
|
...data,
|
||||||
id: data.id,
|
id: data.id,
|
||||||
level: requestBody.data.findIndex((x) => x.id == data.id) + 1,
|
level: requestBody.data.findIndex((x) => x.id == data.id) + 1,
|
||||||
isUse: requestBody.data.find((x) => x.id == data.id)?.isUse ?? false,
|
isUse: requestBody.data.find((x) => x.id == data.id)?.isUse ?? false,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue