mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
refactor(nestjs): wip
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ApiOperation, ApiTags } from '@nestjs/swagger';
|
||||
import { Body, Controller, Delete, Param, Post } from '@nestjs/common';
|
||||
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
|
||||
import { ICreditNoteRefundDTO } from '../CreditNotes/types/CreditNotes.types';
|
||||
import { CreditNotesRefundsApplication } from './CreditNotesRefundsApplication.service';
|
||||
import { RefundCreditNote } from './models/RefundCreditNote';
|
||||
@@ -12,6 +12,14 @@ export class CreditNoteRefundsController {
|
||||
private readonly creditNotesRefundsApplication: CreditNotesRefundsApplication,
|
||||
) {}
|
||||
|
||||
@Get(':creditNoteId/refunds')
|
||||
@ApiOperation({ summary: 'Retrieve the credit note graph.' })
|
||||
getCreditNoteRefunds(@Param('creditNoteId') creditNoteId: number) {
|
||||
return this.creditNotesRefundsApplication.getCreditNoteRefunds(
|
||||
creditNoteId,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a refund credit note.
|
||||
* @param {number} creditNoteId - The credit note ID.
|
||||
|
||||
@@ -6,6 +6,7 @@ import { RefundSyncCreditNoteBalanceService } from './commands/RefundSyncCreditN
|
||||
import { CreditNotesRefundsApplication } from './CreditNotesRefundsApplication.service';
|
||||
import { CreditNoteRefundsController } from './CreditNoteRefunds.controller';
|
||||
import { CreditNotesModule } from '../CreditNotes/CreditNotes.module';
|
||||
import { GetCreditNoteRefundsService } from './queries/GetCreditNoteRefunds.service';
|
||||
|
||||
@Module({
|
||||
imports: [forwardRef(() => CreditNotesModule)],
|
||||
@@ -15,10 +16,9 @@ import { CreditNotesModule } from '../CreditNotes/CreditNotes.module';
|
||||
RefundCreditNoteService,
|
||||
RefundSyncCreditNoteBalanceService,
|
||||
CreditNotesRefundsApplication,
|
||||
GetCreditNoteRefundsService,
|
||||
],
|
||||
exports: [
|
||||
RefundSyncCreditNoteBalanceService
|
||||
],
|
||||
exports: [RefundSyncCreditNoteBalanceService],
|
||||
controllers: [CreditNoteRefundsController],
|
||||
})
|
||||
export class CreditNoteRefundsModule {}
|
||||
|
||||
@@ -5,16 +5,27 @@ import { DeleteRefundCreditNoteService } from './commands/DeleteRefundCreditNote
|
||||
import { RefundCreditNoteService } from './commands/RefundCreditNote.service';
|
||||
import { RefundSyncCreditNoteBalanceService } from './commands/RefundSyncCreditNoteBalance';
|
||||
import { CreditNoteRefundDto } from './dto/CreditNoteRefund.dto';
|
||||
import { GetCreditNoteRefundsService } from './queries/GetCreditNoteRefunds.service';
|
||||
|
||||
@Injectable()
|
||||
export class CreditNotesRefundsApplication {
|
||||
constructor(
|
||||
private readonly createRefundCreditNoteService: CreateRefundCreditNoteService,
|
||||
private readonly deleteRefundCreditNoteService: DeleteRefundCreditNoteService,
|
||||
private readonly getCreditNoteRefundsService: GetCreditNoteRefundsService,
|
||||
private readonly refundCreditNoteService: RefundCreditNoteService,
|
||||
private readonly refundSyncCreditNoteBalanceService: RefundSyncCreditNoteBalanceService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Retrieve the credit note graph.
|
||||
* @param {number} creditNoteId - Credit note id.
|
||||
* @returns {Promise<IRefundCreditNotePOJO[]>}
|
||||
*/
|
||||
public getCreditNoteRefunds(creditNoteId: number) {
|
||||
return this.getCreditNoteRefundsService.getCreditNoteRefunds(creditNoteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a refund credit note.
|
||||
* @param {number} creditNoteId - The credit note ID.
|
||||
|
||||
@@ -6,7 +6,7 @@ import { IRefundCreditNotePOJO } from '../types/CreditNoteRefunds.types';
|
||||
import { TenantModelProxy } from '@/modules/System/models/TenantBaseModel';
|
||||
|
||||
@Injectable()
|
||||
export class ListCreditNoteRefunds {
|
||||
export class GetCreditNoteRefundsService {
|
||||
constructor(
|
||||
private readonly transformer: TransformerInjectable,
|
||||
|
||||
@@ -18,7 +18,7 @@ export class ListCreditNoteRefunds {
|
||||
|
||||
/**
|
||||
* Retrieve the credit note graph.
|
||||
* @param {number} creditNoteId
|
||||
* @param {number} creditNoteId - Credit note id.
|
||||
* @returns {Promise<IRefundCreditNotePOJO[]>}
|
||||
*/
|
||||
public async getCreditNoteRefunds(
|
||||
|
||||
Reference in New Issue
Block a user