delete user in state
This commit is contained in:
parent
4c800c2ef4
commit
b933666c8d
2 changed files with 20 additions and 4 deletions
|
|
@ -16,6 +16,7 @@ import { MetaState } from "../entities/MetaState";
|
|||
import { MetaStateOperator } from "../entities/MetaStateOperator";
|
||||
import { PosMasterAssign } from "../entities/PosMasterAssign";
|
||||
import { PosMaster } from "../entities/PosMaster";
|
||||
import { Not } from "typeorm";
|
||||
|
||||
@Route("api/v1/org/workflow")
|
||||
@Tags("Workflow")
|
||||
|
|
@ -326,19 +327,18 @@ export class WorkflowController extends Controller {
|
|||
system: string;
|
||||
},
|
||||
) {
|
||||
const stateOperatorUser = await this.stateOperatorUserRepo.findOne({
|
||||
const stateOperatorUser = await this.stateOperatorUserRepo.find({
|
||||
where: {
|
||||
workflow: {
|
||||
refId: body.refId,
|
||||
sysName: body.system,
|
||||
},
|
||||
profile: {
|
||||
keycloak: req.user.sub,
|
||||
keycloak: Not(req.user.sub),
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!stateOperatorUser)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้");
|
||||
await this.stateOperatorUserRepo.remove(stateOperatorUser);
|
||||
|
||||
const workflow = await this.workflowRepo.findOne({
|
||||
where: {
|
||||
|
|
|
|||
16
src/migration/1729073909711-add_table_workflow8.ts
Normal file
16
src/migration/1729073909711-add_table_workflow8.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddTableWorkflow81729073909711 implements MigrationInterface {
|
||||
name = 'AddTableWorkflow81729073909711'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`system\``);
|
||||
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`refId\``);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`refId\` varchar(255) NULL COMMENT 'ผู้ดำเนินการ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`system\` varchar(255) NULL COMMENT 'system'`);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue