38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { Controller, Get, UseGuards, Request } from "@nestjs/common";
|
|
import { CatalogService } from "./catalog.service";
|
|
import { ApiTags, ApiOperation, ApiBearerAuth } from "@nestjs/swagger";
|
|
import { JwtAuthGuard } from "../auth/guards/jwt-auth.guard";
|
|
import { RequestWithUser } from "../auth/auth.types";
|
|
|
|
@ApiTags("catalog")
|
|
@Controller("catalog")
|
|
@UseGuards(JwtAuthGuard)
|
|
@ApiBearerAuth()
|
|
export class CatalogController {
|
|
constructor(private catalogService: CatalogService) {}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: "Get product catalog (authenticated users only)" })
|
|
async getCatalog() {
|
|
return this.catalogService.getProducts();
|
|
}
|
|
|
|
@Get('personalized')
|
|
@ApiOperation({ summary: "Get personalized product catalog based on customer eligibility" })
|
|
async getPersonalizedCatalog(@Request() req: RequestWithUser) {
|
|
return this.catalogService.getPersonalizedProducts(req.user.id);
|
|
}
|
|
|
|
@Get('internet/addons')
|
|
@ApiOperation({ summary: "Get Internet add-on products (Hikari Denwa, etc.)" })
|
|
async getInternetAddons() {
|
|
return this.catalogService.getInternetAddons();
|
|
}
|
|
|
|
@Get('internet/installations')
|
|
@ApiOperation({ summary: "Get Internet installation options with pricing" })
|
|
async getInternetInstallations() {
|
|
return this.catalogService.getInternetInstallations();
|
|
}
|
|
}
|