Merge branch 'develop' into develop-Bright

# Conflicts:
#	src/controllers/ImportDataController.ts
This commit is contained in:
Bright 2024-07-25 16:22:29 +07:00
commit 022cc04e7b
13 changed files with 300 additions and 133 deletions

51
package-lock.json generated
View file

@ -21,6 +21,7 @@
"node-cron": "^3.0.3", "node-cron": "^3.0.3",
"node-xlsx": "^0.24.0", "node-xlsx": "^0.24.0",
"promise.any": "^2.0.6", "promise.any": "^2.0.6",
"redis": "^3.1.2",
"reflect-metadata": "^0.2.1", "reflect-metadata": "^0.2.1",
"swagger-ui-express": "^5.0.0", "swagger-ui-express": "^5.0.0",
"tsoa": "^6.0.1", "tsoa": "^6.0.1",
@ -3478,6 +3479,56 @@
"node": ">=8.10.0" "node": ">=8.10.0"
} }
}, },
"node_modules/redis": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/redis/-/redis-3.1.2.tgz",
"integrity": "sha512-grn5KoZLr/qrRQVwoSkmzdbw6pwF+/rwODtrOr6vuBRiR/f3rjSTGupbF90Zpqm2oenix8Do6RV7pYEkGwlKkw==",
"dependencies": {
"denque": "^1.5.0",
"redis-commands": "^1.7.0",
"redis-errors": "^1.2.0",
"redis-parser": "^3.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/node-redis"
}
},
"node_modules/redis-commands": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz",
"integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ=="
},
"node_modules/redis-errors": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz",
"integrity": "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==",
"engines": {
"node": ">=4"
}
},
"node_modules/redis-parser": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz",
"integrity": "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==",
"dependencies": {
"redis-errors": "^1.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/redis/node_modules/denque": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz",
"integrity": "sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==",
"engines": {
"node": ">=0.10"
}
},
"node_modules/reflect-metadata": { "node_modules/reflect-metadata": {
"version": "0.2.1", "version": "0.2.1",
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.1.tgz", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.1.tgz",

View file

@ -39,6 +39,7 @@
"node-cron": "^3.0.3", "node-cron": "^3.0.3",
"node-xlsx": "^0.24.0", "node-xlsx": "^0.24.0",
"promise.any": "^2.0.6", "promise.any": "^2.0.6",
"redis": "^3.1.2",
"reflect-metadata": "^0.2.1", "reflect-metadata": "^0.2.1",
"swagger-ui-express": "^5.0.0", "swagger-ui-express": "^5.0.0",
"tsoa": "^6.0.1", "tsoa": "^6.0.1",

View file

@ -22,6 +22,8 @@ import { AuthRoleAttr } from "../entities/AuthRoleAttr";
import { PosMaster } from "../entities/PosMaster"; import { PosMaster } from "../entities/PosMaster";
import { EmployeePosMaster } from "../entities/EmployeePosMaster"; import { EmployeePosMaster } from "../entities/EmployeePosMaster";
const REDIS_HOST = process.env.REDIS_HOST;
const REDIS_PORT = process.env.REDIS_PORT;
@Route("api/v1/org/auth/authRole") @Route("api/v1/org/auth/authRole")
@Tags("AuthRole") @Tags("AuthRole")
@Security("bearerAuth") @Security("bearerAuth")
@ -29,7 +31,8 @@ export class AuthRoleController extends Controller {
private authRoleRepo = AppDataSource.getRepository(AuthRole); private authRoleRepo = AppDataSource.getRepository(AuthRole);
private authRoleAttrRepo = AppDataSource.getRepository(AuthRoleAttr); private authRoleAttrRepo = AppDataSource.getRepository(AuthRoleAttr);
private posMasterRepository = AppDataSource.getRepository(PosMaster); private posMasterRepository = AppDataSource.getRepository(PosMaster);
private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster) private employeePosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
private redis = require("redis");
@Get("list") @Get("list")
public async listAuthRole() { public async listAuthRole() {
@ -77,50 +80,51 @@ export class AuthRoleController extends Controller {
} }
@Post("govoment") @Post("govoment")
public async AddAuthRoleGovoment(@Request() req: RequestWithUser, @Body() body: CreateAddAuthRole) { public async AddAuthRoleGovoment(
@Request() req: RequestWithUser,
@Body() body: CreateAddAuthRole,
) {
let NULL_: any = null; let NULL_: any = null;
let getDetail let getDetail;
if (body.authRoleId == "") { if (body.authRoleId == "") {
body.authRoleId = NULL_ body.authRoleId = NULL_;
} } else {
else {
getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId }); getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId });
if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์"); if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
} }
const posMaster = await this.posMasterRepository.findOneBy({ id : body.posMasterId }) const posMaster = await this.posMasterRepository.findOneBy({ id: body.posMasterId });
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง"); if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
posMaster.lastUpdateUserId = req.user.sub; posMaster.lastUpdateUserId = req.user.sub;
posMaster.lastUpdateFullName = req.user.name; posMaster.lastUpdateFullName = req.user.name;
posMaster.authRoleId = body.authRoleId posMaster.authRoleId = body.authRoleId;
await this.posMasterRepository.save(posMaster); await this.posMasterRepository.save(posMaster);
return new HttpSuccess(); return new HttpSuccess();
} }
@Post("employee") @Post("employee")
public async AddAuthRoleEmployee(@Request() req: RequestWithUser, @Body() body: CreateAddAuthRole) { public async AddAuthRoleEmployee(
@Request() req: RequestWithUser,
@Body() body: CreateAddAuthRole,
) {
let NULL_: any = null; let NULL_: any = null;
let getDetail let getDetail;
if (body.authRoleId == "") { if (body.authRoleId == "") {
body.authRoleId = NULL_ body.authRoleId = NULL_;
} } else {
else {
getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId }); getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId });
if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์"); if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
} }
const posMaster = await this.employeePosMasterRepository.findOneBy({ id: body.posMasterId });
const posMaster = await this.employeePosMasterRepository.findOneBy({ id : body.posMasterId })
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง"); if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
posMaster.lastUpdateUserId = req.user.sub; posMaster.lastUpdateUserId = req.user.sub;
posMaster.lastUpdateFullName = req.user.name; posMaster.lastUpdateFullName = req.user.name;
posMaster.authRoleId = body.authRoleId posMaster.authRoleId = body.authRoleId;
await this.employeePosMasterRepository.save(posMaster); await this.employeePosMasterRepository.save(posMaster);
return new HttpSuccess(); return new HttpSuccess();
} }

View file

@ -434,33 +434,33 @@ export class ImportDataController extends Controller {
return new HttpSuccess(result); return new HttpSuccess(result);
} }
// /** /**
// * @summary Import Education Code * @summary Import Education Code
// */ */
// @Post("uploadEducation-Code") @Post("uploadEducation-Code")
// @UseInterceptors(FileInterceptor("file")) @UseInterceptors(FileInterceptor("file"))
// async UploadFileSQLEducationCode( async UploadFileSQLEducationCode(
// @UploadedFile() file: Express.Multer.File, @UploadedFile() file: Express.Multer.File,
// @Request() request: { user: Record<string, any> }, @Request() request: { user: Record<string, any> },
// ) { ) {
// const workbook = xlsx.read(file.buffer, { type: "buffer" }); const workbook = xlsx.read(file.buffer, { type: "buffer" });
// const sheetName = workbook.SheetNames[0] const sheetName = workbook.SheetNames[0]
// const sheet = workbook.Sheets[sheetName]; const sheet = workbook.Sheets[sheetName];
// const getExcel = xlsx.utils.sheet_to_json(sheet); const getExcel = xlsx.utils.sheet_to_json(sheet);
// let educationMis_: any = []; let educationMis_: any = [];
// await Promise.all( await Promise.all(
// getExcel.map(async (item: any) => { getExcel.map(async (item: any) => {
// const educationMis = new EducationMis(); const educationMis = new EducationMis();
// educationMis.EDUCATION_CODE = item.EDUCATION_CODE; educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
// educationMis.EDUCATION_CODE = item.EDUCATION_CODE; educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
// educationMis_.push(educationMis); educationMis_.push(educationMis);
// }), }),
// ); );
// await this.educationMisRepo.save(educationMis_); await this.educationMisRepo.save(educationMis_);
// return new HttpSuccess(educationMis_); return new HttpSuccess(educationMis_);
// } }
// /** // /**
// * API upload EDU // * API upload EDU

View file

@ -9,6 +9,11 @@ import { AuthRole } from "../entities/AuthRole";
import { AuthRoleAttr } from "../entities/AuthRoleAttr"; import { AuthRoleAttr } from "../entities/AuthRoleAttr";
import { PosMaster } from "../entities/PosMaster"; import { PosMaster } from "../entities/PosMaster";
import { Profile } from "../entities/Profile"; import { Profile } from "../entities/Profile";
import { AuthSys } from "../entities/AuthSys";
import { promisify } from "util";
import { In } from "typeorm";
const REDIS_HOST = process.env.REDIS_HOST;
const REDIS_PORT = process.env.REDIS_PORT;
@Route("api/v1/org/permission") @Route("api/v1/org/permission")
@Tags("Permission") @Tags("Permission")
@ -18,9 +23,21 @@ export class PermissionController extends Controller {
private posMasterRepository = AppDataSource.getRepository(PosMaster); private posMasterRepository = AppDataSource.getRepository(PosMaster);
private authRoleRepo = AppDataSource.getRepository(AuthRole); private authRoleRepo = AppDataSource.getRepository(AuthRole);
private authRoleAttrRepo = AppDataSource.getRepository(AuthRoleAttr); private authRoleAttrRepo = AppDataSource.getRepository(AuthRoleAttr);
private authSysRepo = AppDataSource.getRepository(AuthSys);
private redis = require("redis");
@Get("") @Get("")
public async getPermission(@Request() request: { user: Record<string, any> }) { public async getPermission(@Request() request: { user: Record<string, any> }) {
const redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
});
const getAsync = promisify(redisClient.get).bind(redisClient);
let reply = await getAsync("role_" + request.user.sub);
if (reply != null) {
reply = JSON.parse(reply);
} else {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
select: ["id"], select: ["id"],
where: { keycloak: request.user.sub }, where: { keycloak: request.user.sub },
@ -38,7 +55,7 @@ export class PermissionController extends Controller {
} }
const getDetail = await this.authRoleRepo.findOne({ const getDetail = await this.authRoleRepo.findOne({
select: ["roleName", "roleDescription"], select: ["id", "roleName", "roleDescription"],
where: { id: posMaster.authRoleId }, where: { id: posMaster.authRoleId },
}); });
if (!getDetail) { if (!getDetail) {
@ -60,11 +77,83 @@ export class PermissionController extends Controller {
where: { authRoleId: getDetail.id }, where: { authRoleId: getDetail.id },
}); });
const formattedData = { reply = {
...getDetail, ...getDetail,
roleAttributes: roleAttrData, roles: roleAttrData,
}; };
redisClient.set("role_" + request.user.sub, JSON.stringify(reply));
}
return new HttpSuccess(reply);
}
return new HttpSuccess(formattedData); @Get("menu")
public async listAuthSys(@Request() request: { user: Record<string, any> }) {
const redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
});
const getAsync = promisify(redisClient.get).bind(redisClient);
let reply = await getAsync("menu_" + request.user.sub);
if (reply != null) {
reply = JSON.parse(reply);
} else {
console.log(request.user.sub);
const profile = await this.profileRepo.findOne({
select: ["id"],
where: { keycloak: request.user.sub },
});
if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ");
}
const posMaster = await this.posMasterRepository.findOne({
// select: ["authRoleId"],
where: {
current_holderId: profile.id,
orgRevision: {
orgRevisionIsDraft: false,
orgRevisionIsCurrent: true,
},
},
});
if (!posMaster) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งในโครงสร้าง");
}
const authRole = await this.authRoleRepo.findOne({
select: ["id"],
where: { id: posMaster.authRoleId },
});
if (!authRole) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
}
const roleAttrData = await this.authRoleAttrRepo.find({
select: ["authSysId"],
where: { authRoleId: authRole.id },
});
const getList = await this.authSysRepo.find({
select: ["id", "parentId", "sysName", "sysDescription", "icon", "path", "order"],
where: {
id: In(roleAttrData.map((x) => x.authSysId)),
},
});
const reply = getList
.filter((x) => x.parentId == null)
.map((item) => {
return {
...item,
children: getList
.filter((x) => x.parentId == item.id)
.sort((a, b) => a.order - b.order),
};
})
.sort((a, b) => a.order - b.order);
console.log(JSON.stringify(reply));
redisClient.set("menu_" + request.user.sub, 30, JSON.stringify(reply));
}
return new HttpSuccess(reply);
} }
} }

View file

@ -52,26 +52,20 @@ export class ProfileEditEmployeeController extends Controller {
if (status != "" && status != null) { if (status != "" && status != null) {
qb.andWhere("ProfileEdit.status = :status", { status: status }); qb.andWhere("ProfileEdit.status = :status", { status: status });
} }
qb.andWhere("ProfileEdit.profileEmployeeId = :profileEmployeeId", { profileEmployeeId: profile.id }); qb.andWhere("ProfileEdit.profileEmployeeId = :profileEmployeeId", {
profileEmployeeId: profile.id,
});
}) })
.andWhere( .andWhere(
new Brackets((qb) => { new Brackets((qb) => {
qb.where( qb.where(keyword != "" && keyword != null ? "ProfileEdit.topic LIKE :keyword" : "1=1", {
keyword != "" && keyword != null keyword: `%${keyword}%`,
? "ProfileEdit.topic LIKE :keyword" }).orWhere(
: "1=1", keyword != "" && keyword != null ? "ProfileEdit.detail LIKE :keyword" : "1=1",
{ {
keyword: `%${keyword}%`, keyword: `%${keyword}%`,
}, },
) );
.orWhere(
keyword != "" && keyword != null
? "ProfileEdit.detail LIKE :keyword"
: "1=1",
{
keyword: `%${keyword}%`,
},
)
}), }),
) )
.orderBy("ProfileEdit.createdAt", "ASC") .orderBy("ProfileEdit.createdAt", "ASC")
@ -118,22 +112,14 @@ export class ProfileEditEmployeeController extends Controller {
}) })
.andWhere( .andWhere(
new Brackets((qb) => { new Brackets((qb) => {
qb.where( qb.where(keyword != "" && keyword != null ? "ProfileEdit.topic LIKE :keyword" : "1=1", {
keyword != "" && keyword != null keyword: `%${keyword}%`,
? "ProfileEdit.topic LIKE :keyword" }).orWhere(
: "1=1", keyword != "" && keyword != null ? "ProfileEdit.detail LIKE :keyword" : "1=1",
{ {
keyword: `%${keyword}%`, keyword: `%${keyword}%`,
}, },
) );
.orWhere(
keyword != "" && keyword != null
? "ProfileEdit.detail LIKE :keyword"
: "1=1",
{
keyword: `%${keyword}%`,
},
)
}), }),
) )
.orderBy("ProfileEdit.createdAt", "ASC") .orderBy("ProfileEdit.createdAt", "ASC")
@ -162,7 +148,7 @@ export class ProfileEditEmployeeController extends Controller {
} }
@Get("{Id}") @Get("{Id}")
public async detailProfileByIdEdit(@Path() Id: string) { public async detailProfileEmployeeByIdEdit(@Path() Id: string) {
const getProfileEdit = await this.profileEditRepository.findOne({ const getProfileEdit = await this.profileEditRepository.findOne({
where: { id: Id }, where: { id: Id },
}); });
@ -233,7 +219,7 @@ export class ProfileEditEmployeeController extends Controller {
) { ) {
// const record = await this.profileEditRepository.findOneBy({ id: editId }); // const record = await this.profileEditRepository.findOneBy({ id: editId });
const record = await this.profileEditRepository.findOne({ const record = await this.profileEditRepository.findOne({
where: { id: editId } where: { id: editId },
}); });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");

Binary file not shown.

View file

@ -26,10 +26,10 @@ export class AuthRole extends EntityBase {
authRoles: AuthRoleAttr[]; authRoles: AuthRoleAttr[];
@OneToMany(() => PosMaster, (posMaster) => posMaster.authRole) @OneToMany(() => PosMaster, (posMaster) => posMaster.authRole)
posMaster: PosMaster[]; posMasters: PosMaster[];
@OneToMany(() => EmployeePosMaster, (posMasters) => posMasters.authRole) @OneToMany(() => EmployeePosMaster, (posMasters) => posMasters.authRole)
posMasterEmp: EmployeePosMaster[]; posMasterEmps: EmployeePosMaster[];
} }
export class CreateAuthRole { export class CreateAuthRole {

View file

@ -75,9 +75,9 @@ export class AuthRoleAttr extends EntityBase {
}) })
parentNode?: string; parentNode?: string;
// @ManyToOne(() => AuthSys, (authSys) => authSys.authSys) @ManyToOne(() => AuthSys, (authSys) => authSys.authRoleAttrs)
// @JoinColumn({ name: "authSysId" }) @JoinColumn({ name: "authSysId" })
// authRoleAttrForSys: AuthSys; authRoleAttrForSys: AuthSys;
@ManyToOne(() => AuthRole, (authRole) => authRole.authRoles) @ManyToOne(() => AuthRole, (authRole) => authRole.authRoles)
@JoinColumn({ name: "authRoleId" }) @JoinColumn({ name: "authRoleId" })

View file

@ -1,4 +1,12 @@
import { Entity, Column, CreateDateColumn, UpdateDateColumn, PrimaryColumn } from "typeorm"; import {
Entity,
Column,
CreateDateColumn,
UpdateDateColumn,
PrimaryColumn,
OneToMany,
} from "typeorm";
import { AuthRoleAttr } from "./AuthRoleAttr";
@Entity("authSys") @Entity("authSys")
export class AuthSys { export class AuthSys {
@ -80,8 +88,8 @@ export class AuthSys {
}) })
sysDescription: string; sysDescription: string;
// @OneToMany(() => AuthRoleAttr, (authRoleAttr) => authRoleAttr.authRoleAttrForSys) @OneToMany(() => AuthRoleAttr, (authRoleAttr) => authRoleAttr.authRoleAttrForSys)
// authSys: AuthRoleAttr[]; authRoleAttrs: AuthRoleAttr[];
} }
export class CreateAuthSys { export class CreateAuthSys {

View file

@ -180,7 +180,7 @@ export class EmployeePosMaster extends EntityBase {
}) })
authRoleId: string; authRoleId: string;
@ManyToOne(() => AuthRole, (authRole) => authRole.posMasterEmp) @ManyToOne(() => AuthRole, (authRole) => authRole.posMasterEmps)
@JoinColumn({ name: "authRoleId" }) @JoinColumn({ name: "authRoleId" })
authRole: AuthRole; authRole: AuthRole;

