mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
feat(nestjs): migrate to NestJS
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import { CreditNoteApplication } from './CreditNoteApplication.service';
|
||||
import { ICreditNotesQueryDTO } from './types/CreditNotes.types';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { CreateCreditNoteDto, EditCreditNoteDto } from './dtos/CreditNote.dto';
|
||||
|
||||
@Controller('credit-notes')
|
||||
@ApiTags('credit-notes')
|
||||
export class CreditNotesController {
|
||||
/**
|
||||
* @param {CreditNoteApplication} creditNoteApplication - The credit note application service.
|
||||
*/
|
||||
constructor(private creditNoteApplication: CreditNoteApplication) {}
|
||||
|
||||
@Post()
|
||||
createCreditNote(@Body() creditNoteDTO: CreateCreditNoteDto) {
|
||||
return this.creditNoteApplication.createCreditNote(creditNoteDTO);
|
||||
}
|
||||
|
||||
@Get()
|
||||
getCreditNotes(@Query() creditNotesQuery: ICreditNotesQueryDTO) {
|
||||
return this.creditNoteApplication.getCreditNotes(creditNotesQuery);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
editCreditNote(
|
||||
@Param('id') creditNoteId: number,
|
||||
@Body() creditNoteDTO: EditCreditNoteDto,
|
||||
) {
|
||||
return this.creditNoteApplication.editCreditNote(
|
||||
creditNoteId,
|
||||
creditNoteDTO,
|
||||
);
|
||||
}
|
||||
|
||||
@Put(':id/open')
|
||||
openCreditNote(@Param('id') creditNoteId: number) {
|
||||
return this.creditNoteApplication.openCreditNote(creditNoteId);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
deleteCreditNote(@Param('id') creditNoteId: number) {
|
||||
return this.creditNoteApplication.deleteCreditNote(creditNoteId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user