Merge branch 'develop' of github.com:Frappet/hrms-api-org into develop
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m11s

This commit is contained in:
Adisak 2026-02-23 16:46:30 +07:00
commit e8890133bb
4 changed files with 66 additions and 0 deletions

View file

@ -1244,6 +1244,7 @@ export class CommandController extends Controller {
await this.commandSendCCRepository.delete({ commandSendId: In(commandSend.map((x) => x.id)) });
await this.commandReciveRepository.delete({ commandId: command.id });
await this.commandSendRepository.delete({ commandId: command.id });
await this.commandOperatorRepository.delete({ commandId: command.id });
await this.commandRepository.delete(command.id);
return new HttpSuccess();
}

View file

@ -940,6 +940,35 @@ export class EmployeePositionController extends Controller {
return new HttpSuccess(posMaster.id);
}
/**
* @summary (ADMIN)
*/
@Put("master/position-condition/{id}")
async updatePositionCondition(
@Path() id: string,
@Body()
requestBody: {
isCondition: boolean | null;
conditionReason: string | null;
},
@Request() request: RequestWithUser,
) {
await new permission().PermissionUpdate(request, "SYS_POS_CONDITION");
const posMaster = await this.employeePosMasterRepository.findOne({
where: { id: id },
});
if (!posMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
Object.assign(posMaster, requestBody);
posMaster.lastUpdateUserId = request.user.sub;
posMaster.lastUpdateFullName = request.user.name;
posMaster.lastUpdatedAt = new Date();
await this.employeePosMasterRepository.save(posMaster);
return new HttpSuccess();
}
/**
* API
*
@ -1369,6 +1398,8 @@ export class EmployeePositionController extends Controller {
profilePoslevel:
level == null || type == null ? null : `${type.posTypeShortName} ${level.posLevelName}`,
authRoleId: posMaster.authRoleId,
isCondition: posMaster.isCondition,
conditionReason: posMaster.conditionReason,
authRoleName:
authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName,
positions: positions.map((position) => ({

View file

@ -193,6 +193,20 @@ export class EmployeePosMaster extends EntityBase {
})
authRoleId: string;
@Column({
comment: "ตำแหน่งติดเงื่อนไข",
default: false,
})
isCondition: boolean;
@Column({
nullable: true,
comment: "หมายเหตุตำแหน่งติดเงื่อนไข",
type: "text",
default: null,
})
conditionReason: string;
@ManyToOne(() => AuthRole, (authRole) => authRole.posMasterEmps)
@JoinColumn({ name: "authRoleId" })
authRole: AuthRole;

View file

@ -0,0 +1,20 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateEmpPosMasterAddFieldsIsCondition_1771832659308 implements MigrationInterface {
name = 'UpdateEmpPosMasterAddFieldsIsCondition_1771832659308'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD \`isCondition\` tinyint NOT NULL COMMENT 'ตำแหน่งติดเงื่อนไข' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` ADD \`conditionReason\` text NULL COMMENT 'หมายเหตุตำแหน่งติดเงื่อนไข'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP COLUMN \`conditionReason\``);
await queryRunner.query(`ALTER TABLE \`employeePosMaster\` DROP COLUMN \`isCondition\``);
}
}