31 lines
1.3 KiB
Handlebars
31 lines
1.3 KiB
Handlebars
import { Controller, Get, Param, Query } from '@nestjs/common';
|
|
import { Filter{{pascalCase name}}Dto } from './dto/filter-{{dashCase name}}.dto';
|
|
import { Pagination } from 'src/core/response';
|
|
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
|
|
import { {{pascalCase name}}Entity } from '../domain/entities/{{dashCase name}}.entity';
|
|
import { {{pascalCase name}}ReadOrchestrator } from '../domain/usecases/{{dashCase name}}-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.{{constantCase name}}.split('-').join(' ')} - read`)
|
|
@Controller(MODULE_NAME.{{constantCase name}})
|
|
@Public(false)
|
|
@ApiBearerAuth('JWT')
|
|
export class {{pascalCase name}}ReadController {
|
|
constructor(private orchestrator: {{pascalCase name}}ReadOrchestrator) {}
|
|
|
|
@Get()
|
|
@Pagination()
|
|
async index(
|
|
@Query() params: Filter{{pascalCase name}}Dto,
|
|
): Promise<PaginationResponse<{{pascalCase name}}Entity>> {
|
|
return await this.orchestrator.index(params);
|
|
}
|
|
|
|
@Get(':id')
|
|
async detail(@Param('id') id: string): Promise<{{pascalCase name}}Entity> {
|
|
return await this.orchestrator.detail(id);
|
|
}
|
|
}
|