no message

This commit is contained in:
kittapath 2024-10-16 11:55:45 +07:00
parent ad97270752
commit 3ea2c7c3b0
9 changed files with 420 additions and 35 deletions

View file

@ -5,7 +5,7 @@ import express from "express";
import swaggerUi from "swagger-ui-express";
import swaggerDocument from "./swagger.json";
import * as cron from "node-cron";
import { init as rabbitmqInit } from './services/rabbitmq';
import { init as rabbitmqInit } from "./services/rabbitmq";
import error from "./middlewares/error";
import { AppDataSource } from "./database/data-source";
import { RegisterRoutes } from "./routes";
@ -26,7 +26,7 @@ async function main() {
);
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(logMiddleware);
// app.use(logMiddleware);
app.use("/", express.static("static"));
app.use("/api-docs", swaggerUi.serve, swaggerUi.setup(swaggerDocument));
@ -75,7 +75,7 @@ async function main() {
}
}
runMessageQueue()
runMessageQueue();
}
main();

View file

@ -10,18 +10,20 @@ import { StateOperator } from "../entities/StateOperator";
import { StateOperatorUser } from "../entities/StateOperatorUser";
import CallAPI from "../interfaces/call-api";
import { Profile } from "../entities/Profile";
import { StateUserComment } from "../entities/StateUserComment";
@Route("api/v1/org/workflow")
@Tags("AuthRole")
@Tags("Workflow")
@Security("bearerAuth")
export class WorkflowController extends Controller {
private workflowRepo = AppDataSource.getRepository(Workflow);
private stateRepo = AppDataSource.getRepository(State);
private stateOperatorRepo = AppDataSource.getRepository(StateOperator);
private stateOperatorUserRepo = AppDataSource.getRepository(StateOperatorUser);
private stateUserCommentRepo = AppDataSource.getRepository(StateUserComment);
private profileRepo = AppDataSource.getRepository(Profile);
@Post("check-workflow")
@Post("add-workflow")
public async checkWorkflow(
@Request() req: RequestWithUser,
@Body()
@ -30,7 +32,7 @@ export class WorkflowController extends Controller {
posLevelName: string;
posTypeName: string;
profiles: {
profile: string;
profileId: string;
operator: string;
order: number;
}[];
@ -48,7 +50,7 @@ export class WorkflowController extends Controller {
await Promise.all(
body.profiles.map(async (item) => {
const operatoeUser = new StateOperatorUser();
operatoeUser.profile = item.profile;
operatoeUser.profileId = item.profileId;
operatoeUser.operator = item.operator.trim().toLocaleUpperCase();
operatoeUser.order = item.order;
operatoeUser.workflowId = workflow.id;
@ -76,18 +78,18 @@ export class WorkflowController extends Controller {
body: {
workflowId: string;
stateId: string;
profile: string;
profileId: string;
action: string;
},
) {
const stateOperatorUser = await this.stateOperatorUserRepo.findOne({
where: {
profile: body.profile,
profileId: body.profileId,
workflowId: body.workflowId,
},
});
if (!stateOperatorUser)
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้");
const operator = await this.stateOperatorRepo.findOne({
where: {
@ -95,7 +97,7 @@ export class WorkflowController extends Controller {
state: { id: body.stateId, workflow: { id: body.workflowId } },
},
});
if (!operator) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
if (!operator) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
let isCan = false;
switch (body.action.trim().toLocaleUpperCase()) {
@ -125,13 +127,42 @@ export class WorkflowController extends Controller {
}
}
@Post("check-iscan-all")
public async checkIsCanAll(
@Post("check-state-now")
public async checkStateNow(
@Request() req: RequestWithUser,
@Body()
body: {
workflowId: string;
},
) {
const workflow = await this.workflowRepo.findOne({
where: {
id: body.workflowId,
},
relations: ["stateOperatorUsers"],
});
if (!workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
const state = await this.stateRepo.findOne({
where: {
id: workflow.stateId,
},
relations: ["stateOperators"],
});
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
return new HttpSuccess({
stateId: state.id,
stateNo: state.order,
stateName: state.name,
});
}
@Post("check-user-now")
public async checkUserNow(
@Request() req: RequestWithUser,
@Body()
body: {
workflowId: string;
stateId: string;
},
) {
const profile = await this.profileRepo.findOne({
@ -139,24 +170,68 @@ export class WorkflowController extends Controller {
keycloak: req.user.sub,
},
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
const stateOperatorUser = await this.stateOperatorUserRepo.findOne({
where: {
profile: profile.id,
profileId: profile.id,
workflowId: body.workflowId,
},
});
if (!stateOperatorUser)
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในกระบวนการนี้");
const workflow = await this.workflowRepo.findOne({
where: {
id: body.workflowId,
},
});
if (!workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
const operator = await this.stateOperatorRepo.findOne({
where: {
operator: stateOperatorUser.operator,
state: { id: body.stateId, workflow: { id: body.workflowId } },
stateId: workflow.stateId,
},
relations: ["state"],
});
if (!operator) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
return new HttpSuccess(operator);
if (!operator)
throw new HttpError(HttpStatus.NOT_FOUND, "ผู้ใช้งานนี้ไม่มีหน้าที่ในขั้นตอนนี้");
return new HttpSuccess({
stateId: operator.state.id,
stateNo: operator.state.order,
stateName: operator.state.name,
operator: operator.operator,
can_view: operator.canView,
can_update: operator.canUpdate,
can_operate: operator.canOperate,
can_change_state: operator.canChangeState,
can_delete: operator.canDelete,
can_cancel: operator.canCancel,
});
}
@Post("check-state-all")
public async checkStateAll(
@Request() req: RequestWithUser,
@Body()
body: {
workflowId: string;
},
) {
const state = await this.stateRepo.find({
where: {
workflowId: body.workflowId,
},
order: { stateUserComments: { order: "ASC" } },
relations: ["stateUserComments"],
});
const _state = state.map((x) => ({
stateId: x.id,
stateNo: x.order,
stateName: x.name,
stateUserComments: x.stateUserComments,
}));
return new HttpSuccess(_state);
}
@Post("state-next")
@ -164,16 +239,24 @@ export class WorkflowController extends Controller {
@Request() req: RequestWithUser,
@Body()
body: {
stateId: string;
workflowId: string;
},
) {
const workflow = await this.workflowRepo.findOne({
where: {
id: body.workflowId,
},
relations: ["stateOperatorUsers"],
});
if (!workflow) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่สามารถดำเนินการกระบวนการนี้ได้");
const state = await this.stateRepo.findOne({
where: {
id: body.stateId,
id: workflow.stateId,
},
relations: ["stateOperators", "workflow", "workflow.stateOperatorUsers"],
relations: ["stateOperators"],
});
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
const _state = await this.stateRepo.findOne({
where: {
order: state.order + 1,
@ -182,7 +265,7 @@ export class WorkflowController extends Controller {
relations: ["stateOperators"],
});
//noti
let profileNow = state.workflow.stateOperatorUsers
let profileNow = workflow.stateOperatorUsers
.filter((x) => state.stateOperators.map((s) => s.operator).includes(x.operator))
.map((x) => x.profile);
await new CallAPI()
@ -199,7 +282,7 @@ export class WorkflowController extends Controller {
console.error("Error calling API:", error);
});
if (_state != null) {
let profileNext = state.workflow.stateOperatorUsers
let profileNext = workflow.stateOperatorUsers
.filter((x) => _state.stateOperators.map((s) => s.operator).includes(x.operator))
.map((x) => x.profile);
await new CallAPI()
@ -215,10 +298,13 @@ export class WorkflowController extends Controller {
.catch((error) => {
console.error("Error calling API:", error);
});
workflow.stateId = _state.id;
await this.workflowRepo.save(workflow);
}
return new HttpSuccess({
stateId: _state?.id || null,
stateNo: _state?.order || null,
stateName: _state?.name || null,
stateType: _state?.type || null,
});
@ -237,7 +323,7 @@ export class WorkflowController extends Controller {
id: body.stateId,
},
});
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
const _state = await this.stateRepo.findOne({
where: {
order: state.order - 1,
@ -247,8 +333,162 @@ export class WorkflowController extends Controller {
return new HttpSuccess({
stateId: _state?.id || null,
stateNo: _state?.order || null,
stateName: _state?.name || null,
stateType: _state?.type || null,
});
}
@Post("add-step")
public async addStep(
@Request() req: RequestWithUser,
@Body()
body: {
stateId: string;
profileId: string;
isAcceptSetting: boolean;
isApproveSetting: boolean;
isReasonSetting: boolean;
},
) {
const profile = await this.profileRepo.findOne({
where: {
id: body.profileId,
},
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบผู้ใช้งานนี้");
const state = await this.stateRepo.findOne({
where: {
id: body.stateId,
},
relations: ["stateUserComments"],
});
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
const stateUserComment = new StateUserComment();
stateUserComment.order = state.stateUserComments.length + 1;
stateUserComment.stateId = body.stateId;
stateUserComment.profileId = body.profileId;
stateUserComment.isAcceptSetting = body.isAcceptSetting;
stateUserComment.isApproveSetting = body.isApproveSetting;
stateUserComment.isReasonSetting = body.isReasonSetting;
stateUserComment.createdUserId = req.user.sub;
stateUserComment.createdFullName = req.user.name;
stateUserComment.createdAt = new Date();
stateUserComment.lastUpdateUserId = req.user.sub;
stateUserComment.lastUpdateFullName = req.user.name;
stateUserComment.lastUpdatedAt = new Date();
await this.stateUserCommentRepo.save(stateUserComment);
await new CallAPI()
.PostData(req, "/placement/noti/profiles", {
subject: `ได้รับรายการ`,
body: `ได้รับรายการ`,
receiverUserIds: [body.profileId],
payload: "", //แนบไฟล์
isSendMail: true,
isSendInbox: true,
isSendNotification: true,
})
.catch((error) => {
console.error("Error calling API:", error);
});
return new HttpSuccess();
}
@Post("comment")
public async createcomment(
@Request() req: RequestWithUser,
@Body()
body: {
stateId: string;
isAccept?: boolean | null;
isApprove?: boolean | null;
reason?: string | null;
},
) {
const profile = await this.profileRepo.findOne({
where: {
keycloak: req.user.sub,
},
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
const state = await this.stateRepo.findOne({
where: {
id: body.stateId,
},
});
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
let _null: any = null;
const stateUserComment = new StateUserComment();
stateUserComment.stateId = body.stateId;
stateUserComment.profileId = profile.id;
stateUserComment.isAccept = body.isAccept == null ? _null : body.isAccept;
stateUserComment.isApprove = body.isApprove == null ? _null : body.isAccept;
stateUserComment.reason = body.reason == null ? _null : body.isAccept;
stateUserComment.createdUserId = req.user.sub;
stateUserComment.createdFullName = req.user.name;
stateUserComment.createdAt = new Date();
stateUserComment.lastUpdateUserId = req.user.sub;
stateUserComment.lastUpdateFullName = req.user.name;
stateUserComment.lastUpdatedAt = new Date();
await this.stateUserCommentRepo.save(stateUserComment);
return new HttpSuccess();
}
@Post("comment-state")
public async getCommentState(
@Request() req: RequestWithUser,
@Body()
body: {
stateId: string;
},
) {
const state = await this.stateRepo.findOne({
where: {
id: body.stateId,
},
order: { stateUserComments: { order: "ASC" } },
relations: ["stateUserComments"],
});
if (!state) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลขั้นตอนการอนุมัติ");
return new HttpSuccess(state.stateUserComments);
}
@Post("comment-state-user")
public async getCommentStateUser(
@Request() req: RequestWithUser,
@Body()
body: {
stateId: string;
},
) {
const profile = await this.profileRepo.findOne({
where: {
keycloak: req.user.sub,
},
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งาน");
const stateUserComment = await this.stateUserCommentRepo.findOne({
where: {
profileId: profile.id,
stateId: body.stateId,
},
});
return new HttpSuccess({
isAccept: stateUserComment?.isAccept || null,
isApprove: stateUserComment?.isApprove || null,
reason: stateUserComment?.reason || null,
isAcceptSetting: stateUserComment?.isAcceptSetting || null,
isApproveSetting: stateUserComment?.isApproveSetting || null,
isReasonSetting: stateUserComment?.isReasonSetting || null,
order: stateUserComment?.order || null,
stateId: stateUserComment?.stateId || null,
profileId: stateUserComment?.profileId || null,
});
}
}

View file

@ -32,6 +32,8 @@ import { ProfileDevelopment } from "./ProfileDevelopment";
import { PermissionOrg } from "./PermissionOrg";
import { CommandSend } from "./CommandSend";
import { DevelopmentRequest } from "./DevelopmentRequest";
import { StateOperatorUser } from "./StateOperatorUser";
import { StateUserComment } from "./StateUserComment";
@Entity("profile")
export class Profile extends EntityBase {
@ -378,6 +380,12 @@ export class Profile extends EntityBase {
@OneToMany(() => CommandSend, (v) => v.profile)
commandSends: CommandSend[];
@OneToMany(() => StateOperatorUser, (v) => v.profile)
stateOperatorUsers: StateOperatorUser[];
@OneToMany(() => StateUserComment, (v) => v.profile)
stateUserComments: StateUserComment[];
@ManyToOne(() => PosLevel, (posLevel) => posLevel.profiles)
@JoinColumn({ name: "posLevelId" })
posLevel: PosLevel;

View file

@ -2,6 +2,7 @@ import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { StateOperator } from "./StateOperator";
import { Workflow } from "./Workflow";
import { StateUserComment } from "./StateUserComment";
@Entity("state")
export class State extends EntityBase {
@ -42,4 +43,7 @@ export class State extends EntityBase {
@OneToMany(() => StateOperator, (stateOperator) => stateOperator.state)
stateOperators: StateOperator[];
@OneToMany(() => StateUserComment, (stateUserComment) => stateUserComment.state)
stateUserComments: StateUserComment[];
}

View file

@ -2,6 +2,7 @@ import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { StateOperator } from "./StateOperator";
import { Workflow } from "./Workflow";
import { Profile } from "./Profile";
@Entity("stateOperatorUser")
export class StateOperatorUser extends EntityBase {
@ -13,14 +14,6 @@ export class StateOperatorUser extends EntityBase {
})
operator: string;
@Column({
nullable: true,
comment: "",
length: 255,
default: null,
})
profile: string;
@Column({
nullable: true,
comment: "ลำดับ",
@ -47,4 +40,17 @@ export class StateOperatorUser extends EntityBase {
@ManyToOne(() => Workflow, (workflow) => workflow.stateOperatorUsers)
@JoinColumn({ name: "workflowId" })
workflow: Workflow;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง profile",
type: "uuid",
default: null,
})
profileId: string;
@ManyToOne(() => Profile, (profile) => profile.stateOperatorUsers)
@JoinColumn({ name: "profileId" })
profile: Profile;
}

View file

@ -0,0 +1,79 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { State } from "./State";
import { Profile } from "./Profile";
@Entity("stateUserComment")
export class StateUserComment extends EntityBase {
@Column({
nullable: true,
comment: "เลือกรับทราบ",
default: null,
})
isAccept: boolean;
@Column({
nullable: true,
comment: "เลือกพิจารณา",
default: null,
})
isApprove: boolean;
@Column({
nullable: true,
comment: "แสดงความคิดเห็น",
length: 255,
default: null,
})
reason: string;
@Column({
comment: "เลือกรับทราบ",
default: false,
})
isAcceptSetting: boolean;
@Column({
comment: "เลือกพิจารณา",
default: false,
})
isApproveSetting: boolean;
@Column({
comment: "แสดงความคิดเห็น",
default: false,
})
isReasonSetting: boolean;
@Column({
nullable: true,
comment: "ลำดับ",
default: null,
})
order: number;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง state",
default: null,
})
stateId: string;
@ManyToOne(() => State, (state) => state.stateUserComments)
@JoinColumn({ name: "stateId" })
state: State;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง profile",
type: "uuid",
default: null,
})
profileId: string;
@ManyToOne(() => Profile, (profile) => profile.stateUserComments)
@JoinColumn({ name: "profileId" })
profile: Profile;
}

View file

@ -40,6 +40,14 @@ export class Workflow extends EntityBase {
})
posLevelName: string;
@Column({
nullable: true,
comment: "id state",
length: 100,
default: null,
})
stateId: string;
@Column({
nullable: true,
comment: "ชื่อประเภท",

View file

@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow51729044078594 implements MigrationInterface {
name = 'AddTableWorkflow51729044078594'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` ADD \`stateId\` varchar(100) NULL COMMENT 'id state'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`workflow\` DROP COLUMN \`stateId\``);
}
}

View file

@ -0,0 +1,26 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableWorkflow61729047708690 implements MigrationInterface {
name = 'AddTableWorkflow61729047708690'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` CHANGE \`profile\` \`profileId\` varchar(255) NULL`);
await queryRunner.query(`CREATE TABLE \`stateUserComment\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`isAccept\` tinyint NULL COMMENT 'เลือกรับทราบ', \`isApprove\` tinyint NULL COMMENT 'เลือกพิจารณา', \`reason\` varchar(255) NULL COMMENT 'แสดงความคิดเห็น', \`isAcceptSetting\` tinyint NOT NULL COMMENT 'เลือกรับทราบ' DEFAULT 0, \`isApproveSetting\` tinyint NOT NULL COMMENT 'เลือกพิจารณา' DEFAULT 0, \`isReasonSetting\` tinyint NOT NULL COMMENT 'แสดงความคิดเห็น' DEFAULT 0, \`order\` int NULL COMMENT 'ลำดับ', \`stateId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง state', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`profileId\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
await queryRunner.query(`ALTER TABLE \`stateUserComment\` ADD CONSTRAINT \`FK_f6ed25f165eb356ea5499484452\` FOREIGN KEY (\`stateId\`) REFERENCES \`state\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`stateUserComment\` ADD CONSTRAINT \`FK_f83cf9aef7ece2cddc2bb7c5a55\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD CONSTRAINT \`FK_f64285e5016ad2932f38c8687a1\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP FOREIGN KEY \`FK_f64285e5016ad2932f38c8687a1\``);
await queryRunner.query(`ALTER TABLE \`stateUserComment\` DROP FOREIGN KEY \`FK_f83cf9aef7ece2cddc2bb7c5a55\``);
await queryRunner.query(`ALTER TABLE \`stateUserComment\` DROP FOREIGN KEY \`FK_f6ed25f165eb356ea5499484452\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` DROP COLUMN \`profileId\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` ADD \`profileId\` varchar(255) NULL`);
await queryRunner.query(`DROP TABLE \`stateUserComment\``);
await queryRunner.query(`ALTER TABLE \`stateOperatorUser\` CHANGE \`profileId\` \`profile\` varchar(255) NULL`);
}
}