edit type status profile
This commit is contained in:
parent
c60beef7e3
commit
9bf7ddf267
4 changed files with 39 additions and 15 deletions
|
|
@ -26,6 +26,7 @@ import { Position } from "../entities/Position";
|
||||||
import { Insignia } from "../entities/Insignia";
|
import { Insignia } from "../entities/Insignia";
|
||||||
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
|
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
|
||||||
import { PosMaster } from "../entities/PosMaster";
|
import { PosMaster } from "../entities/PosMaster";
|
||||||
|
import { EmployeePosDict } from "../entities/EmployeePosDict";
|
||||||
|
|
||||||
@Route("api/v1/org/dotnet")
|
@Route("api/v1/org/dotnet")
|
||||||
@Tags("Dotnet")
|
@Tags("Dotnet")
|
||||||
|
|
@ -43,6 +44,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
private positionRepository = AppDataSource.getRepository(Position);
|
private positionRepository = AppDataSource.getRepository(Position);
|
||||||
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
||||||
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||||
|
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1. API Search Profile
|
* 1. API Search Profile
|
||||||
|
|
@ -2366,11 +2368,15 @@ export class OrganizationDotnetController extends Controller {
|
||||||
@Body()
|
@Body()
|
||||||
body: {
|
body: {
|
||||||
empPosId: string[];
|
empPosId: string[];
|
||||||
|
rootId: string;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const findRevision = await this.orgRevisionRepo.findOne({
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true },
|
where: { orgRevisionIsCurrent: true },
|
||||||
});
|
});
|
||||||
|
const employeePosDict = await this.employeePosDictRepository.find({
|
||||||
|
where: { id: In(body.empPosId) },
|
||||||
|
});
|
||||||
|
|
||||||
const profiles = await this.profileEmpRepo.find({
|
const profiles = await this.profileEmpRepo.find({
|
||||||
relations: [
|
relations: [
|
||||||
|
|
@ -2387,12 +2393,12 @@ export class OrganizationDotnetController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
where: {
|
where: employeePosDict.map((entry) => ({
|
||||||
current_holders: {
|
posLevelId: entry.posLevelId,
|
||||||
positions: { id: In(body.empPosId), positionIsSelected: true },
|
posTypeId: entry.posTypeId,
|
||||||
orgRevisionId: findRevision?.id,
|
position: entry.posDictName,
|
||||||
},
|
current_holders: { orgRootId: body.rootId },
|
||||||
},
|
})),
|
||||||
order: {
|
order: {
|
||||||
profileSalary: {
|
profileSalary: {
|
||||||
date: "DESC",
|
date: "DESC",
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,10 @@ export class ProfileActposition extends EntityBase {
|
||||||
position: string;
|
position: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
|
||||||
comment: "สถานะ",
|
comment: "สถานะ",
|
||||||
default: null,
|
default: false,
|
||||||
})
|
})
|
||||||
status: string;
|
status: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
@ -80,7 +79,7 @@ export class CreateProfileActposition {
|
||||||
dateEnd: Date | null;
|
dateEnd: Date | null;
|
||||||
posNo: string | null;
|
posNo: string | null;
|
||||||
position: string | null;
|
position: string | null;
|
||||||
status: string | null;
|
status: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateProfileActpositionEmployee {
|
export class CreateProfileActpositionEmployee {
|
||||||
|
|
@ -89,7 +88,7 @@ export class CreateProfileActpositionEmployee {
|
||||||
dateEnd: Date | null;
|
dateEnd: Date | null;
|
||||||
posNo: string | null;
|
posNo: string | null;
|
||||||
position: string | null;
|
position: string | null;
|
||||||
status: string | null;
|
status: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateProfileActposition = {
|
export type UpdateProfileActposition = {
|
||||||
|
|
@ -97,5 +96,5 @@ export type UpdateProfileActposition = {
|
||||||
dateEnd?: Date | null;
|
dateEnd?: Date | null;
|
||||||
posNo?: string | null;
|
posNo?: string | null;
|
||||||
position?: string | null;
|
position?: string | null;
|
||||||
status?: string | null;
|
status: boolean;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,10 @@ export class ProfileActpositionHistory extends EntityBase {
|
||||||
position: string;
|
position: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
|
||||||
comment: "สถานะ",
|
comment: "สถานะ",
|
||||||
default: null,
|
default: false,
|
||||||
})
|
})
|
||||||
status: string;
|
status: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateprofileActpositionaddstatus1737948097408 implements MigrationInterface {
|
||||||
|
name = 'UpdateprofileActpositionaddstatus1737948097408'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileActpositionHistory\` DROP COLUMN \`status\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileActpositionHistory\` ADD \`status\` tinyint NOT NULL COMMENT 'สถานะ' DEFAULT 0`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileActposition\` DROP COLUMN \`status\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileActposition\` ADD \`status\` tinyint NOT NULL COMMENT 'สถานะ' DEFAULT 0`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileActposition\` DROP COLUMN \`status\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileActposition\` ADD \`status\` varchar(255) NULL COMMENT 'สถานะ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileActpositionHistory\` DROP COLUMN \`status\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileActpositionHistory\` ADD \`status\` varchar(255) NULL COMMENT 'สถานะ'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue