Files
dukang/server/dukang-api/src/modules/catalog/catalog.controller.ts
T

23 lines
622 B
TypeScript

import { Controller, Get, Param, Query } from '@nestjs/common';
import { CatalogService } from './catalog.service';
@Controller('catalog')
export class CatalogController {
constructor(private readonly catalogService: CatalogService) {}
@Get('cities')
cities() {
return this.catalogService.listCities();
}
@Get('products')
products(@Query('aromaType') aromaType?: string, @Query('cityCode') cityCode?: string) {
return this.catalogService.listProducts(aromaType, cityCode);
}
@Get('products/:id')
product(@Param('id') id: string) {
return this.catalogService.getProduct(BigInt(id));
}
}