mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: more response docs
This commit is contained in:
@@ -13,6 +13,7 @@ import { CreateAccountDTO } from './CreateAccount.dto';
|
||||
import { EditAccountDTO } from './EditAccount.dto';
|
||||
import { IAccountsFilter, IAccountsTransactionsFilter } from './Accounts.types';
|
||||
import {
|
||||
ApiExtraModels,
|
||||
ApiOperation,
|
||||
ApiParam,
|
||||
ApiResponse,
|
||||
@@ -20,9 +21,12 @@ import {
|
||||
getSchemaPath,
|
||||
} from '@nestjs/swagger';
|
||||
import { AccountResponseDto } from './dtos/AccountResponse.dto';
|
||||
import { AccountTypeResponseDto } from './dtos/AccountTypeResponse.dto';
|
||||
|
||||
@Controller('accounts')
|
||||
@ApiTags('Accounts')
|
||||
@ApiExtraModels(AccountResponseDto)
|
||||
@ApiExtraModels(AccountTypeResponseDto)
|
||||
export class AccountsController {
|
||||
constructor(private readonly accountsApplication: AccountsApplication) {}
|
||||
|
||||
@@ -112,6 +116,9 @@ export class AccountsController {
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'The account types have been successfully retrieved.',
|
||||
schema: {
|
||||
$ref: getSchemaPath(AccountTypeResponseDto),
|
||||
},
|
||||
})
|
||||
async getAccountTypes() {
|
||||
return this.accountsApplication.getAccountTypes();
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { ApiProperty, ApiExtraModels } from '@nestjs/swagger';
|
||||
|
||||
export class AccountTypeResponseDto {
|
||||
@ApiProperty({
|
||||
description: 'The display label for the account type',
|
||||
example: 'Cash',
|
||||
})
|
||||
label: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'The unique key for the account type',
|
||||
example: 'cash',
|
||||
})
|
||||
key: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'The normal balance type for the account',
|
||||
example: 'debit',
|
||||
})
|
||||
normal: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'The parent type of the account',
|
||||
example: 'current-asset',
|
||||
})
|
||||
parentType: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'The root type of the account',
|
||||
example: 'asset',
|
||||
})
|
||||
rootType: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Whether the account type supports multiple currencies',
|
||||
example: true,
|
||||
})
|
||||
multiCurrency: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Whether the account type appears on the balance sheet',
|
||||
example: true,
|
||||
})
|
||||
balanceSheet: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Whether the account type appears on the income sheet',
|
||||
example: false,
|
||||
})
|
||||
incomeSheet: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user