33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { Controller, Get, Query } from '@nestjs/common';
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
import { Public } from 'src/core/guards';
|
|
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
|
|
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
|
import { ItemReadService } from 'src/modules/item-related/item/data/services/item-read.service';
|
|
import { ItemEntity } from 'src/modules/item-related/item/domain/entities/item.entity';
|
|
import { FilterItemDto } from 'src/modules/item-related/item/infrastructure/dto/filter-item.dto';
|
|
import { BookingItemManager } from '../domain/usecases/managers/booking-item.manager';
|
|
|
|
@ApiTags('Booking Item')
|
|
@Controller('v1/booking-item')
|
|
@Public(true)
|
|
export class ItemController {
|
|
constructor(
|
|
private indexManager: BookingItemManager,
|
|
private serviceData: ItemReadService,
|
|
) {}
|
|
|
|
@Get()
|
|
async index(
|
|
@Query() params: FilterItemDto,
|
|
): Promise<PaginationResponse<ItemEntity>> {
|
|
params.limit = 1000;
|
|
params.show_to_booking = true;
|
|
params.all_item = true;
|
|
this.indexManager.setFilterParam(params);
|
|
this.indexManager.setService(this.serviceData, TABLE_NAME.ITEM);
|
|
await this.indexManager.execute();
|
|
return this.indexManager.getResult();
|
|
}
|
|
}
|