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
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m11s
This commit is contained in:
commit
e8890133bb
4 changed files with 66 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) => ({
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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\``);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue