mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
feat(server): endpoints swagger docs
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
import { Controller, Get, Query } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiResponse, ApiQuery } from '@nestjs/swagger';
|
||||
import {
|
||||
ApiTags,
|
||||
ApiOperation,
|
||||
ApiResponse,
|
||||
ApiQuery,
|
||||
getSchemaPath,
|
||||
ApiExtraModels,
|
||||
} from '@nestjs/swagger';
|
||||
import { BankingTransactionsApplication } from '../BankingTransactionsApplication.service';
|
||||
import { GetPendingTransactionsQueryDto } from '../dtos/GetPendingTransactionsQuery.dto';
|
||||
import { GetPendingTransactionResponseDto } from '../dtos/GetPendingTransactionResponse.dto';
|
||||
|
||||
@Controller('banking/pending')
|
||||
@ApiTags('Banking Pending Transactions')
|
||||
@ApiExtraModels(GetPendingTransactionResponseDto)
|
||||
export class BankingPendingTransactionsController {
|
||||
constructor(
|
||||
private readonly bankingTransactionsApplication: BankingTransactionsApplication,
|
||||
@@ -15,6 +24,9 @@ export class BankingPendingTransactionsController {
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Returns a list of pending bank account transactions',
|
||||
schema: {
|
||||
$ref: getSchemaPath(GetPendingTransactionResponseDto),
|
||||
},
|
||||
})
|
||||
@ApiQuery({
|
||||
name: 'page',
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNumber, IsBoolean, IsDateString } from 'class-validator';
|
||||
|
||||
export class GetPendingTransactionResponseDto {
|
||||
@ApiProperty({ description: 'Transaction amount' })
|
||||
@IsNumber()
|
||||
amount: number;
|
||||
|
||||
@ApiProperty({ description: 'Transaction date' })
|
||||
@IsDateString()
|
||||
date: Date | string;
|
||||
|
||||
@ApiProperty({ description: 'Bank account ID' })
|
||||
@IsNumber()
|
||||
accountId: number;
|
||||
|
||||
@ApiProperty({ description: 'Transaction reference number', required: false })
|
||||
@IsString()
|
||||
referenceNo: string;
|
||||
|
||||
@ApiProperty({ description: 'Payee', required: false })
|
||||
@IsString()
|
||||
payee: string;
|
||||
|
||||
@ApiProperty({ description: 'Transaction description', required: false })
|
||||
@IsString()
|
||||
description: string;
|
||||
|
||||
@ApiProperty({ description: 'Plaid transaction ID', required: false })
|
||||
@IsString()
|
||||
plaidTransactionId: string;
|
||||
|
||||
@ApiProperty({ description: 'Recognized transaction ID', required: false })
|
||||
@IsNumber()
|
||||
recognizedTransactionId: number;
|
||||
|
||||
@ApiProperty({ description: 'Is transaction pending?' })
|
||||
@IsBoolean()
|
||||
pending: boolean;
|
||||
|
||||
@ApiProperty({ description: 'Transaction currency code' })
|
||||
@IsString()
|
||||
currencyCode: string;
|
||||
|
||||
@ApiProperty({ description: 'Withdrawal amount' })
|
||||
@IsNumber()
|
||||
withdrawal: number;
|
||||
|
||||
@ApiProperty({ description: 'Deposit amount' })
|
||||
@IsNumber()
|
||||
deposit: number;
|
||||
|
||||
@ApiProperty({ description: 'Is deposit transaction?' })
|
||||
@IsBoolean()
|
||||
isDepositTransaction: boolean;
|
||||
|
||||
@ApiProperty({ description: 'Is withdrawal transaction?' })
|
||||
@IsBoolean()
|
||||
isWithdrawalTransaction: boolean;
|
||||
|
||||
@ApiProperty({ description: 'Formatted amount' })
|
||||
@IsString()
|
||||
formattedAmount: string;
|
||||
|
||||
@ApiProperty({ description: 'Formatted date' })
|
||||
@IsString()
|
||||
formattedDate: string;
|
||||
|
||||
@ApiProperty({ description: 'Formatted deposit amount' })
|
||||
@IsString()
|
||||
formattedDepositAmount: string;
|
||||
|
||||
@ApiProperty({ description: 'Formatted withdrawal amount' })
|
||||
@IsString()
|
||||
formattedWithdrawalAmount: string;
|
||||
}
|
||||
Reference in New Issue
Block a user