feat(SPG-54) REST API Create VIP Code Disc
parent
f4cc5ae1c9
commit
f86f86fe0c
|
@ -24,6 +24,8 @@ import { ItemCategoryModel } from './modules/item-related/item-category/data/mod
|
|||
import { ConstantModule } from './modules/configuration/constant/constant.module';
|
||||
import { VipCategoryModule } from './modules/transaction/vip-category/vip-category.module';
|
||||
import { VipCategoryModel } from './modules/transaction/vip-category/data/models/vip-category.model';
|
||||
import { VipCodeModule } from './modules/transaction/vip-code/vip-code.module';
|
||||
import { VipCodeModel } from './modules/transaction/vip-code/data/models/vip-code.model';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
|
@ -46,6 +48,7 @@ import { VipCategoryModel } from './modules/transaction/vip-category/data/models
|
|||
ErrorLogModel,
|
||||
ItemCategoryModel,
|
||||
VipCategoryModel,
|
||||
VipCodeModel,
|
||||
],
|
||||
synchronize: false,
|
||||
}),
|
||||
|
@ -66,6 +69,7 @@ import { VipCategoryModel } from './modules/transaction/vip-category/data/models
|
|||
|
||||
// transaction
|
||||
VipCategoryModule,
|
||||
VipCodeModule,
|
||||
],
|
||||
controllers: [],
|
||||
providers: [
|
||||
|
|
|
@ -2,7 +2,7 @@ import { validateRelations } from 'src/core/strings/constants/interface.constant
|
|||
import { BaseManager } from '../base.manager';
|
||||
|
||||
export abstract class BaseCustomManager<Entity> extends BaseManager {
|
||||
protected result: Entity;
|
||||
protected result: any;
|
||||
abstract get entityTarget(): any;
|
||||
|
||||
setData(entity: Entity): void {
|
||||
|
|
|
@ -5,4 +5,5 @@ export enum MODULE_NAME {
|
|||
USER_PRIVILEGE = 'user-privileges',
|
||||
USER_PRIVILEGE_CONFIGURATION = 'user-privilege-configurations',
|
||||
VIP_CATEGORY = 'vip-categories',
|
||||
VIP_CODE = 'vip-codes',
|
||||
}
|
||||
|
|
|
@ -7,4 +7,5 @@ export enum TABLE_NAME {
|
|||
USER_PRIVILEGE = 'user_privileges',
|
||||
USER_PRIVILEGE_CONFIGURATION = 'user_privilege_configurations',
|
||||
VIP_CATEGORY = 'vip_categories',
|
||||
VIP_CODE = 'vip_codes',
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class VipCode1718076296496 implements MigrationInterface {
|
||||
name = 'VipCode1718076296496';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`CREATE TABLE "vip_codes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "creator_id" character varying(36), "creator_name" character varying(125), "editor_id" character varying(36), "editor_name" character varying(125), "created_at" bigint NOT NULL, "updated_at" bigint NOT NULL, "code" character varying NOT NULL, "discount" integer NOT NULL, "vip_category_id" uuid NOT NULL, CONSTRAINT "PK_423f82dba17315d29f2c21e0fd6" PRIMARY KEY ("id"))`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "vip_codes" ADD CONSTRAINT "FK_67e2cd45678c3f7ea713e96ec5e" FOREIGN KEY ("vip_category_id") REFERENCES "vip_categories"("id") ON DELETE CASCADE ON UPDATE CASCADE`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "vip_codes" DROP CONSTRAINT "FK_67e2cd45678c3f7ea713e96ec5e"`,
|
||||
);
|
||||
await queryRunner.query(`DROP TABLE "vip_codes"`);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||
import { VipCategoryEntity } from '../../domain/entities/vip-category.entity';
|
||||
import { Column, Entity } from 'typeorm';
|
||||
import { Column, Entity, OneToMany } from 'typeorm';
|
||||
import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model';
|
||||
import { VipCodeModel } from 'src/modules/transaction/vip-code/data/models/vip-code.model';
|
||||
|
||||
@Entity(TABLE_NAME.VIP_CATEGORY)
|
||||
export class VipCategoryModel
|
||||
|
@ -10,4 +11,11 @@ export class VipCategoryModel
|
|||
{
|
||||
@Column('varchar', { name: 'name' })
|
||||
name: string;
|
||||
|
||||
@OneToMany(() => VipCodeModel, (model) => model.vip_category, {
|
||||
cascade: true,
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
vip_codes: VipCodeModel[];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||
import { VipCodeEntity } from '../../domain/entities/vip-code.entity';
|
||||
import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
|
||||
import { BaseModel } from 'src/core/modules/data/model/base.model';
|
||||
import { VipCategoryModel } from 'src/modules/transaction/vip-category/data/models/vip-category.model';
|
||||
|
||||
@Entity(TABLE_NAME.VIP_CODE)
|
||||
export class VipCodeModel
|
||||
extends BaseModel<VipCodeEntity>
|
||||
implements VipCodeEntity
|
||||
{
|
||||
@Column('varchar', { name: 'code' })
|
||||
code: string;
|
||||
|
||||
@Column('integer', { name: 'discount' })
|
||||
discount: number;
|
||||
|
||||
@Column('varchar', { name: 'vip_category_id' })
|
||||
vip_category_id: string;
|
||||
@ManyToOne(() => VipCategoryModel, (model) => model.vip_codes, {
|
||||
onDelete: 'CASCADE',
|
||||
onUpdate: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'vip_category_id' })
|
||||
vip_category: VipCategoryModel;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { BaseDataService } from 'src/core/modules/data/service/base-data.service';
|
||||
import { VipCodeEntity } from '../../domain/entities/vip-code.entity';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { VipCodeModel } from '../models/vip-code.model';
|
||||
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
export class VipCodeDataService extends BaseDataService<VipCodeEntity> {
|
||||
constructor(
|
||||
@InjectRepository(VipCodeModel, CONNECTION_NAME.DEFAULT)
|
||||
private repo: Repository<VipCodeModel>,
|
||||
) {
|
||||
super(repo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { VipCodeEntity } from '../../domain/entities/vip-code.entity';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { VipCodeModel } from '../models/vip-code.model';
|
||||
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
|
||||
import { Repository } from 'typeorm';
|
||||
import { BaseReadService } from 'src/core/modules/data/service/base-read.service';
|
||||
|
||||
@Injectable()
|
||||
export class VipCodeReadService extends BaseReadService<VipCodeEntity> {
|
||||
constructor(
|
||||
@InjectRepository(VipCodeModel, CONNECTION_NAME.DEFAULT)
|
||||
private repo: Repository<VipCodeModel>,
|
||||
) {
|
||||
super(repo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import { IEvent } from 'src/core/strings/constants/interface.constants';
|
||||
|
||||
export class VipCodeCreatedEvent {
|
||||
constructor(public readonly data: IEvent) {}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import { IEvent } from 'src/core/strings/constants/interface.constants';
|
||||
|
||||
export class VipCodeDeletedEvent {
|
||||
constructor(public readonly data: IEvent) {}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
import { IEvent } from 'src/core/strings/constants/interface.constants';
|
||||
|
||||
export class VipCodeUpdatedEvent {
|
||||
constructor(public readonly data: IEvent) {}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
import { BaseFilterEntity } from 'src/core/modules/domain/entities/base-filter.entity';
|
||||
|
||||
export interface FilterVipCodeEntity extends BaseFilterEntity {}
|
|
@ -0,0 +1,6 @@
|
|||
import { BaseEntity } from 'src/core/modules/domain/entities/base.entity';
|
||||
|
||||
export interface VipCodeEntity extends BaseEntity {
|
||||
code: string;
|
||||
discount: number;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import {
|
||||
EventTopics,
|
||||
columnUniques,
|
||||
validateRelations,
|
||||
} from 'src/core/strings/constants/interface.constants';
|
||||
import { VipCodeEntity } from '../../entities/vip-code.entity';
|
||||
import { VipCodeModel } from '../../../data/models/vip-code.model';
|
||||
import { BaseCreateManager } from 'src/core/modules/domain/usecase/managers/base-create.manager';
|
||||
import { VipCodeCreatedEvent } from '../../entities/event/vip-code-created.event';
|
||||
|
||||
@Injectable()
|
||||
export class CreateVipCodeManager extends BaseCreateManager<VipCodeEntity> {
|
||||
async beforeProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
async afterProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
get validateRelations(): validateRelations[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
get uniqueColumns(): columnUniques[] {
|
||||
return [
|
||||
{
|
||||
column: 'code',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
get eventTopics(): EventTopics[] {
|
||||
return [
|
||||
{
|
||||
topic: VipCodeCreatedEvent,
|
||||
data: this.data,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
get entityTarget(): any {
|
||||
return VipCodeModel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
import { BaseCustomManager } from 'src/core/modules/domain/usecase/managers/base-custom.manager';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { VipCodeEntity } from '../../entities/vip-code.entity';
|
||||
import { EventTopics } from 'src/core/strings/constants/interface.constants';
|
||||
|
||||
@Injectable()
|
||||
export class GenerateVipCodeManager extends BaseCustomManager<VipCodeEntity> {
|
||||
validateProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
beforeProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
process(): Promise<void> {
|
||||
const date = new Date();
|
||||
|
||||
// get month dan year (dua digit)
|
||||
const month =
|
||||
date.getMonth() < 10
|
||||
? `0${date.getMonth() + 1}`
|
||||
: (date.getMonth() + 1).toString();
|
||||
const year = date.getFullYear().toString().slice(-2);
|
||||
|
||||
const char = this.generateRandom(1);
|
||||
const number = this.generateRandom(2, true);
|
||||
|
||||
this.result = `${month}${year}${char}${number}`;
|
||||
return;
|
||||
}
|
||||
|
||||
afterProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
get entityTarget(): any {
|
||||
return;
|
||||
}
|
||||
|
||||
getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
get eventTopics(): EventTopics[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
generateRandom(length: number, is_number?: boolean): string {
|
||||
let result = '';
|
||||
let base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
if (is_number) base = '123456789';
|
||||
|
||||
let counter = 0;
|
||||
while (counter < length) {
|
||||
result += base.charAt(Math.floor(Math.random() * base.length));
|
||||
counter += 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { BaseIndexManager } from 'src/core/modules/domain/usecase/managers/base-index.manager';
|
||||
import { VipCodeEntity } from '../../entities/vip-code.entity';
|
||||
import { SelectQueryBuilder } from 'typeorm';
|
||||
import {
|
||||
Param,
|
||||
RelationParam,
|
||||
} from 'src/core/modules/domain/entities/base-filter.entity';
|
||||
|
||||
@Injectable()
|
||||
export class IndexVipCodeManager extends BaseIndexManager<VipCodeEntity> {
|
||||
async prepareData(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
async beforeProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
async afterProcess(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
get relations(): RelationParam {
|
||||
return {
|
||||
// relation only join (for query purpose)
|
||||
joinRelations: [],
|
||||
|
||||
// relation join and select (relasi yang ingin ditampilkan),
|
||||
selectRelations: [],
|
||||
|
||||
// relation yang hanya ingin dihitung (akan return number)
|
||||
countRelations: [],
|
||||
};
|
||||
}
|
||||
|
||||
get selects(): string[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
get specificFilter(): Param[] {
|
||||
return [
|
||||
{
|
||||
cols: `${this.tableName}.name`,
|
||||
data: this.filterParam.names,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
setQueryFilter(
|
||||
queryBuilder: SelectQueryBuilder<VipCodeEntity>,
|
||||
): SelectQueryBuilder<VipCodeEntity> {
|
||||
return queryBuilder;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { CreateVipCodeManager } from './managers/create-vip-code.manager';
|
||||
import { VipCodeDataService } from '../../data/services/vip-code-data.service';
|
||||
import { VipCodeEntity } from '../entities/vip-code.entity';
|
||||
import { BaseDataOrchestrator } from 'src/core/modules/domain/usecase/orchestrators/base-data.orchestrator';
|
||||
import { BatchResult } from 'src/core/response/domain/ok-response.interface';
|
||||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||
import { GenerateVipCodeManager } from './managers/geneate-vip-code.manager';
|
||||
import { VipCodeModel } from '../../data/models/vip-code.model';
|
||||
|
||||
@Injectable()
|
||||
export class VipCodeDataOrchestrator extends BaseDataOrchestrator<VipCodeEntity> {
|
||||
constructor(
|
||||
private createManager: CreateVipCodeManager,
|
||||
private generateCodeManager: GenerateVipCodeManager,
|
||||
private serviceData: VipCodeDataService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
update(dataId: string, data: VipCodeEntity): Promise<VipCodeEntity> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
delete(dataId: string): Promise<String> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
batchDelete(dataIds: string[]): Promise<BatchResult> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
async create(data): Promise<VipCodeEntity> {
|
||||
this.createManager.setData(data);
|
||||
this.createManager.setService(this.serviceData, TABLE_NAME.VIP_CODE);
|
||||
await this.createManager.execute();
|
||||
return this.createManager.getResult();
|
||||
}
|
||||
|
||||
async generateCode(): Promise<string> {
|
||||
const data = new VipCodeModel();
|
||||
this.generateCodeManager.setData(data);
|
||||
this.generateCodeManager.setService(this.serviceData, TABLE_NAME.VIP_CODE);
|
||||
await this.generateCodeManager.execute();
|
||||
return this.generateCodeManager.getResult();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { IndexVipCodeManager } from './managers/index-vip-code.manager';
|
||||
import { VipCodeReadService } from '../../data/services/vip-code-read.service';
|
||||
import { VipCodeEntity } from '../entities/vip-code.entity';
|
||||
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
|
||||
import { BaseReadOrchestrator } from 'src/core/modules/domain/usecase/orchestrators/base-read.orchestrator';
|
||||
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||
|
||||
@Injectable()
|
||||
export class VipCodeReadOrchestrator extends BaseReadOrchestrator<VipCodeEntity> {
|
||||
constructor(
|
||||
private indexManager: IndexVipCodeManager,
|
||||
private serviceData: VipCodeReadService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
async index(params): Promise<PaginationResponse<VipCodeEntity>> {
|
||||
this.indexManager.setFilterParam(params);
|
||||
this.indexManager.setService(this.serviceData, TABLE_NAME.VIP_CODE);
|
||||
await this.indexManager.execute();
|
||||
return this.indexManager.getResult();
|
||||
}
|
||||
|
||||
async detail(dataId: string): Promise<VipCodeEntity> {
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
import { BaseFilterDto } from 'src/core/modules/infrastructure/dto/base-filter.dto';
|
||||
import { FilterVipCodeEntity } from '../../domain/entities/filter-vip-code.entity';
|
||||
|
||||
export class FilterVipCodeDto
|
||||
extends BaseFilterDto
|
||||
implements FilterVipCodeEntity {}
|
|
@ -0,0 +1,35 @@
|
|||
import { BaseDto } from 'src/core/modules/infrastructure/dto/base.dto';
|
||||
import { VipCodeEntity } from '../../domain/entities/vip-code.entity';
|
||||
import { IsNumber, IsObject, IsString } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class VipCodeDto extends BaseDto implements VipCodeEntity {
|
||||
@ApiProperty({
|
||||
name: 'code',
|
||||
type: String,
|
||||
required: true,
|
||||
example: '0824A12',
|
||||
})
|
||||
@IsString()
|
||||
code: string;
|
||||
|
||||
@ApiProperty({
|
||||
name: 'discount',
|
||||
type: Number,
|
||||
required: true,
|
||||
example: 85,
|
||||
})
|
||||
@IsNumber()
|
||||
discount: number;
|
||||
|
||||
@ApiProperty({
|
||||
name: 'vip_category',
|
||||
type: String,
|
||||
required: true,
|
||||
example: {
|
||||
id: 'uuid',
|
||||
},
|
||||
})
|
||||
@IsObject()
|
||||
vip_category: VipCodeEntity;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
import { Body, Controller, Post } from '@nestjs/common';
|
||||
import { VipCodeDataOrchestrator } from '../domain/usecases/vip-code-data.orchestrator';
|
||||
import { VipCodeDto } from './dto/vip-code.dto';
|
||||
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
import { VipCodeEntity } from '../domain/entities/vip-code.entity';
|
||||
import { Public } from 'src/core/guards';
|
||||
|
||||
@ApiTags(`${MODULE_NAME.VIP_CODE.split('-').join(' ')} - data`)
|
||||
@Controller(MODULE_NAME.VIP_CODE)
|
||||
@Public(false)
|
||||
@ApiBearerAuth('JWT')
|
||||
export class VipCodeDataController {
|
||||
constructor(private orchestrator: VipCodeDataOrchestrator) {}
|
||||
|
||||
@Post()
|
||||
async create(@Body() data: VipCodeDto): Promise<VipCodeEntity> {
|
||||
return await this.orchestrator.create(data);
|
||||
}
|
||||
|
||||
@Post('generate-code')
|
||||
async generateCOde(): Promise<String> {
|
||||
return await this.orchestrator.generateCode();
|
||||
}
|
||||
|
||||
// @Put('/batch-delete')
|
||||
// async batchDeleted(@Body() body: BatchIdsDto): Promise<BatchResult> {
|
||||
// return await this.orchestrator.batchDelete(body.ids);
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// async delete(@Param('id') dataId: string): Promise<String> {
|
||||
// return await this.orchestrator.delete(dataId);
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import { Controller, Get, Query } from '@nestjs/common';
|
||||
import { FilterVipCodeDto } from './dto/filter-vip-code.dto';
|
||||
import { Pagination } from 'src/core/response';
|
||||
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
|
||||
import { VipCodeEntity } from '../domain/entities/vip-code.entity';
|
||||
import { VipCodeReadOrchestrator } from '../domain/usecases/vip-code-read.orchestrator';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
|
||||
import { Public } from 'src/core/guards';
|
||||
|
||||
@ApiTags(`${MODULE_NAME.VIP_CODE.split('-').join(' ')} - read`)
|
||||
@Controller(MODULE_NAME.VIP_CODE)
|
||||
@Public(false)
|
||||
@ApiBearerAuth('JWT')
|
||||
export class VipCodeReadController {
|
||||
constructor(private orchestrator: VipCodeReadOrchestrator) {}
|
||||
|
||||
@Get()
|
||||
@Pagination()
|
||||
async index(
|
||||
@Query() params: FilterVipCodeDto,
|
||||
): Promise<PaginationResponse<VipCodeEntity>> {
|
||||
return await this.orchestrator.index(params);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
import { Module } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
|
||||
import { VipCodeDataService } from './data/services/vip-code-data.service';
|
||||
import { VipCodeReadService } from './data/services/vip-code-read.service';
|
||||
import { VipCodeReadController } from './infrastructure/vip-code-read.controller';
|
||||
import { VipCodeReadOrchestrator } from './domain/usecases/vip-code-read.orchestrator';
|
||||
import { VipCodeDataController } from './infrastructure/vip-code-data.controller';
|
||||
import { VipCodeDataOrchestrator } from './domain/usecases/vip-code-data.orchestrator';
|
||||
import { CreateVipCodeManager } from './domain/usecases/managers/create-vip-code.manager';
|
||||
import { CqrsModule } from '@nestjs/cqrs';
|
||||
import { IndexVipCodeManager } from './domain/usecases/managers/index-vip-code.manager';
|
||||
import { VipCodeModel } from './data/models/vip-code.model';
|
||||
import { GenerateVipCodeManager } from './domain/usecases/managers/geneate-vip-code.manager';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ConfigModule.forRoot(),
|
||||
TypeOrmModule.forFeature([VipCodeModel], CONNECTION_NAME.DEFAULT),
|
||||
CqrsModule,
|
||||
],
|
||||
controllers: [VipCodeDataController, VipCodeReadController],
|
||||
providers: [
|
||||
IndexVipCodeManager,
|
||||
CreateVipCodeManager,
|
||||
GenerateVipCodeManager,
|
||||
|
||||
VipCodeDataService,
|
||||
VipCodeReadService,
|
||||
|
||||
VipCodeDataOrchestrator,
|
||||
VipCodeReadOrchestrator,
|
||||
],
|
||||
})
|
||||
export class VipCodeModule {}
|
Loading…
Reference in New Issue