import { ExpressController, authGuard, tenantGuard, forbidQueryFieldGuard } from "@erp/core/api"; import { Get{{pascalCase name}}UseCase } from "../../../application"; /** * Controlador de lectura por id en el contexto del tenant */ export class Get{{pascalCase name}}Controller extends ExpressController { public constructor(private readonly useCase: Get{{pascalCase name}}UseCase) { super(); this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId")); } protected async executeImpl() { const companyId = this.getTenantId(); if (!companyId) return this.forbiddenError("Tenant ID not found"); const { {{snakeCase name}}_id } = this.req.params as { {{snakeCase name}}_id: string }; const result = await this.useCase.execute({ {{snakeCase name}}_id, companyId }); return result.match( (data) => this.ok(data), (err) => this.handleError(err) ); } }