edit type status profile

This commit is contained in:
kittapath 2025-01-27 10:23:28 +07:00
parent c60beef7e3
commit 9bf7ddf267
4 changed files with 39 additions and 15 deletions

View file

@ -26,6 +26,7 @@ import { Position } from "../entities/Position";
import { Insignia } from "../entities/Insignia";
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
import { PosMaster } from "../entities/PosMaster";
import { EmployeePosDict } from "../entities/EmployeePosDict";
@Route("api/v1/org/dotnet")
@Tags("Dotnet")
@ -43,6 +44,7 @@ export class OrganizationDotnetController extends Controller {
private positionRepository = AppDataSource.getRepository(Position);
private posMasterRepository = AppDataSource.getRepository(PosMaster);
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
/**
* 1. API Search Profile
@ -2366,11 +2368,15 @@ export class OrganizationDotnetController extends Controller {
@Body()
body: {
empPosId: string[];
rootId: string;
},
) {
const findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true },
});
const employeePosDict = await this.employeePosDictRepository.find({
where: { id: In(body.empPosId) },
});
const profiles = await this.profileEmpRepo.find({
relations: [
@ -2387,12 +2393,12 @@ export class OrganizationDotnetController extends Controller {
"current_holders.orgChild3",
"current_holders.orgChild4",
],
where: {
current_holders: {
positions: { id: In(body.empPosId), positionIsSelected: true },
orgRevisionId: findRevision?.id,
},
},
where: employeePosDict.map((entry) => ({
posLevelId: entry.posLevelId,
posTypeId: entry.posTypeId,
position: entry.posDictName,
current_holders: { orgRootId: body.rootId },
})),
order: {
profileSalary: {
date: "DESC",

View file

@ -45,11 +45,10 @@ export class ProfileActposition extends EntityBase {
position: string;
@Column({
nullable: true,
comment: "สถานะ",
default: null,
default: false,
})
status: string;
status: boolean;
@Column({
nullable: true,
@ -80,7 +79,7 @@ export class CreateProfileActposition {
dateEnd: Date | null;
posNo: string | null;
position: string | null;
status: string | null;
status: boolean;
}
export class CreateProfileActpositionEmployee {
@ -89,7 +88,7 @@ export class CreateProfileActpositionEmployee {
dateEnd: Date | null;
posNo: string | null;
position: string | null;
status: string | null;
status: boolean;
}
export type UpdateProfileActposition = {
@ -97,5 +96,5 @@ export type UpdateProfileActposition = {
dateEnd?: Date | null;
posNo?: string | null;
position?: string | null;
status?: string | null;
status: boolean;
};

View file

@ -35,11 +35,10 @@ export class ProfileActpositionHistory extends EntityBase {
position: string;
@Column({
nullable: true,
comment: "สถานะ",
default: null,
default: false,
})
status: string;
status: boolean;
@Column({
nullable: true,

View file

@ -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 'สถานะ'`);
}
}