Spaces:
Sleeping
Sleeping
Download src/modules/catalog/catalog.controller.ts from jinksQspider/openWa: direct link, hf CLI and curl.
- Browser
- Download file 1.68 kB
-
https://huggingface.co/spaces/jinksQspider/openWa/resolve/main/src/modules/catalog/catalog.controller.ts
- Command line
-
hf download hf://spaces/jinksQspider/openWa/src/modules/catalog/catalog.controller.ts
-
curl -L -o catalog.controller.ts https://huggingface.co/spaces/jinksQspider/openWa/resolve/main/src/modules/catalog/catalog.controller.ts
1.68 kB
| import { Controller, Get, Post, Param, Body, Query } from '@nestjs/common'; | |
| import { ApiTags, ApiOperation } from '@nestjs/swagger'; | |
| import { CatalogService } from './catalog.service'; | |
| import { SendProductDto, SendCatalogDto, ProductQueryDto } from './dto/send-product.dto'; | |
| ('Catalog') | |
| ('sessions/:sessionId') | |
| export class CatalogController { | |
| constructor(private readonly catalogService: CatalogService) {} | |
| ('catalog') | |
| ({ summary: 'Get business catalog info' }) | |
| async getCatalog(('sessionId') sessionId: string) { | |
| return this.catalogService.getCatalog(sessionId); | |
| } | |
| ('catalog/products') | |
| ({ summary: 'List catalog products' }) | |
| async getProducts(('sessionId') sessionId: string, () query: ProductQueryDto) { | |
| return this.catalogService.getProducts(sessionId, query.page, query.limit); | |
| } | |
| ('catalog/products/:productId') | |
| ({ summary: 'Get a specific product' }) | |
| async getProduct(('sessionId') sessionId: string, ('productId') productId: string) { | |
| return this.catalogService.getProduct(sessionId, productId); | |
| } | |
| ('messages/send-product') | |
| ({ summary: 'Send a product message' }) | |
| async sendProduct(('sessionId') sessionId: string, () dto: SendProductDto) { | |
| return this.catalogService.sendProduct(sessionId, dto.chatId, dto.productId, dto.body); | |
| } | |
| ('messages/send-catalog') | |
| ({ summary: 'Send catalog link' }) | |
| async sendCatalog(('sessionId') sessionId: string, () dto: SendCatalogDto) { | |
| return this.catalogService.sendCatalog(sessionId, dto.chatId, dto.body); | |
| } | |
| } | |