Files
us-api/src/fococoffee/fococoffee.controller.ts
2024-04-05 16:52:11 -06:00

51 lines
1.8 KiB
TypeScript

import { Controller, Get, UseInterceptors } from '@nestjs/common';
import { HarbingerService } from './harbinger.service';
import { FocoCoffeeService } from './fococoffee.service';
import { LimaService } from './lima.service';
import { BindleService } from './bindle.service';
import { ApiResponse, ApiTags } from '@nestjs/swagger';
import { CacheInterceptor } from '@nestjs/cache-manager';
@Controller('fococoffee')
@ApiTags('fococoffee')
@UseInterceptors(CacheInterceptor)
export class FocoCoffeeController {
constructor(
private readonly focoCoffeeService: FocoCoffeeService,
private readonly harbingerService: HarbingerService,
private readonly limaService: LimaService,
private readonly bindleService: BindleService
) { }
@Get('harbinger/products')
@ApiResponse({ status: 200, description: 'Returns the list of Harbinger products' })
async getHarbingerProducts() {
return this.harbingerService.fetchProducts()
}
@Get('lima/products')
@ApiResponse({ status: 200, description: 'Returns the list of Lima products' })
async getLimaProducts() {
return this.limaService.fetchProducts()
}
@Get('bindle/products')
@ApiResponse({ status: 200, description: 'Returns the list of Bindle products' })
async getBindleProducts() {
return this.bindleService.fetchProducts()
}
@Get('beans')
@ApiResponse({ status: 200, description: 'Returns the list of coffee bean products from all suppliers' })
async getBeans() {
return this.focoCoffeeService.getBeans()
}
@Get('products')
@ApiResponse({ status: 200, description: 'Returns the list of all products from all suppliers' })
async getAllProducts() {
return this.focoCoffeeService.getAllProducts()
}
}