import { ExpressController, errorMapper } from "@erp/core/api"; import { DeleteCustomerUseCase } from "../../application"; export class DeleteCustomerController extends ExpressController { public constructor(private readonly deleteCustomer: DeleteCustomerUseCase) { super(); } async executeImpl(): Promise { const { id } = this.req.params; /* const user = this.req.user; // asumimos middleware authenticateJWT inyecta user if (!user || !user.companyId) { this.unauthorized(res, "Unauthorized: user or company not found"); return; } */ const result = await this.deleteCustomer.execute({ id }); if (result.isFailure) { const apiError = errorMapper.toApiError(result.error); return this.handleApiError(apiError); } return this.ok(result.data); } }