แก้ ตำแหน่ง โครงสร้าง

This commit is contained in:
kittapath 2024-09-19 15:57:01 +07:00
parent 475d42cbe4
commit d175165cea
8 changed files with 51 additions and 17 deletions

View file

@ -183,6 +183,8 @@ export class CommandController extends Controller {
detailHeader: command.detailHeader,
detailBody: command.detailBody,
detailFooter: command.detailFooter,
commandAffectDate: command.commandAffectDate,
commandExcecuteDate: command.commandExcecuteDate,
commandTypeName: command.commandType?.name || null,
commandSysId: command.commandType?.commandSysId || null,
};
@ -207,6 +209,8 @@ export class CommandController extends Controller {
detailHeader: string | null;
detailBody: string | null;
detailFooter: string | null;
commandAffectDate: Date | null;
commandExcecuteDate: Date | null;
},
@Request() request: RequestWithUser,
) {

View file

@ -54,6 +54,8 @@ export class CommandTypeController extends Controller {
"detailHeader",
"detailBody",
"detailFooter",
"subtitle",
"isAttachment",
"createdAt",
"lastUpdatedAt",
"createdFullName",
@ -114,6 +116,8 @@ export class CommandTypeController extends Controller {
"detailHeader",
"detailBody",
"detailFooter",
"subtitle",
"isAttachment",
],
});
if (!_commandType) {
@ -201,7 +205,7 @@ export class CommandTypeController extends Controller {
_commandType.lastUpdateUserId = request.user.sub;
_commandType.lastUpdateFullName = request.user.name;
_commandType.lastUpdatedAt = new Date();
this.commandTypeRepository.merge(_commandType, requestBody);
Object.assign(_commandType, requestBody);
await this.commandTypeRepository.save(_commandType);
return new HttpSuccess(_commandType.id);
}

View file

@ -633,8 +633,8 @@ export class EmployeePositionController extends Controller {
let _null: any = null;
posMaster.posMasterNo = requestBody.posMasterNo;
posMaster.isDirector = requestBody.isDirector;
posMaster.isStaff = requestBody.isStaff;
posMaster.positionSign = requestBody.positionSign == null ? _null : requestBody.positionSign;
// posMaster.isStaff = requestBody.isStaff == null?_null:requestBody.isStaff;
// posMaster.positionSign = requestBody.positionSign == null ? _null : requestBody.positionSign;
// posMaster.isOfficer = requestBody.isOfficer;
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;

View file

@ -840,9 +840,9 @@ export class PositionController extends Controller {
}
let _null: any = null;
posMaster.isDirector = requestBody.isDirector;
posMaster.isStaff = requestBody.isStaff;
posMaster.isStaff = requestBody.isStaff == null || requestBody.isStaff == undefined ? _null : requestBody.isStaff;
// posMaster.isOfficer = requestBody.isOfficer;
posMaster.positionSign = requestBody.positionSign == null ? _null : requestBody.positionSign;
posMaster.positionSign = requestBody.positionSign == null || requestBody.positionSign == undefined ? _null : requestBody.positionSign;
posMaster.posMasterNo = requestBody.posMasterNo;
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;

View file

@ -74,6 +74,20 @@ export class CommandType extends EntityBase {
})
isActive: boolean;
@Column({
comment: "สถานะบัญชีแนบท้าย",
default: true,
})
isAttachment: boolean;
@Column({
nullable: true,
comment: "คำอธิบาย",
type: "text",
default: null,
})
subtitle: string;
@OneToMany(() => Command, (command) => command.commandType)
commands: Command[];
@ -99,6 +113,12 @@ export class CreateCommandType {
@Column()
commandSysId: string;
@Column()
subtitle: string | null;
@Column()
isAttachment: boolean;
}
export type UpdateCommandType = Partial<CreateCommandType>;

View file

@ -266,15 +266,6 @@ export class CreateEmployeePosMaster {
@Column()
isDirector: boolean;
@Column()
isStaff: boolean;
// @Column()
// isOfficer: boolean;
@Column()
positionSign: string | null;
}
export type UpdateEmployeePosMaster = Partial<EmployeePosMaster>;

View file

@ -277,9 +277,6 @@ export class CreatePosMaster {
@Column()
isStaff: boolean;
// @Column()
// isOfficer: boolean;
@Column()
positionSign: string | null;
}

View file

@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandTypeAddIsAttachment1726736124344 implements MigrationInterface {
name = 'UpdateCommandTypeAddIsAttachment1726736124344'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`isAttachment\` tinyint NOT NULL COMMENT 'สถานะบัญชีแนบท้าย' DEFAULT 1`);
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`subtitle\` text NULL COMMENT 'คำอธิบาย'`);
// await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` ADD \`FLAG_PERSON_TYPE\` text NULL`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
// await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` DROP COLUMN \`FLAG_PERSON_TYPE\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`subtitle\``);
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`isAttachment\``);
}
}