feat: Assign default PDF template automatically

This commit is contained in:
Ahmed Bouhuolia
2024-10-02 18:18:57 +02:00
parent cbc60b3c73
commit b23112bc92
30 changed files with 501 additions and 46 deletions

View File

@@ -0,0 +1,18 @@
import { Service } from 'typedi';
import { ISaleReceiptState } from '@/interfaces';
@Service()
export class GetSaleReceiptState {
/**
* Retireves the sale receipt state.
* @param {Number} tenantId -
* @return {Promise<ISaleReceiptState>}
*/
public async getSaleReceiptState(
tenantId: number
): Promise<ISaleReceiptState> {
return {
defaultTemplateId: 1,
};
}
}

View File

@@ -4,6 +4,7 @@ import {
IFilterMeta,
IPaginationMeta,
ISaleReceipt,
ISaleReceiptState,
ISalesReceiptsFilter,
SaleReceiptMailOpts,
SaleReceiptMailOptsDTO,
@@ -16,6 +17,7 @@ import { CloseSaleReceipt } from './CloseSaleReceipt';
import { SaleReceiptsPdf } from './SaleReceiptsPdfService';
import { SaleReceiptNotifyBySms } from './SaleReceiptNotifyBySms';
import { SaleReceiptMailNotification } from './SaleReceiptMailNotification';
import { GetSaleReceiptState } from './GetSaleReceiptState';
@Service()
export class SaleReceiptApplication {
@@ -46,6 +48,9 @@ export class SaleReceiptApplication {
@Inject()
private saleReceiptNotifyByMailService: SaleReceiptMailNotification;
@Inject()
private getSaleReceiptStateService: GetSaleReceiptState;
/**
* Creates a new sale receipt with associated entries.
* @param {number} tenantId
@@ -207,4 +212,13 @@ export class SaleReceiptApplication {
saleReceiptId
);
}
/**
* Retrieves the current state of the sale receipt.
* @param {number} tenantId - The ID of the tenant.
* @returns {Promise<ISaleReceiptState>} - A promise resolving to the sale receipt state.
*/
public getSaleReceiptState(tenantId: number): Promise<ISaleReceiptState> {
return this.getSaleReceiptStateService.getSaleReceiptState(tenantId);
}
}