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