mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
refactor: financial reports to nestjs
This commit is contained in:
@@ -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, ApiResponse, ApiTags } from '@nestjs/swagger';
|
||||
import { ApiOperation, ApiParam, ApiResponse, ApiTags } from '@nestjs/swagger';
|
||||
// import { IAccountsFilter, IAccountsTransactionsFilter } from './Accounts.types';
|
||||
// import { ZodValidationPipe } from '@/common/pipes/ZodValidation.pipe';
|
||||
|
||||
@@ -39,6 +39,13 @@ export class AccountsController {
|
||||
status: 200,
|
||||
description: 'The account has been successfully updated.',
|
||||
})
|
||||
@ApiResponse({ status: 404, description: 'The account not found.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The account id',
|
||||
})
|
||||
async editAccount(
|
||||
@Param('id', ParseIntPipe) id: number,
|
||||
@Body() accountDTO: EditAccountDTO,
|
||||
@@ -52,6 +59,13 @@ export class AccountsController {
|
||||
status: 200,
|
||||
description: 'The account has been successfully deleted.',
|
||||
})
|
||||
@ApiResponse({ status: 404, description: 'The account not found.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The account id',
|
||||
})
|
||||
async deleteAccount(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.accountsApplication.deleteAccount(id);
|
||||
}
|
||||
@@ -62,12 +76,30 @@ export class AccountsController {
|
||||
status: 200,
|
||||
description: 'The account has been successfully activated.',
|
||||
})
|
||||
@ApiResponse({ status: 404, description: 'The account not found.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The account id',
|
||||
})
|
||||
async activateAccount(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.accountsApplication.activateAccount(id);
|
||||
}
|
||||
|
||||
@Post(':id/inactivate')
|
||||
@ApiOperation({ summary: 'Inactivate the given account.' })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'The account has been successfully inactivated.',
|
||||
})
|
||||
@ApiResponse({ status: 404, description: 'The account not found.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The account id',
|
||||
})
|
||||
async inactivateAccount(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.accountsApplication.inactivateAccount(id);
|
||||
}
|
||||
@@ -98,6 +130,13 @@ export class AccountsController {
|
||||
status: 200,
|
||||
description: 'The account details have been successfully retrieved.',
|
||||
})
|
||||
@ApiResponse({ status: 404, description: 'The account not found.' })
|
||||
@ApiParam({
|
||||
name: 'id',
|
||||
required: true,
|
||||
type: Number,
|
||||
description: 'The account id',
|
||||
})
|
||||
async getAccount(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.accountsApplication.getAccount(id);
|
||||
}
|
||||
|
||||
@@ -6,32 +6,32 @@ import { Account } from './Account.model';
|
||||
// import { getTransactionTypeLabel } from '@/utils/transactions-types';
|
||||
|
||||
export class AccountTransaction extends BaseModel {
|
||||
referenceType: string;
|
||||
referenceId: number;
|
||||
accountId: number;
|
||||
contactId: number;
|
||||
credit: number;
|
||||
debit: number;
|
||||
exchangeRate: number;
|
||||
taxRate: number;
|
||||
date: Date | string;
|
||||
transactionType: string;
|
||||
currencyCode: string;
|
||||
referenceTypeFormatted: string;
|
||||
transactionNumber!: string;
|
||||
referenceNumber!: string;
|
||||
note!: string;
|
||||
public readonly referenceType: string;
|
||||
public readonly referenceId: number;
|
||||
public readonly accountId: number;
|
||||
public readonly contactId: number;
|
||||
public readonly credit: number;
|
||||
public readonly debit: number;
|
||||
public readonly exchangeRate: number;
|
||||
public readonly taxRate: number;
|
||||
public readonly date: Date | string;
|
||||
public readonly transactionType: string;
|
||||
public readonly currencyCode: string;
|
||||
public readonly referenceTypeFormatted: string;
|
||||
public readonly transactionNumber!: string;
|
||||
public readonly referenceNumber!: string;
|
||||
public readonly note!: string;
|
||||
|
||||
index!: number;
|
||||
indexGroup!: number;
|
||||
public readonly index!: number;
|
||||
public readonly indexGroup!: number;
|
||||
|
||||
taxRateId!: number;
|
||||
public readonly taxRateId!: number;
|
||||
|
||||
branchId!: number;
|
||||
userId!: number;
|
||||
itemId!: number;
|
||||
projectId!: number;
|
||||
account: Account;
|
||||
public readonly branchId!: number;
|
||||
public readonly userId!: number;
|
||||
public readonly itemId!: number;
|
||||
public readonly projectId!: number;
|
||||
public readonly account: Account;
|
||||
|
||||
/**
|
||||
* Table name
|
||||
|
||||
Reference in New Issue
Block a user