import { ExpressController, authGuard, errorMapper, forbidQueryFieldGuard, tenantGuard, } from "@erp/core/api"; import { DeleteCustomerUseCase } from "../../../application"; export class DeleteCustomerController extends ExpressController { public constructor(private readonly useCase: DeleteCustomerUseCase) { super(); // 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId")); } async executeImpl(): Promise { const tenantId = this.getTenantId()!; // garantizado por tenantGuard const { id } = this.req.params; const result = await this.useCase.execute({ id, tenantId }); return result.match( (data) => this.ok(data), (error) => this.handleApiError(errorMapper.toApiError(error)) ); } }