From 6165763a0bfe20e834d2f7b75b358fe567cad1f3 Mon Sep 17 00:00:00 2001 From: ashar Date: Wed, 5 Jun 2024 14:37:03 +0700 Subject: [PATCH] feat(format) formatting --- src/app.module.ts | 7 +- .../usecase/managers/base-create.manager.ts | 9 ++- .../domain/exceptions/handled-exception.ts | 28 ++++---- src/database/migrations/1717560799195-log.ts | 19 +++++ src/database/ormconfig.ts | 2 +- .../log/data/models/error-log.model.ts | 61 ++++++++-------- .../log/data/models/log.model.ts | 70 +++++++++---------- .../log/data/services/error-log.service.ts | 28 ++++---- .../log/data/services/log.service.ts | 28 ++++---- .../log/domain/entities/error-log.entity.ts | 20 +++--- .../log/domain/entities/error-log.event.ts | 6 +- .../log/domain/entities/log.entity.ts | 26 +++---- .../log/domain/entities/log.event.ts | 6 +- .../log/domain/handlers/error-log.handler.ts | 16 ++--- .../log/domain/handlers/log.handler.ts | 13 ++-- src/modules/configuration/log/log.module.ts | 51 +++++++------- .../user-privilege-change-status.event.ts | 2 +- ...ivilege-configuration-data.orchestrator.ts | 5 +- .../user-privilege-data.orchestrator.ts | 25 +++++-- 19 files changed, 228 insertions(+), 194 deletions(-) create mode 100644 src/database/migrations/1717560799195-log.ts diff --git a/src/app.module.ts b/src/app.module.ts index e393a90..05bbc98 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -33,12 +33,7 @@ import { LogModule } from './modules/configuration/log/log.module'; username: process.env.DEFAULT_DB_USER, password: process.env.DEFAULT_DB_PASS, database: process.env.DEFAULT_DB_NAME, - entities: [ - ...UserPrivilegeModels, - UserModel, - LogModel, - ErrorLogModel, - ], + entities: [...UserPrivilegeModels, UserModel, LogModel, ErrorLogModel], synchronize: false, }), CqrsModule, diff --git a/src/core/modules/domain/usecase/managers/base-create.manager.ts b/src/core/modules/domain/usecase/managers/base-create.manager.ts index aee4ad4..9bf8f20 100644 --- a/src/core/modules/domain/usecase/managers/base-create.manager.ts +++ b/src/core/modules/domain/usecase/managers/base-create.manager.ts @@ -39,7 +39,7 @@ export abstract class BaseCreateManager extends BaseManager { this.entityTarget, this.data, ); - + this.publishEvents(); } @@ -50,9 +50,8 @@ export abstract class BaseCreateManager extends BaseManager { }, }); } - + async publishEvents() { - this.eventBus.publish( new RecordLog({ id: this.result['id'], @@ -62,8 +61,8 @@ export abstract class BaseCreateManager extends BaseManager { description: '', module: this.tableName, op: OPERATION.CREATE, - }) - ) + }), + ); // if (!this.eventTopics.length) return; } diff --git a/src/core/response/domain/exceptions/handled-exception.ts b/src/core/response/domain/exceptions/handled-exception.ts index 47d1433..63e5d0d 100644 --- a/src/core/response/domain/exceptions/handled-exception.ts +++ b/src/core/response/domain/exceptions/handled-exception.ts @@ -7,15 +7,13 @@ import { } from '@nestjs/common'; import { EventBus } from '@nestjs/cqrs'; import { Response } from 'express'; +import { apm } from 'src/core/apm'; import { OPERATION } from 'src/core/strings/constants/base.constants'; import { RecordErrorLog } from 'src/modules/configuration/log/domain/entities/error-log.event'; @Catch() export class HttpExceptionFilter implements ExceptionFilter { - - constructor( - private eventBus: EventBus, - ) {} + constructor(private eventBus: EventBus) {} catch(exception: any, host: ArgumentsHost) { const ctx = host.switchToHttp(); @@ -49,17 +47,17 @@ export class HttpExceptionFilter implements ExceptionFilter { }; } - this.eventBus.publish( - new RecordErrorLog({ - id: '', - old: null, - data: null, - user: null, - description: '', - module: null, - op: OPERATION.CREATE, - }) - ) + // this.eventBus.publish( + // new RecordErrorLog({ + // id: '', + // old: null, + // data: null, + // user: null, + // description: '', + // module: null, + // op: OPERATION.CREATE, + // }), + // ); response.status(status).json(body); } diff --git a/src/database/migrations/1717560799195-log.ts b/src/database/migrations/1717560799195-log.ts new file mode 100644 index 0000000..72eff42 --- /dev/null +++ b/src/database/migrations/1717560799195-log.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class Log1717560799195 implements MigrationInterface { + name = 'Log1717560799195'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "logs" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "data_id" character varying, "module" character varying, "sub_module" character varying, "description" text, "process" character varying NOT NULL DEFAULT 'Create', "data" json, "old_data" json, "created_at" bigint, "creator_name" character varying, "creator_id" character varying, CONSTRAINT "PK_fb1b805f2f7795de79fa69340ba" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `CREATE TABLE "log_errors" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "data_id" character varying, "module" character varying, "sub_module" character varying, "description" text, "message" json, "created_at" bigint, "creator_name" character varying, "creator_id" character varying, CONSTRAINT "PK_d268ea9ac1074d41949daaae79d" PRIMARY KEY ("id"))`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE "log_errors"`); + await queryRunner.query(`DROP TABLE "logs"`); + } +} diff --git a/src/database/ormconfig.ts b/src/database/ormconfig.ts index 6c89427..e0dadf5 100644 --- a/src/database/ormconfig.ts +++ b/src/database/ormconfig.ts @@ -9,7 +9,7 @@ export const connectionSource = new DataSource({ username: process.env.DEFAULT_DB_USER, password: process.env.DEFAULT_DB_PASS, database: process.env.DEFAULT_DB_NAME, - entities: ['src/modules/user-related/**/data/models/*.ts'], + entities: ['src/modules/**/**/data/models/*.ts'], migrationsTableName: 'migrations', migrations: ['src/database/migrations/*.ts'], synchronize: false, diff --git a/src/modules/configuration/log/data/models/error-log.model.ts b/src/modules/configuration/log/data/models/error-log.model.ts index 0ae07d4..cc61ccf 100644 --- a/src/modules/configuration/log/data/models/error-log.model.ts +++ b/src/modules/configuration/log/data/models/error-log.model.ts @@ -1,29 +1,34 @@ -import { BaseCoreModel } from "src/core/modules/data/model/base-core.model"; -import { ErrorLogEntity } from "../../domain/entities/error-log.entity"; -import { Column } from "typeorm"; +import { BaseCoreModel } from 'src/core/modules/data/model/base-core.model'; +import { ErrorLogEntity } from '../../domain/entities/error-log.entity'; +import { Column, Entity } from 'typeorm'; +import { TABLE_NAME } from 'src/core/strings/constants/table.constants'; -export class ErrorLogModel extends BaseCoreModel implements ErrorLogEntity { - @Column('varchar', { name: 'data_id', nullable: true }) - data_id: string; - - @Column('varchar', { name: 'module', nullable: true }) - module: string; - - @Column('varchar', { name: 'sub_module', nullable: true }) - sub_module: string; - - @Column('text', { name: 'description', nullable: true }) - description: string; - - @Column('json', { name: 'message', nullable: true }) - message: string; - - @Column('bigint', { name: 'created_at', nullable: true }) - created_at: number; - - @Column('varchar', { name: 'creator_name', nullable: true }) - creator_name: string; - - @Column('varchar', { name: 'creator_id', nullable: true }) - creator_id: string; -} \ No newline at end of file +@Entity(TABLE_NAME.ERROR_LOG) +export class ErrorLogModel + extends BaseCoreModel + implements ErrorLogEntity +{ + @Column('varchar', { name: 'data_id', nullable: true }) + data_id: string; + + @Column('varchar', { name: 'module', nullable: true }) + module: string; + + @Column('varchar', { name: 'sub_module', nullable: true }) + sub_module: string; + + @Column('text', { name: 'description', nullable: true }) + description: string; + + @Column('json', { name: 'message', nullable: true }) + message: string; + + @Column('bigint', { name: 'created_at', nullable: true }) + created_at: number; + + @Column('varchar', { name: 'creator_name', nullable: true }) + creator_name: string; + + @Column('varchar', { name: 'creator_id', nullable: true }) + creator_id: string; +} diff --git a/src/modules/configuration/log/data/models/log.model.ts b/src/modules/configuration/log/data/models/log.model.ts index 8c8a72e..1979cc8 100644 --- a/src/modules/configuration/log/data/models/log.model.ts +++ b/src/modules/configuration/log/data/models/log.model.ts @@ -1,38 +1,38 @@ -import { BaseCoreModel } from "src/core/modules/data/model/base-core.model"; -import { LogEntity } from "../../domain/entities/log.entity"; -import { Column, Entity } from "typeorm"; -import { OPERATION } from "src/core/strings/constants/base.constants"; -import { TABLE_NAME } from "src/core/strings/constants/table.constants"; +import { BaseCoreModel } from 'src/core/modules/data/model/base-core.model'; +import { LogEntity } from '../../domain/entities/log.entity'; +import { Column, Entity } from 'typeorm'; +import { OPERATION } from 'src/core/strings/constants/base.constants'; +import { TABLE_NAME } from 'src/core/strings/constants/table.constants'; @Entity(TABLE_NAME.LOG) export class LogModel extends BaseCoreModel implements LogEntity { - @Column('varchar', { name: 'data_id', nullable: true }) - data_id: string; - - @Column('varchar', { name: 'module', nullable: true }) - module: string; - - @Column('varchar', { name: 'sub_module', nullable: true }) - sub_module: string; - - @Column('text', { name: 'description', nullable: true }) - description: string; - - @Column('varchar', { name: 'process', default: OPERATION.CREATE }) - process: OPERATION; - - @Column('json', { name: 'data', nullable: true }) - data: any; - - @Column('json', { name: 'old_data', nullable: true }) - old_data: any; - - @Column('bigint', { name: 'created_at', nullable: true }) - created_at: number; - - @Column('varchar', { name: 'creator_name', nullable: true }) - creator_name: string; - - @Column('varchar', { name: 'creator_id', nullable: true }) - creator_id: string; -} \ No newline at end of file + @Column('varchar', { name: 'data_id', nullable: true }) + data_id: string; + + @Column('varchar', { name: 'module', nullable: true }) + module: string; + + @Column('varchar', { name: 'sub_module', nullable: true }) + sub_module: string; + + @Column('text', { name: 'description', nullable: true }) + description: string; + + @Column('varchar', { name: 'process', default: OPERATION.CREATE }) + process: OPERATION; + + @Column('json', { name: 'data', nullable: true }) + data: any; + + @Column('json', { name: 'old_data', nullable: true }) + old_data: any; + + @Column('bigint', { name: 'created_at', nullable: true }) + created_at: number; + + @Column('varchar', { name: 'creator_name', nullable: true }) + creator_name: string; + + @Column('varchar', { name: 'creator_id', nullable: true }) + creator_id: string; +} diff --git a/src/modules/configuration/log/data/services/error-log.service.ts b/src/modules/configuration/log/data/services/error-log.service.ts index eaa242e..df387f0 100644 --- a/src/modules/configuration/log/data/services/error-log.service.ts +++ b/src/modules/configuration/log/data/services/error-log.service.ts @@ -1,17 +1,17 @@ -import { BaseDataService } from "src/core/modules/data/service/base-data.service"; -import { ErrorLogEntity } from "../../domain/entities/error-log.entity"; -import { Injectable } from "@nestjs/common"; -import { InjectRepository } from "@nestjs/typeorm"; -import { ErrorLogModel } from "../models/error-log.model"; -import { Repository } from "typeorm"; -import { CONNECTION_NAME } from "src/core/strings/constants/base.constants"; +import { BaseDataService } from 'src/core/modules/data/service/base-data.service'; +import { ErrorLogEntity } from '../../domain/entities/error-log.entity'; +import { Injectable } from '@nestjs/common'; +import { InjectRepository } from '@nestjs/typeorm'; +import { ErrorLogModel } from '../models/error-log.model'; +import { Repository } from 'typeorm'; +import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants'; @Injectable() export class ErrorLogService extends BaseDataService { - constructor( - @InjectRepository(ErrorLogModel, CONNECTION_NAME.DEFAULT) - private repo: Repository, - ) { - super(repo); - } -} \ No newline at end of file + constructor( + @InjectRepository(ErrorLogModel, CONNECTION_NAME.DEFAULT) + private repo: Repository, + ) { + super(repo); + } +} diff --git a/src/modules/configuration/log/data/services/log.service.ts b/src/modules/configuration/log/data/services/log.service.ts index 21ffa6c..602eb23 100644 --- a/src/modules/configuration/log/data/services/log.service.ts +++ b/src/modules/configuration/log/data/services/log.service.ts @@ -1,17 +1,17 @@ -import { Injectable } from "@nestjs/common"; -import { BaseDataService } from "src/core/modules/data/service/base-data.service"; -import { LogEntity } from "../../domain/entities/log.entity"; -import { LogModel } from "../models/log.model"; -import { InjectRepository } from "@nestjs/typeorm"; -import { CONNECTION_NAME } from "src/core/strings/constants/base.constants"; -import { Repository } from "typeorm"; +import { Injectable } from '@nestjs/common'; +import { BaseDataService } from 'src/core/modules/data/service/base-data.service'; +import { LogEntity } from '../../domain/entities/log.entity'; +import { LogModel } from '../models/log.model'; +import { InjectRepository } from '@nestjs/typeorm'; +import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants'; +import { Repository } from 'typeorm'; @Injectable() export class LogService extends BaseDataService { - constructor( - @InjectRepository(LogModel, CONNECTION_NAME.DEFAULT) - private repo: Repository, - ) { - super(repo); - } -} \ No newline at end of file + constructor( + @InjectRepository(LogModel, CONNECTION_NAME.DEFAULT) + private repo: Repository, + ) { + super(repo); + } +} diff --git a/src/modules/configuration/log/domain/entities/error-log.entity.ts b/src/modules/configuration/log/domain/entities/error-log.entity.ts index a6eb640..7ecfcab 100644 --- a/src/modules/configuration/log/domain/entities/error-log.entity.ts +++ b/src/modules/configuration/log/domain/entities/error-log.entity.ts @@ -1,12 +1,12 @@ -import { BaseCoreEntity } from "src/core/modules/domain/entities/base-core.entity"; +import { BaseCoreEntity } from 'src/core/modules/domain/entities/base-core.entity'; export interface ErrorLogEntity extends BaseCoreEntity { - data_id: string; - message: string; - description: string; - module: string; - sub_module: string; - created_at: number; - creator_name: string; - creator_id: string; -} \ No newline at end of file + data_id: string; + message: string; + description: string; + module: string; + sub_module: string; + created_at: number; + creator_name: string; + creator_id: string; +} diff --git a/src/modules/configuration/log/domain/entities/error-log.event.ts b/src/modules/configuration/log/domain/entities/error-log.event.ts index ffbc10d..c01ed23 100644 --- a/src/modules/configuration/log/domain/entities/error-log.event.ts +++ b/src/modules/configuration/log/domain/entities/error-log.event.ts @@ -1,5 +1,5 @@ -import { IEvent } from "src/core/strings/constants/interface.constants"; +import { IEvent } from 'src/core/strings/constants/interface.constants'; export class RecordErrorLog { - constructor(public readonly data: IEvent) {} -} \ No newline at end of file + constructor(public readonly data: IEvent) {} +} diff --git a/src/modules/configuration/log/domain/entities/log.entity.ts b/src/modules/configuration/log/domain/entities/log.entity.ts index 5267a08..9eb884c 100644 --- a/src/modules/configuration/log/domain/entities/log.entity.ts +++ b/src/modules/configuration/log/domain/entities/log.entity.ts @@ -1,15 +1,15 @@ -import { BaseCoreEntity } from "src/core/modules/domain/entities/base-core.entity"; -import { OPERATION } from "src/core/strings/constants/base.constants"; +import { BaseCoreEntity } from 'src/core/modules/domain/entities/base-core.entity'; +import { OPERATION } from 'src/core/strings/constants/base.constants'; export interface LogEntity extends BaseCoreEntity { - data_id: string; - process: OPERATION; - data: any; - old_data: any; - description: string; - module: string; - sub_module: string; - created_at: number; - creator_name: string; - creator_id: string; -} \ No newline at end of file + data_id: string; + process: OPERATION; + data: any; + old_data: any; + description: string; + module: string; + sub_module: string; + created_at: number; + creator_name: string; + creator_id: string; +} diff --git a/src/modules/configuration/log/domain/entities/log.event.ts b/src/modules/configuration/log/domain/entities/log.event.ts index 0980c37..acbd620 100644 --- a/src/modules/configuration/log/domain/entities/log.event.ts +++ b/src/modules/configuration/log/domain/entities/log.event.ts @@ -1,5 +1,5 @@ -import { IEvent } from "src/core/strings/constants/interface.constants"; +import { IEvent } from 'src/core/strings/constants/interface.constants'; export class RecordLog { - constructor(public readonly data: IEvent) {} -} \ No newline at end of file + constructor(public readonly data: IEvent) {} +} diff --git a/src/modules/configuration/log/domain/handlers/error-log.handler.ts b/src/modules/configuration/log/domain/handlers/error-log.handler.ts index a39451a..8ef4b8b 100644 --- a/src/modules/configuration/log/domain/handlers/error-log.handler.ts +++ b/src/modules/configuration/log/domain/handlers/error-log.handler.ts @@ -1,11 +1,11 @@ -import { EventsHandler, IEventHandler } from "@nestjs/cqrs"; -import { RecordErrorLog } from "../entities/error-log.event"; +import { EventsHandler, IEventHandler } from '@nestjs/cqrs'; +import { RecordErrorLog } from '../entities/error-log.event'; +import { ErrorLogService } from '../../data/services/error-log.service'; @EventsHandler(RecordErrorLog) export class RecordErrorLogHandler implements IEventHandler { - - async handle(event: RecordErrorLog) { - console.log(event, 'das error') - } - -} \ No newline at end of file + constructor(private dataservice: ErrorLogService) {} + + async handle(event: RecordErrorLog) { + } +} diff --git a/src/modules/configuration/log/domain/handlers/log.handler.ts b/src/modules/configuration/log/domain/handlers/log.handler.ts index 82fc347..6342990 100644 --- a/src/modules/configuration/log/domain/handlers/log.handler.ts +++ b/src/modules/configuration/log/domain/handlers/log.handler.ts @@ -1,11 +1,8 @@ -import { EventsHandler, IEventHandler } from "@nestjs/cqrs"; -import { RecordLog } from "../entities/log.event"; +import { EventsHandler, IEventHandler } from '@nestjs/cqrs'; +import { RecordLog } from '../entities/log.event'; @EventsHandler(RecordLog) export class RecordLogHandler implements IEventHandler { - - async handle(event: RecordLog) { - console.log(event, 'log') - } - -} \ No newline at end of file + async handle(event: RecordLog) { + } +} diff --git a/src/modules/configuration/log/log.module.ts b/src/modules/configuration/log/log.module.ts index f4a94c2..14c8eef 100644 --- a/src/modules/configuration/log/log.module.ts +++ b/src/modules/configuration/log/log.module.ts @@ -1,28 +1,31 @@ -import { Module } from "@nestjs/common"; -import { ConfigModule } from "@nestjs/config"; -import { CqrsModule } from "@nestjs/cqrs"; -import { TypeOrmModule } from "@nestjs/typeorm"; -import { LogModel } from "./data/models/log.model"; -import { ErrorLogModel } from "./data/models/error-log.model"; -import { CONNECTION_NAME } from "src/core/strings/constants/base.constants"; -import { RecordErrorLogHandler } from "./domain/handlers/error-log.handler"; -import { RecordLogHandler } from "./domain/handlers/log.handler"; -import { ErrorLogService } from "./data/services/error-log.service"; -import { LogService } from "./data/services/log.service"; +import { Module } from '@nestjs/common'; +import { ConfigModule } from '@nestjs/config'; +import { CqrsModule } from '@nestjs/cqrs'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { LogModel } from './data/models/log.model'; +import { ErrorLogModel } from './data/models/error-log.model'; +import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants'; +import { RecordErrorLogHandler } from './domain/handlers/error-log.handler'; +import { RecordLogHandler } from './domain/handlers/log.handler'; +import { ErrorLogService } from './data/services/error-log.service'; +import { LogService } from './data/services/log.service'; @Module({ - imports: [ - ConfigModule.forRoot(), - TypeOrmModule.forFeature([LogModel, ErrorLogModel], CONNECTION_NAME.DEFAULT), - CqrsModule, - ], - controllers: [], - providers: [ - RecordLogHandler, - RecordErrorLogHandler, + imports: [ + ConfigModule.forRoot(), + TypeOrmModule.forFeature( + [LogModel, ErrorLogModel], + CONNECTION_NAME.DEFAULT, + ), + CqrsModule, + ], + controllers: [], + providers: [ + RecordLogHandler, + RecordErrorLogHandler, - LogService, - ErrorLogService, - ], + LogService, + ErrorLogService, + ], }) -export class LogModule {} \ No newline at end of file +export class LogModule {} diff --git a/src/modules/user-related/user-privilege/domain/entities/event/user-privilege-change-status.event.ts b/src/modules/user-related/user-privilege/domain/entities/event/user-privilege-change-status.event.ts index 82c23f0..a0cf501 100644 --- a/src/modules/user-related/user-privilege/domain/entities/event/user-privilege-change-status.event.ts +++ b/src/modules/user-related/user-privilege/domain/entities/event/user-privilege-change-status.event.ts @@ -1,4 +1,4 @@ -import { IEvent } from '@nestjs/cqrs'; +import { IEvent } from 'src/core/strings/constants/interface.constants'; export class UserPrivilegeChangeStatusEvent { constructor(public readonly data: IEvent) {} diff --git a/src/modules/user-related/user-privilege/domain/usecases/user-privilege-configuration/user-privilege-configuration-data.orchestrator.ts b/src/modules/user-related/user-privilege/domain/usecases/user-privilege-configuration/user-privilege-configuration-data.orchestrator.ts index 445865b..2e4488c 100644 --- a/src/modules/user-related/user-privilege/domain/usecases/user-privilege-configuration/user-privilege-configuration-data.orchestrator.ts +++ b/src/modules/user-related/user-privilege/domain/usecases/user-privilege-configuration/user-privilege-configuration-data.orchestrator.ts @@ -16,7 +16,10 @@ export class UserPrivilegeConfigurationDataOrchestrator { async update(data): Promise { this.updateManager.setData(data); - this.updateManager.setService(this.serviceData, TABLE_NAME.USER_PRIVILEGE_CONFIGURATION); + this.updateManager.setService( + this.serviceData, + TABLE_NAME.USER_PRIVILEGE_CONFIGURATION, + ); await this.updateManager.execute(); return this.updateManager.getResult(); } diff --git a/src/modules/user-related/user-privilege/domain/usecases/user-privilege/user-privilege-data.orchestrator.ts b/src/modules/user-related/user-privilege/domain/usecases/user-privilege/user-privilege-data.orchestrator.ts index 7312949..9099073 100644 --- a/src/modules/user-related/user-privilege/domain/usecases/user-privilege/user-privilege-data.orchestrator.ts +++ b/src/modules/user-related/user-privilege/domain/usecases/user-privilege/user-privilege-data.orchestrator.ts @@ -58,7 +58,10 @@ export class UserPrivilegeDataOrchestrator extends BaseDataTransactionOrchestrat async batchDelete(dataIds: string[]): Promise { this.batchDeleteManager.setData(dataIds); - this.batchDeleteManager.setService(this.serviceData, TABLE_NAME.USER_PRIVILEGE); + this.batchDeleteManager.setService( + this.serviceData, + TABLE_NAME.USER_PRIVILEGE, + ); await this.batchDeleteManager.execute(); return this.batchDeleteManager.getResult(); } @@ -72,7 +75,10 @@ export class UserPrivilegeDataOrchestrator extends BaseDataTransactionOrchestrat async batchActive(dataIds: string[]): Promise { this.batchActiveManager.setData(dataIds, STATUS.ACTIVE); - this.batchActiveManager.setService(this.serviceData, TABLE_NAME.USER_PRIVILEGE); + this.batchActiveManager.setService( + this.serviceData, + TABLE_NAME.USER_PRIVILEGE, + ); await this.batchActiveManager.execute(); return this.batchActiveManager.getResult(); } @@ -86,21 +92,30 @@ export class UserPrivilegeDataOrchestrator extends BaseDataTransactionOrchestrat async batchConfirm(dataIds: string[]): Promise { this.batchConfirmManager.setData(dataIds, STATUS.ACTIVE); - this.batchConfirmManager.setService(this.serviceData, TABLE_NAME.USER_PRIVILEGE); + this.batchConfirmManager.setService( + this.serviceData, + TABLE_NAME.USER_PRIVILEGE, + ); await this.batchConfirmManager.execute(); return this.batchConfirmManager.getResult(); } async inactive(dataId): Promise { this.inactiveManager.setData(dataId, STATUS.INACTIVE); - this.inactiveManager.setService(this.serviceData, TABLE_NAME.USER_PRIVILEGE); + this.inactiveManager.setService( + this.serviceData, + TABLE_NAME.USER_PRIVILEGE, + ); await this.inactiveManager.execute(); return this.inactiveManager.getResult(); } async batchInactive(dataIds: string[]): Promise { this.batchInactiveManager.setData(dataIds, STATUS.INACTIVE); - this.batchInactiveManager.setService(this.serviceData, TABLE_NAME.USER_PRIVILEGE); + this.batchInactiveManager.setService( + this.serviceData, + TABLE_NAME.USER_PRIVILEGE, + ); await this.batchInactiveManager.execute(); return this.batchInactiveManager.getResult(); }