import { Body, Controller, Get, Param, Patch, Post, UseGuards } from "@nestjs/common"; import { Public } from "../common/decorators/public.decorator"; import { Roles } from "../common/decorators/roles.decorator"; import { RolesGuard } from "../common/guards/roles.guard"; import { PlansService } from "./plans.service"; @Controller("plans") export class PlansController { constructor(private plansService: PlansService) {} @Get() @Public() async findAll() { return this.plansService.findAll(); } @Post() @UseGuards(RolesGuard) @Roles("admin") async create( @Body() body: { name: string; brandCount: number; priceMonthly: number; priceYearly: number }, ) { return this.plansService.create(body); } @Patch(":id") @UseGuards(RolesGuard) @Roles("admin") async update( @Param("id") id: string, @Body() body: { name?: string; brandCount?: number; priceMonthly?: number; priceYearly?: number; isActive?: boolean; }, ) { return this.plansService.update(id, body); } }