refactor: e2e test cases

This commit is contained in:
Ahmed Bouhuolia
2025-01-15 17:02:42 +02:00
parent 271c46ea3b
commit 108d286f62
14 changed files with 362 additions and 115 deletions

View File

@@ -13,7 +13,7 @@ import { CreateAccountDTO } from './CreateAccount.dto';
import { EditAccountDTO } from './EditAccount.dto';
import { PublicRoute } from '../Auth/Jwt.guard';
import { IAccountsFilter, IAccountsTransactionsFilter } from './Accounts.types';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
// import { IAccountsFilter, IAccountsTransactionsFilter } from './Accounts.types';
// import { ZodValidationPipe } from '@/common/pipes/ZodValidation.pipe';
@@ -25,12 +25,20 @@ export class AccountsController {
@Post()
@ApiOperation({ summary: 'Create an account' })
@ApiResponse({
status: 200,
description: 'The account has been successfully created.',
})
async createAccount(@Body() accountDTO: CreateAccountDTO) {
return this.accountsApplication.createAccount(accountDTO);
}
@Post(':id')
@ApiOperation({ summary: 'Edit the given account.' })
@ApiResponse({
status: 200,
description: 'The account has been successfully updated.',
})
async editAccount(
@Param('id', ParseIntPipe) id: number,
@Body() accountDTO: EditAccountDTO,
@@ -40,12 +48,20 @@ export class AccountsController {
@Delete(':id')
@ApiOperation({ summary: 'Delete the given account.' })
@ApiResponse({
status: 200,
description: 'The account has been successfully deleted.',
})
async deleteAccount(@Param('id', ParseIntPipe) id: number) {
return this.accountsApplication.deleteAccount(id);
}
@Post(':id/activate')
@ApiOperation({ summary: 'Activate the given account.' })
@ApiResponse({
status: 200,
description: 'The account has been successfully activated.',
})
async activateAccount(@Param('id', ParseIntPipe) id: number) {
return this.accountsApplication.activateAccount(id);
}
@@ -58,26 +74,41 @@ export class AccountsController {
@Get('types')
@ApiOperation({ summary: 'Retrieves the account types.' })
@ApiResponse({
status: 200,
description: 'The account types have been successfully retrieved.',
})
async getAccountTypes() {
return this.accountsApplication.getAccountTypes();
}
@Get('transactions')
@ApiOperation({ summary: 'Retrieves the account transactions.' })
@ApiResponse({
status: 200,
description: 'The account transactions have been successfully retrieved.',
})
async getAccountTransactions(@Query() filter: IAccountsTransactionsFilter) {
return this.accountsApplication.getAccountsTransactions(filter);
}
@Get(':id')
@ApiOperation({ summary: 'Retrieves the account details.' })
@ApiResponse({
status: 200,
description: 'The account details have been successfully retrieved.',
})
async getAccount(@Param('id', ParseIntPipe) id: number) {
return this.accountsApplication.getAccount(id);
}
@Get()
@ApiOperation({ summary: 'Retrieves the accounts.' })
@ApiResponse({
status: 200,
description: 'The accounts have been successfully retrieved.',
})
async getAccounts(@Query() filter: IAccountsFilter) {
return this.accountsApplication.getAccounts(filter);
}
}

View File

@@ -16,7 +16,7 @@ import {
import { InventoryAdjustment } from './models/InventoryAdjustment';
import { PublicRoute } from '../Auth/Jwt.guard';
import { IPaginationMeta } from '@/interfaces/Model';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
@Controller('inventory-adjustments')
@ApiTags('inventory-adjustments')
@@ -28,6 +28,10 @@ export class InventoryAdjustmentsController {
@Post('quick')
@ApiOperation({ summary: 'Create a quick inventory adjustment.' })
@ApiResponse({
status: 200,
description: 'The inventory adjustment has been successfully created.',
})
public async createQuickInventoryAdjustment(
@Body() quickAdjustmentDTO: IQuickInventoryAdjustmentDTO,
): Promise<InventoryAdjustment> {
@@ -38,6 +42,10 @@ export class InventoryAdjustmentsController {
@Delete(':id')
@ApiOperation({ summary: 'Delete the given inventory adjustment.' })
@ApiResponse({
status: 200,
description: 'The inventory adjustment has been successfully deleted.',
})
public async deleteInventoryAdjustment(
@Param('id') inventoryAdjustmentId: number,
): Promise<void> {
@@ -48,6 +56,10 @@ export class InventoryAdjustmentsController {
@Get()
@ApiOperation({ summary: 'Retrieves the inventory adjustments.' })
@ApiResponse({
status: 200,
description: 'The inventory adjustments have been successfully retrieved.',
})
public async getInventoryAdjustments(
@Query() filterDTO: IInventoryAdjustmentsFilter,
): Promise<{
@@ -61,6 +73,11 @@ export class InventoryAdjustmentsController {
@Get(':id')
@ApiOperation({ summary: 'Retrieves the inventory adjustment details.' })
@ApiResponse({
status: 200,
description:
'The inventory adjustment details have been successfully retrieved.',
})
public async getInventoryAdjustment(
@Param('id') inventoryAdjustmentId: number,
): Promise<InventoryAdjustment> {
@@ -71,6 +88,10 @@ export class InventoryAdjustmentsController {
@Put(':id/publish')
@ApiOperation({ summary: 'Publish the given inventory adjustment.' })
@ApiResponse({
status: 200,
description: 'The inventory adjustment has been successfully published.',
})
public async publishInventoryAdjustment(
@Param('id') inventoryAdjustmentId: number,
): Promise<void> {

View File

@@ -118,7 +118,7 @@ export class InventoryTransaction extends TenantBaseModel {
// Transaction meta.
meta: {
relation: Model.HasOneRelation,
modelClass: InventoryTransactionMeta.default,
modelClass: InventoryTransactionMeta,
join: {
from: 'inventory_transactions.id',
to: 'inventory_transaction_meta.inventoryTransactionId',

View File

@@ -13,7 +13,7 @@ import { TenantController } from '../Tenancy/Tenant.controller';
import { SubscriptionGuard } from '../Subscription/interceptors/Subscription.guard';
import { PublicRoute } from '../Auth/Jwt.guard';
import { ItemsApplicationService } from './ItemsApplication.service';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
@Controller('/items')
@UseGuards(SubscriptionGuard)
@@ -32,6 +32,10 @@ export class ItemsController extends TenantController {
*/
@Put(':id')
@ApiOperation({ summary: 'Edit the given item (product or service).' })
@ApiResponse({
status: 200,
description: 'The item has been successfully updated.',
})
// @UsePipes(new ZodValidationPipe(createItemSchema))
async editItem(
@Param('id') id: string,

View File

@@ -1,24 +1,19 @@
import {
IPaymentReceivedCreateDTO,
IPaymentReceivedEditDTO,
IPaymentReceivedSmsDetails,
IPaymentsReceivedFilter,
// IPaymentsReceivedFilter,
// ISystemUser,
// PaymentReceiveMailOptsDTO,
PaymentReceiveMailOptsDTO,
} from './types/PaymentReceived.types';
import { Injectable } from '@nestjs/common';
import { CreatePaymentReceivedService } from './commands/CreatePaymentReceived.serivce';
import { EditPaymentReceivedService } from './commands/EditPaymentReceived.service';
import { DeletePaymentReceivedService } from './commands/DeletePaymentReceived.service';
// import { GetPaymentReceives } from './queries/GetPaymentsReceived.service';
import { GetPaymentReceivedService } from './queries/GetPaymentReceived.service';
import { GetPaymentReceivedInvoices } from './queries/GetPaymentReceivedInvoices.service';
// import { PaymentReceiveNotifyBySms } from './PaymentReceivedSmsNotify';
import { GetPaymentReceivedPdfService } from './queries/GetPaymentReceivedPdf.service';
// import { SendPaymentReceiveMailNotification } from './PaymentReceivedMailNotification';
import { GetPaymentReceivedStateService } from './queries/GetPaymentReceivedState.service';
import { GetPaymentsReceivedService } from './queries/GetPaymentsReceived.service';
import { SendPaymentReceiveMailNotification } from './commands/PaymentReceivedMailNotification';
@Injectable()
export class PaymentReceivesApplication {
@@ -29,8 +24,7 @@ export class PaymentReceivesApplication {
private getPaymentsReceivedService: GetPaymentsReceivedService,
private getPaymentReceivedService: GetPaymentReceivedService,
private getPaymentReceiveInvoicesService: GetPaymentReceivedInvoices,
// private paymentSmsNotify: PaymentReceiveNotifyBySms,
// private paymentMailNotify: SendPaymentReceiveMailNotification,
private sendPaymentReceiveMailNotification: SendPaymentReceiveMailNotification,
private getPaymentReceivePdfService: GetPaymentReceivedPdfService,
private getPaymentReceivedStateService: GetPaymentReceivedStateService,
) {}
@@ -103,55 +97,32 @@ export class PaymentReceivesApplication {
);
}
/**
* Notify customer via sms about payment receive details.
* @param {number} tenantId - Tenant id.
* @param {number} paymentReceiveid - Payment receive id.
*/
// public notifyPaymentBySms(tenantId: number, paymentReceiveid: number) {
// return this.paymentSmsNotify.notifyBySms(tenantId, paymentReceiveid);
// }
/**
* Retrieve the SMS details of the given invoice.
* @param {number} tenantId - Tenant id.
* @param {number} paymentReceiveid - Payment receive id.
*/
// public getPaymentSmsDetails = async (
// tenantId: number,
// paymentReceiveId: number,
// ): Promise<IPaymentReceivedSmsDetails> => {
// return this.paymentSmsNotify.smsDetails(tenantId, paymentReceiveId);
// };
/**
* Notify customer via mail about payment receive details.
* @param {number} tenantId
* @param {number} paymentReceiveId
* @param {IPaymentReceiveMailOpts} messageOpts
* @param {PaymentReceiveMailOptsDTO} messageOpts
* @returns {Promise<void>}
*/
// public notifyPaymentByMail(
// tenantId: number,
// paymentReceiveId: number,
// messageOpts: PaymentReceiveMailOptsDTO,
// ): Promise<void> {
// return this.paymentMailNotify.triggerMail(
// tenantId,
// paymentReceiveId,
// messageOpts,
// );
// }
public notifyPaymentByMail(
paymentReceiveId: number,
messageOpts: PaymentReceiveMailOptsDTO,
): Promise<void> {
return this.sendPaymentReceiveMailNotification.triggerMail(
paymentReceiveId,
messageOpts,
);
}
/**
* Retrieves the default mail options of the given payment transaction.
* @param {number} tenantId
* @param {number} paymentReceiveId
* @param {number} paymentReceiveId - Payment receive id.
* @returns {Promise<void>}
*/
// public getPaymentMailOptions(tenantId: number, paymentReceiveId: number) {
// return this.paymentMailNotify.getMailOptions(tenantId, paymentReceiveId);
// }
public getPaymentMailOptions(paymentReceiveId: number) {
return this.sendPaymentReceiveMailNotification.getMailOptions(
paymentReceiveId,
);
}
/**
* Retrieve pdf content of the given payment receive.

View File

@@ -3,6 +3,7 @@ import {
Controller,
Delete,
Get,
HttpCode,
Param,
ParseIntPipe,
Post,
@@ -14,9 +15,10 @@ import {
IPaymentReceivedCreateDTO,
IPaymentReceivedEditDTO,
IPaymentsReceivedFilter,
PaymentReceiveMailOptsDTO,
} from './types/PaymentReceived.types';
import { PublicRoute } from '../Auth/Jwt.guard';
import { ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
@Controller('payments-received')
@ApiTags('payments-received')
@@ -24,7 +26,38 @@ import { ApiTags } from '@nestjs/swagger';
export class PaymentReceivesController {
constructor(private paymentReceivesApplication: PaymentReceivesApplication) {}
@Post(':id/mail')
@HttpCode(200)
@ApiResponse({
status: 200,
description: 'The payment receive mail has been successfully sent.',
})
public sendPaymentReceiveMail(
@Param('id', ParseIntPipe) paymentReceiveId: number,
@Body() messageOpts: PaymentReceiveMailOptsDTO,
) {
return this.paymentReceivesApplication.notifyPaymentByMail(
paymentReceiveId,
messageOpts,
);
}
@Get(':id/mail')
@ApiResponse({
status: 200,
description:
'The payment receive mail options have been successfully retrieved.',
})
public getPaymentReceiveMailOptions(
@Param('id', ParseIntPipe) paymentReceiveId: number,
) {
return this.paymentReceivesApplication.getPaymentMailOptions(
paymentReceiveId,
);
}
@Post()
@ApiOperation({ summary: 'Create a new payment received.' })
public createPaymentReceived(
@Body() paymentReceiveDTO: IPaymentReceivedCreateDTO,
) {
@@ -34,6 +67,7 @@ export class PaymentReceivesController {
}
@Put(':id')
@ApiOperation({ summary: 'Edit the given payment received.' })
public editPaymentReceive(
@Param('id', ParseIntPipe) paymentReceiveId: number,
@Body() paymentReceiveDTO: IPaymentReceivedEditDTO,
@@ -45,6 +79,7 @@ export class PaymentReceivesController {
}
@Delete(':id')
@ApiOperation({ summary: 'Delete the given payment received.' })
public deletePaymentReceive(
@Param('id', ParseIntPipe) paymentReceiveId: number,
) {
@@ -54,16 +89,27 @@ export class PaymentReceivesController {
}
@Get()
@ApiOperation({ summary: 'Retrieves the payment received list.' })
public getPaymentsReceived(@Query() filterDTO: IPaymentsReceivedFilter) {
return this.paymentReceivesApplication.getPaymentsReceived(filterDTO);
}
@Get('state')
@ApiOperation({ summary: 'Retrieves the payment received state.' })
@ApiResponse({
status: 200,
description: 'The payment received state has been successfully retrieved.',
})
public getPaymentReceivedState() {
return this.paymentReceivesApplication.getPaymentReceivedState();
}
@Get(':id/invoices')
@ApiOperation({ summary: 'Retrieves the payment received invoices.' })
@ApiResponse({
status: 200,
description: 'The payment received invoices have been successfully retrieved.',
})
public getPaymentReceiveInvoices(
@Param('id', ParseIntPipe) paymentReceiveId: number,
) {
@@ -73,6 +119,11 @@ export class PaymentReceivesController {
}
@Get(':id')
@ApiOperation({ summary: 'Retrieves the payment received details.' })
@ApiResponse({
status: 200,
description: 'The payment received details have been successfully retrieved.',
})
public getPaymentReceive(
@Param('id', ParseIntPipe) paymentReceiveId: number,
) {
@@ -80,6 +131,11 @@ export class PaymentReceivesController {
}
@Get(':id/pdf')
@ApiOperation({ summary: 'Retrieves the payment received pdf.' })
@ApiResponse({
status: 200,
description: 'The payment received pdf has been successfully retrieved.',
})
public getPaymentReceivePdf(
@Param('id', ParseIntPipe) paymentReceivedId: number,
) {

View File

@@ -1,9 +1,10 @@
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import {
Body,
Controller,
Delete,
Get,
HttpCode,
Param,
ParseIntPipe,
Post,
@@ -32,6 +33,10 @@ export class SaleEstimatesController {
@Post()
@ApiOperation({ summary: 'Create a new sale estimate.' })
@ApiResponse({
status: 200,
description: 'Sale estimate created successfully',
})
public createSaleEstimate(
@Body() estimateDTO: ISaleEstimateDTO,
): Promise<SaleEstimate> {
@@ -40,6 +45,14 @@ export class SaleEstimatesController {
@Put(':id')
@ApiOperation({ summary: 'Edit the given sale estimate.' })
@ApiResponse({
status: 200,
description: 'Sale estimate edited successfully',
})
@ApiResponse({
status: 404,
description: 'Sale estimate not found',
})
public editSaleEstimate(
@Param('id', ParseIntPipe) estimateId: number,
@Body() estimateDTO: ISaleEstimateDTO,
@@ -52,6 +65,14 @@ export class SaleEstimatesController {
@Delete(':id')
@ApiOperation({ summary: 'Delete the given sale estimate.' })
@ApiResponse({
status: 200,
description: 'Sale estimate deleted successfully',
})
@ApiResponse({
status: 404,
description: 'Sale estimate not found',
})
public deleteSaleEstimate(
@Param('id', ParseIntPipe) estimateId: number,
): Promise<void> {
@@ -60,18 +81,30 @@ export class SaleEstimatesController {
@Get('state')
@ApiOperation({ summary: 'Retrieves the sale estimate state.' })
@ApiResponse({
status: 200,
description: 'Sale estimate state retrieved successfully',
})
public getSaleEstimateState() {
return this.saleEstimatesApplication.getSaleEstimateState();
}
@Get()
@ApiOperation({ summary: 'Retrieves the sale estimates.' })
@ApiResponse({
status: 200,
description: 'Sale estimates retrieved successfully',
})
public getSaleEstimates(@Query() filterDTO: ISalesEstimatesFilter) {
return this.saleEstimatesApplication.getSaleEstimates(filterDTO);
}
@Post(':id/deliver')
@ApiOperation({ summary: 'Deliver the given sale estimate.' })
@ApiResponse({
status: 200,
description: 'Sale estimate delivered successfully',
})
public deliverSaleEstimate(
@Param('id', ParseIntPipe) saleEstimateId: number,
): Promise<void> {
@@ -121,6 +154,7 @@ export class SaleEstimatesController {
}
@Post(':id/mail')
@HttpCode(200)
@ApiOperation({ summary: 'Send the given sale estimate by mail.' })
public sendSaleEstimateMail(
@Param('id', ParseIntPipe) saleEstimateId: number,

View File

@@ -14,11 +14,13 @@ import {
ISaleInvoiceCreateDTO,
ISaleInvoiceEditDTO,
ISaleInvoiceWriteoffDTO,
InvoiceNotificationType,
ISalesInvoicesFilter,
SaleInvoiceMailState,
SendInvoiceMailDTO,
} from './SaleInvoice.types';
import { SaleInvoiceApplication } from './SaleInvoices.application';
import { PublicRoute } from '../Auth/Jwt.guard';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
@Controller('sale-invoices')
@ApiTags('sale-invoices')
@@ -28,12 +30,33 @@ export class SaleInvoicesController {
@Post()
@ApiOperation({ summary: 'Create a new sale invoice.' })
@ApiResponse({
status: 201,
description: 'Sale invoice created successfully',
})
createSaleInvoice(@Body() saleInvoiceDTO: ISaleInvoiceCreateDTO) {
return this.saleInvoiceApplication.createSaleInvoice(saleInvoiceDTO);
}
@Put(':id/mail')
@ApiOperation({ summary: 'Send the sale invoice mail.' })
@ApiResponse({
status: 200,
description: 'Sale invoice mail sent successfully',
})
sendSaleInvoiceMail(
@Param('id', ParseIntPipe) id: number,
@Body() messageDTO: SendInvoiceMailDTO,
) {
return this.saleInvoiceApplication.sendSaleInvoiceMail(id, messageDTO);
}
@Put(':id')
@ApiOperation({ summary: 'Edit the given sale invoice.' })
@ApiResponse({
status: 200,
description: 'Sale invoice edited successfully',
})
editSaleInvoice(
@Param('id', ParseIntPipe) id: number,
@Body() saleInvoiceDTO: ISaleInvoiceEditDTO,
@@ -47,10 +70,11 @@ export class SaleInvoicesController {
return this.saleInvoiceApplication.deleteSaleInvoice(id);
}
// @Get()
// getSaleInvoices(@Query() filterDTO: ISalesInvoicesFilter) {
// return this.saleInvoiceApplication.getSaleInvoices(filterDTO);
// }
@Get()
@ApiOperation({ summary: 'Retrieves the sale invoices.' })
getSaleInvoices(@Query() filterDTO: ISalesInvoicesFilter) {
return this.saleInvoiceApplication.getSaleInvoices(filterDTO);
}
@Get(':id')
@ApiOperation({ summary: 'Retrieves the sale invoice details.' })
@@ -111,58 +135,15 @@ export class SaleInvoicesController {
return this.saleInvoiceApplication.saleInvoiceHtml(id);
}
@Post(':id/notify-sms')
@ApiOperation({ summary: 'Notify the sale invoice by SMS.' })
notifySaleInvoiceBySms(
@Get(':id/mail-state')
@ApiOperation({ summary: 'Retrieves the sale invoice mail state.' })
@ApiResponse({
status: 200,
description: 'Sale invoice mail state retrieved successfully',
})
getSaleInvoiceMailState(
@Param('id', ParseIntPipe) id: number,
@Body('type') notificationType: InvoiceNotificationType,
) {
// return this.saleInvoiceApplication.notifySaleInvoiceBySms(
// id,
// notificationType,
// );
): Promise<SaleInvoiceMailState> {
return this.saleInvoiceApplication.getSaleInvoiceMailState(id);
}
// @Post(':id/sms-details')
// getSaleInvoiceSmsDetails(
// @Param('id', ParseIntPipe) id: number,
// @Body() smsDetailsDTO: ISaleInvoiceSmsDetailsDTO,
// ) {
// // return this.saleInvoiceApplication.getSaleInvoiceSmsDetails(
// // id,
// // smsDetailsDTO,
// // );
// }
@Get(':id/mail-reminder')
@ApiOperation({ summary: 'Retrieves the sale invoice mail reminder.' })
getSaleInvoiceMailReminder(@Param('id', ParseIntPipe) id: number) {
// return this.saleInvoiceApplication.getSaleInvoiceMailReminder(tenantId, id);
}
// @Post(':id/mail-reminder')
// sendSaleInvoiceMailReminder(
// @Param('id', ParseIntPipe) id: number,
// @Body() messageDTO: SendInvoiceMailDTO,
// ) {
// // return this.saleInvoiceApplication.sendSaleInvoiceMailReminder(
// // id,
// // messageDTO,
// // );
// }
// @Post(':id/mail')
// sendSaleInvoiceMail(
// @Param('id', ParseIntPipe) id: number,
// @Body() messageDTO: SendInvoiceMailDTO,
// ) {
// // return this.saleInvoiceApplication.sendSaleInvoiceMail(id, messageDTO);
// }
// @Get(':id/mail-state')
// getSaleInvoiceMailState(
// @Param('id', ParseIntPipe) id: number,
// ): Promise<SaleInvoiceMailState> {
// // return this.saleInvoiceApplication.getSaleInvoiceMailState(id);
// }
}

View File

@@ -3,6 +3,7 @@ import {
Controller,
Delete,
Get,
HttpCode,
Param,
ParseIntPipe,
Post,
@@ -25,6 +26,20 @@ export class SaleReceiptsController {
return this.saleReceiptApplication.createSaleReceipt(saleReceiptDTO);
}
@Put(':id/mail')
@HttpCode(200)
@ApiOperation({ summary: 'Send the sale receipt mail.' })
sendSaleReceiptMail(@Param('id', ParseIntPipe) id: number) {
return this.saleReceiptApplication.getSaleReceiptMail(id);
}
@Get(':id/mail')
@HttpCode(200)
@ApiOperation({ summary: 'Retrieves the sale receipt mail.' })
getSaleReceiptMail(@Param('id', ParseIntPipe) id: number) {
return this.saleReceiptApplication.getSaleReceiptMail(id);
}
@Put(':id')
@ApiOperation({ summary: 'Edit the given sale receipt.' })
editSaleReceipt(

View File

@@ -4,7 +4,7 @@ import {
} from '../constants';
import { mergeAndValidateMailOptions } from '@/modules/MailNotification/utils';
import { transformReceiptToMailDataArgs } from '../utils';
import { Injectable } from '@nestjs/common';
import { Inject, Injectable } from '@nestjs/common';
import { GetSaleReceipt } from '../queries/GetSaleReceipt.service';
import { SaleReceiptsPdfService } from '../queries/SaleReceiptsPdf.service';
import { ContactMailNotification } from '@/modules/MailNotification/ContactMailNotification';
@@ -34,6 +34,9 @@ export class SaleReceiptMailNotification {
private readonly contactMailNotification: ContactMailNotification,
private readonly eventEmitter: EventEmitter2,
private readonly mailTransporter: MailTransporter,
@Inject(SaleReceipt.name)
private readonly saleReceiptModel: typeof SaleReceipt
) {}
/**
@@ -67,7 +70,7 @@ export class SaleReceiptMailNotification {
public async getMailOptions(
saleReceiptId: number,
): Promise<SaleReceiptMailOpts> {
const saleReceipt = await SaleReceipt.query()
const saleReceipt = await this.saleReceiptModel.query()
.findById(saleReceiptId)
.throwIfNotFound();