Clientes y Facturas de cliente
This commit is contained in:
parent
13e2ca5235
commit
810fb71705
@ -1,4 +1,4 @@
|
||||
import { Criteria, CriteriaFromUrlConverter } from "@repo/rdx-criteria";
|
||||
import { Criteria, CriteriaFromUrlConverter } from "@repo/rdx-criteria/server";
|
||||
import { UniqueID } from "@repo/rdx-ddd";
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import httpStatus from "http-status";
|
||||
@ -175,7 +175,7 @@ export abstract class ExpressController {
|
||||
|
||||
// ───────────────────────────────────────────────────────────────────────────
|
||||
// Guards API
|
||||
protected useGuards(...guards: GuardFn[]): this {
|
||||
protected registerGuards(...guards: GuardFn[]): this {
|
||||
this.guards.push(...guards);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Criteria } from "@repo/rdx-criteria";
|
||||
import { Criteria } from "@repo/rdx-criteria/server";
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { ApiError, ForbiddenApiError, UnauthorizedApiError, ValidationApiError } from "./errors";
|
||||
import { ExpressController } from "./express-controller";
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Criteria, CriteriaToSequelizeConverter } from "@repo/rdx-criteria";
|
||||
import { Criteria, CriteriaToSequelizeConverter } from "@repo/rdx-criteria/server";
|
||||
import { IAggregateRootRepository, UniqueID } from "@repo/rdx-ddd";
|
||||
import { Result } from "@repo/rdx-utils";
|
||||
import { FindOptions, ModelDefined, Sequelize, Transaction } from "sequelize";
|
||||
|
||||
@ -3,7 +3,7 @@ import path from "node:path";
|
||||
import { Presenter } from "@erp/core/api";
|
||||
import * as handlebars from "handlebars";
|
||||
import { CustomerInvoice } from "../../../../domain";
|
||||
import { CustomerInvoiceReportPresenter, CustomerInvoiceFullPresenter } from "../../../presenters";
|
||||
import { CustomerInvoiceFullPresenter, CustomerInvoiceReportPresenter } from "../../../presenters";
|
||||
|
||||
export class CustomerInvoiceReportHTMLPresenter extends Presenter {
|
||||
toOutput(customerInvoice: CustomerInvoice): string {
|
||||
|
||||
@ -7,7 +7,7 @@ export class CreateCustomerInvoiceController extends ExpressController {
|
||||
public constructor(private readonly useCase: CreateCustomerInvoiceUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
protected async executeImpl() {
|
||||
|
||||
@ -8,7 +8,7 @@ export class DeleteCustomerInvoiceController extends ExpressController {
|
||||
) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
async executeImpl() {
|
||||
|
||||
@ -5,7 +5,7 @@ export class GetCustomerInvoiceController extends ExpressController {
|
||||
public constructor(private readonly useCase: GetCustomerInvoiceUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
protected async executeImpl() {
|
||||
|
||||
@ -8,7 +8,7 @@ export class IssueCustomerInvoiceController extends ExpressController {
|
||||
) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
async executeImpl() {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { authGuard, ExpressController, forbidQueryFieldGuard, tenantGuard } from "@erp/core/api";
|
||||
import { Criteria } from "@repo/rdx-criteria";
|
||||
import { Criteria } from "@repo/rdx-criteria/server";
|
||||
import { ListCustomerInvoicesUseCase } from "../../../application";
|
||||
|
||||
export class ListCustomerInvoicesController extends ExpressController {
|
||||
public constructor(private readonly useCase: ListCustomerInvoicesUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
private getCriteriaWithDefaultOrder() {
|
||||
|
||||
@ -5,7 +5,7 @@ export class ReportCustomerInvoiceController extends ExpressController {
|
||||
public constructor(private readonly useCase: ReportCustomerInvoiceUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
protected async executeImpl() {
|
||||
|
||||
@ -6,7 +6,7 @@ export class UpdateCustomerInvoiceController extends ExpressController {
|
||||
public constructor(private readonly useCase: UpdateCustomerInvoiceUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
async executeImpl(): Promise<any> {
|
||||
|
||||
@ -4,7 +4,7 @@ import {
|
||||
SequelizeRepository,
|
||||
translateSequelizeError,
|
||||
} from "@erp/core/api";
|
||||
import { Criteria, CriteriaToSequelizeConverter } from "@repo/rdx-criteria";
|
||||
import { Criteria, CriteriaToSequelizeConverter } from "@repo/rdx-criteria/server";
|
||||
import { UniqueID } from "@repo/rdx-ddd";
|
||||
import { Collection, Result } from "@repo/rdx-utils";
|
||||
import { Transaction } from "sequelize";
|
||||
@ -14,10 +14,10 @@ import {
|
||||
ICustomerInvoiceDomainMapper,
|
||||
ICustomerInvoiceListMapper,
|
||||
} from "../mappers";
|
||||
import { CustomerInvoiceItemTaxModel } from "./models/customer-invoice-item-tax.model";
|
||||
import { CustomerInvoiceItemModel } from "./models/customer-invoice-item.model";
|
||||
import { CustomerInvoiceTaxModel } from "./models/customer-invoice-tax.model";
|
||||
import { CustomerInvoiceModel } from "./models/customer-invoice.model";
|
||||
import { CustomerInvoiceItemModel } from "./models/customer-invoice-item.model";
|
||||
import { CustomerInvoiceItemTaxModel } from "./models/customer-invoice-item-tax.model";
|
||||
import { CustomerInvoiceTaxModel } from "./models/customer-invoice-tax.model";
|
||||
|
||||
export class CustomerInvoiceRepository
|
||||
extends SequelizeRepository<CustomerInvoice>
|
||||
|
||||
@ -6,7 +6,7 @@ export class CreateCustomerController extends ExpressController {
|
||||
public constructor(private readonly useCase: CreateCustomerUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
protected async executeImpl() {
|
||||
|
||||
@ -5,7 +5,7 @@ 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"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
async executeImpl(): Promise<any> {
|
||||
|
||||
@ -5,7 +5,7 @@ export class GetCustomerController extends ExpressController {
|
||||
public constructor(private readonly useCase: GetCustomerUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
protected async executeImpl() {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { authGuard, ExpressController, forbidQueryFieldGuard, tenantGuard } from "@erp/core/api";
|
||||
import { Criteria } from "@repo/rdx-criteria";
|
||||
import { Criteria } from "@repo/rdx-criteria/server";
|
||||
import { ListCustomersUseCase } from "../../../application";
|
||||
|
||||
export class ListCustomersController extends ExpressController {
|
||||
public constructor(private readonly listCustomers: ListCustomersUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
private getCriteriaWithDefaultOrder() {
|
||||
|
||||
@ -6,7 +6,7 @@ export class UpdateCustomerController extends ExpressController {
|
||||
public constructor(private readonly useCase: UpdateCustomerUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
protected async executeImpl() {
|
||||
|
||||
@ -4,7 +4,7 @@ import {
|
||||
SequelizeRepository,
|
||||
translateSequelizeError,
|
||||
} from "@erp/core/api";
|
||||
import { Criteria, CriteriaToSequelizeConverter } from "@repo/rdx-criteria";
|
||||
import { Criteria, CriteriaToSequelizeConverter } from "@repo/rdx-criteria/server";
|
||||
import { UniqueID } from "@repo/rdx-ddd";
|
||||
import { Collection, Result } from "@repo/rdx-utils";
|
||||
import { Transaction } from "sequelize";
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import { ExpressController, authGuard, forbidQueryFieldGuard, tenantGuard } from "@erp/core/api";
|
||||
import { authGuard, ExpressController, forbidQueryFieldGuard, tenantGuard } from "@erp/core/api";
|
||||
import { SendInvoiceUseCase } from "@erp/customer-invoices/api/application";
|
||||
|
||||
export class SendInvoiceVerifactuController extends ExpressController {
|
||||
public constructor(private readonly useCase: SendInvoiceUseCase) {
|
||||
super();
|
||||
// 🔐 Reutiliza guards de auth/tenant y prohíbe 'companyId' en query
|
||||
this.useGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
this.registerGuards(authGuard(), tenantGuard(), forbidQueryFieldGuard("companyId"));
|
||||
}
|
||||
|
||||
protected async executeImpl() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user