View file

@ -180,7 +180,7 @@ export class PosMaster extends EntityBase {
}) })
authRoleId: string; authRoleId: string;
@ManyToOne(() => AuthRole, (authRole) => authRole.posMaster) @ManyToOne(() => AuthRole, (authRole) => authRole.posMasters)
@JoinColumn({ name: "authRoleId" }) @JoinColumn({ name: "authRoleId" })
authRole: AuthRole; authRole: AuthRole;

View file

@ -0,0 +1,28 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableAuthSysAddKey1721872671794 implements MigrationInterface {
name = 'UpdateTableAuthSysAddKey1721872671794'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrOwnership\` \`attrOwnership\` varchar(255) NULL COMMENT 'ความเป็นเจ้าของ (Ownership)'`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsCreate\` \`attrIsCreate\` tinyint NOT NULL COMMENT 'สิทธิ์ดำเนินการ (Permission) การ Create' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsList\` \`attrIsList\` tinyint NOT NULL COMMENT 'สิทธิ์ดำเนินการ (Permission) การ List' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsGet\` \`attrIsGet\` tinyint NOT NULL COMMENT 'สิทธิ์ดำเนินการ (Permission) การ Get' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsUpdate\` \`attrIsUpdate\` tinyint NOT NULL COMMENT 'สิทธิ์ดำเนินการ (Permission) การ Update' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsDelete\` \`attrIsDelete\` tinyint NOT NULL COMMENT 'สิทธิ์ดำเนินการ (Permission) การ Delete' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrPrivilege\` \`attrPrivilege\` varchar(255) NULL COMMENT 'สิทธิการเข้าถึง(Privilege)'`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` ADD CONSTRAINT \`FK_b5b59c60792d518f4f025379dba\` FOREIGN KEY (\`authSysId\`) REFERENCES \`authSys\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` DROP FOREIGN KEY \`FK_b5b59c60792d518f4f025379dba\``);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrPrivilege\` \`attrPrivilege\` varchar(255) NULL`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsDelete\` \`attrIsDelete\` tinyint NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsUpdate\` \`attrIsUpdate\` tinyint NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsGet\` \`attrIsGet\` tinyint NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsList\` \`attrIsList\` tinyint NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrIsCreate\` \`attrIsCreate\` tinyint NOT NULL DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`authRoleAttr\` CHANGE \`attrOwnership\` \`attrOwnership\` varchar(255) NULL`);
}
}