mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
feat(server): endpoints swagger docs
This commit is contained in:
@@ -2,8 +2,14 @@ import { Response } from 'express';
|
||||
import { Controller, Get, Headers, Query, Res } from '@nestjs/common';
|
||||
import { APAgingSummaryApplication } from './APAgingSummaryApplication';
|
||||
import { AcceptType } from '@/constants/accept-type';
|
||||
import { ApiOperation, ApiProduces, ApiTags } from '@nestjs/swagger';
|
||||
import {
|
||||
ApiOperation,
|
||||
ApiProduces,
|
||||
ApiResponse,
|
||||
ApiTags,
|
||||
} from '@nestjs/swagger';
|
||||
import { APAgingSummaryQueryDto } from './APAgingSummaryQuery.dto';
|
||||
import { APAgingSummaryResponseExample } from './APAgingSummary.swagger';
|
||||
|
||||
@Controller('reports/payable-aging-summary')
|
||||
@ApiTags('Reports')
|
||||
@@ -12,6 +18,11 @@ export class APAgingSummaryController {
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'Get payable aging summary' })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'A/P aging summary response',
|
||||
example: APAgingSummaryResponseExample,
|
||||
})
|
||||
@ApiProduces(
|
||||
AcceptType.ApplicationJson,
|
||||
AcceptType.ApplicationJsonTable,
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
export const APAgingSummaryResponseExample = {
|
||||
data: {
|
||||
vendors: [
|
||||
{
|
||||
vendor_name: 'asdasd, asdasd',
|
||||
current: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
aging: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '$0.00',
|
||||
},
|
||||
},
|
||||
{
|
||||
vendor_name: 'Ahmed Bouhuolia',
|
||||
current: {
|
||||
amount: 32000,
|
||||
formatted_amount: '32,000.00',
|
||||
},
|
||||
aging: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
amount: 32000,
|
||||
formatted_amount: '$32,000.00',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
current: {
|
||||
amount: 32000,
|
||||
formatted_amount: '$32,000.00',
|
||||
},
|
||||
aging: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '$0.00',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '$0.00',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '$0.00',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
amount: 32000,
|
||||
formatted_amount: '$32,000.00',
|
||||
},
|
||||
},
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
},
|
||||
],
|
||||
query: {
|
||||
as_date: '2025-06-30',
|
||||
aging_days_before: 30,
|
||||
aging_periods: 3,
|
||||
number_format: {
|
||||
precision: 2,
|
||||
divide_on1000: false,
|
||||
show_zero: false,
|
||||
format_money: 'total',
|
||||
negative_format: 'mines',
|
||||
},
|
||||
vendors_ids: [],
|
||||
branches_ids: [],
|
||||
none_zero: false,
|
||||
},
|
||||
meta: {
|
||||
organization_name: 'BIGCAPITAL, INC',
|
||||
base_currency: 'USD',
|
||||
date_format: 'DD MMM yyyy',
|
||||
is_cost_compute_running: false,
|
||||
sheet_name: 'A/P Aging Summary',
|
||||
formatted_as_date: '2025/06/30',
|
||||
formatted_date_range: 'As 2025/06/30',
|
||||
},
|
||||
};
|
||||
@@ -3,8 +3,14 @@ import { Query, Res } from '@nestjs/common';
|
||||
import { ARAgingSummaryApplication } from './ARAgingSummaryApplication';
|
||||
import { AcceptType } from '@/constants/accept-type';
|
||||
import { Response } from 'express';
|
||||
import { ApiOperation, ApiProduces, ApiTags } from '@nestjs/swagger';
|
||||
import {
|
||||
ApiOperation,
|
||||
ApiProduces,
|
||||
ApiResponse,
|
||||
ApiTags,
|
||||
} from '@nestjs/swagger';
|
||||
import { ARAgingSummaryQueryDto } from './ARAgingSummaryQuery.dto';
|
||||
import { ARAgingSummaryResponseExample } from './ARAgingSummary.swagger';
|
||||
|
||||
@Controller('reports/receivable-aging-summary')
|
||||
@ApiTags('Reports')
|
||||
@@ -13,6 +19,11 @@ export class ARAgingSummaryController {
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'Get receivable aging summary' })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: 'Receivable aging summary response',
|
||||
example: ARAgingSummaryResponseExample,
|
||||
})
|
||||
@ApiProduces(
|
||||
AcceptType.ApplicationJson,
|
||||
AcceptType.ApplicationJsonTable,
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
export const ARAgingSummaryResponseExample = {
|
||||
query: {
|
||||
as_date: '2025-06-30',
|
||||
aging_days_before: 30,
|
||||
aging_periods: 3,
|
||||
number_format: {
|
||||
divide_on1000: false,
|
||||
negative_format: 'mines',
|
||||
show_zero: false,
|
||||
format_money: 'total',
|
||||
precision: 2,
|
||||
},
|
||||
customers_ids: [],
|
||||
branches_ids: [],
|
||||
none_zero: false,
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
},
|
||||
],
|
||||
data: {
|
||||
customers: [
|
||||
{
|
||||
customer_name: 'business',
|
||||
current: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
aging: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
total: {
|
||||
amount: 5000,
|
||||
formatted_amount: '5,000.00',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
amount: 5000,
|
||||
formatted_amount: '$5,000.00',
|
||||
},
|
||||
},
|
||||
{
|
||||
customer_name: 'business',
|
||||
current: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
aging: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '$0.00',
|
||||
},
|
||||
},
|
||||
{
|
||||
customer_name: 'asdsadasd, asd',
|
||||
current: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
aging: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '$0.00',
|
||||
},
|
||||
},
|
||||
{
|
||||
customer_name: 'Ahmed Bouhuolia',
|
||||
current: {
|
||||
amount: 300000,
|
||||
formatted_amount: '300,000.00',
|
||||
},
|
||||
aging: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
amount: 300000,
|
||||
formatted_amount: '$300,000.00',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
current: {
|
||||
amount: 300000,
|
||||
formatted_amount: '$300,000.00',
|
||||
},
|
||||
aging: [
|
||||
{
|
||||
from_period: '2025-06-30',
|
||||
to_period: '2025-05-31',
|
||||
before_days: 0,
|
||||
to_days: 30,
|
||||
total: {
|
||||
amount: 5000,
|
||||
formatted_amount: '$5,000.00',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-31',
|
||||
to_period: '2025-05-01',
|
||||
before_days: 31,
|
||||
to_days: 60,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '$0.00',
|
||||
},
|
||||
},
|
||||
{
|
||||
from_period: '2025-05-01',
|
||||
to_period: null,
|
||||
before_days: 61,
|
||||
to_days: null,
|
||||
total: {
|
||||
amount: 0,
|
||||
formatted_amount: '$0.00',
|
||||
},
|
||||
},
|
||||
],
|
||||
total: {
|
||||
amount: 305000,
|
||||
formatted_amount: '$305,000.00',
|
||||
},
|
||||
},
|
||||
},
|
||||
meta: {
|
||||
organization_name: 'BIGCAPITAL, INC',
|
||||
base_currency: 'USD',
|
||||
date_format: 'DD MMM yyyy',
|
||||
is_cost_compute_running: false,
|
||||
sheet_name: 'A/R Aging Summary',
|
||||
formatted_as_date: '2025/06/30',
|
||||
formatted_date_range: 'As 2025/06/30',
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user