Skip to content

Commit

Permalink
✨ Added pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
naelob committed Aug 5, 2024
1 parent 00a0b57 commit 9fec88f
Show file tree
Hide file tree
Showing 86 changed files with 2,810 additions and 197 deletions.
16 changes: 0 additions & 16 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,14 +739,6 @@
"api-reference/webhooks/update"
]
},
{
"group": "Linked Users",
"pages": [
"api-reference/linked_users/create",
"api-reference/linked_users/list",
"api-reference/linked_users/retrieve"
]
},
{
"group": "Organisations",
"pages": [
Expand All @@ -767,14 +759,6 @@
"api-reference/events/retrieve-events"
]
},
{
"group": "Magic Links",
"pages": [
"api-reference/magic-link/create-a-magic-link",
"api-reference/magic-link/retrieve-magic-links",
"api-reference/magic-link/retrieve-a-magic-link"
]
},
{
"group": "Passthrough",
"pages": [
Expand Down
2 changes: 1 addition & 1 deletion packages/api/scripts/commonObject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ private connectionUtils: ConnectionUtils
@UseGuards(ApiKeyAuthGuard) @Get()
async list(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try{
const { linkedUserId, remoteSource } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { IsBoolean, IsNumber, IsOptional, IsUUID } from 'class-validator';
// To provide a default limit
const DEFAULT_PAGE_SIZE = 50;

export class FetchObjectsQueryDto {
export class QueryDto {
@ApiProperty({
type: Boolean,
name: 'remote_data',
example: true,
description: 'Set to true to include data from the original software.',
required: false,
})
Expand All @@ -19,7 +21,9 @@ export class FetchObjectsQueryDto {
remote_data: boolean;

@ApiProperty({
type: Number,
name: 'limit',
example: 10,
required: false,
description: 'Set to get the number of records.',
})
Expand All @@ -29,6 +33,8 @@ export class FetchObjectsQueryDto {
limit: number = DEFAULT_PAGE_SIZE;

@ApiProperty({
type: String,
example: '1b8b05bb-5273-4012-b520-8657b0b90874',
name: 'cursor',
required: false,
description: 'Set to get the number of records after this cursor.',
Expand Down
13 changes: 11 additions & 2 deletions packages/api/src/accounting/account/account.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { AccountService } from './services/account.service';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import {
ApiGetCustomResponse,
ApiPaginatedResponse,
Expand Down Expand Up @@ -58,10 +58,19 @@ export class AccountController {
})
@ApiPaginatedResponse(UnifiedAccountingAccountOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getAccounts(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
13 changes: 11 additions & 2 deletions packages/api/src/accounting/address/address.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './types/model.unified';
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import {
ApiGetCustomResponse,
ApiPaginatedResponse,
Expand Down Expand Up @@ -57,10 +57,19 @@ export class AddressController {
})
@ApiPaginatedResponse(UnifiedAccountingAddressOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getAddresss(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
13 changes: 11 additions & 2 deletions packages/api/src/accounting/attachment/attachment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './types/model.unified';
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import {
ApiGetCustomResponse,
ApiPaginatedResponse,
Expand Down Expand Up @@ -58,10 +58,19 @@ export class AttachmentController {
})
@ApiPaginatedResponse(UnifiedAccountingAttachmentOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getAttachments(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './types/model.unified';
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import { ApiGetCustomResponse, ApiPaginatedResponse } from '@@core/utils/dtos/openapi.respone.dto';


Expand All @@ -54,10 +54,19 @@ export class BalanceSheetController {
})
@ApiPaginatedResponse(UnifiedAccountingBalancesheetOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getBalanceSheets(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './types/model.unified';
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import { ApiGetCustomResponse, ApiPaginatedResponse } from '@@core/utils/dtos/openapi.respone.dto';


Expand All @@ -54,10 +54,19 @@ export class CashflowStatementController {
})
@ApiPaginatedResponse(UnifiedAccountingCashflowstatementOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getCashflowStatements(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
13 changes: 11 additions & 2 deletions packages/api/src/accounting/companyinfo/companyinfo.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './types/model.unified';
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import { ApiGetCustomResponse, ApiPaginatedResponse } from '@@core/utils/dtos/openapi.respone.dto';


Expand All @@ -54,10 +54,19 @@ export class CompanyInfoController {
})
@ApiPaginatedResponse(UnifiedAccountingCompanyinfoOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getCompanyInfos(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
13 changes: 11 additions & 2 deletions packages/api/src/accounting/contact/contact.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './types/model.unified';
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import {
ApiGetCustomResponse,
ApiPaginatedResponse,
Expand Down Expand Up @@ -58,10 +58,19 @@ export class ContactController {
})
@ApiPaginatedResponse(UnifiedAccountingContactOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getContacts(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
13 changes: 11 additions & 2 deletions packages/api/src/accounting/creditnote/creditnote.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './types/model.unified';
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import {
ApiGetCustomResponse,
ApiPaginatedResponse,
Expand Down Expand Up @@ -57,10 +57,19 @@ export class CreditNoteController {
})
@ApiPaginatedResponse(UnifiedAccountingCreditnoteOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getCreditNotes(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
13 changes: 11 additions & 2 deletions packages/api/src/accounting/expense/expense.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './types/model.unified';
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import {
ApiGetCustomResponse,
ApiPaginatedResponse,
Expand Down Expand Up @@ -58,10 +58,19 @@ export class ExpenseController {
})
@ApiPaginatedResponse(UnifiedAccountingExpenseOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getExpenses(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from './types/model.unified';
import { ConnectionUtils } from '@@core/connections/@utils';
import { ApiKeyAuthGuard } from '@@core/auth/guards/api-key.guard';
import { FetchObjectsQueryDto } from '@@core/utils/dtos/fetch-objects-query.dto';
import { QueryDto } from '@@core/utils/dtos/query.dto';
import { ApiGetCustomResponse, ApiPaginatedResponse } from '@@core/utils/dtos/openapi.respone.dto';


Expand All @@ -54,10 +54,19 @@ export class IncomeStatementController {
})
@ApiPaginatedResponse(UnifiedAccountingIncomestatementOutput)
@UseGuards(ApiKeyAuthGuard)
@ApiQuery({
type: QueryDto,
example: {
remote_data: true,
limit: 10,
cursor: 'b008e199-eda9-4629-bd41-a01b6195864a',
},
required: false,
})
@Get()
async getIncomeStatements(
@Headers('x-connection-token') connection_token: string,
@Query() query: FetchObjectsQueryDto,
@Query() query: QueryDto,
) {
try {
const { linkedUserId, remoteSource, connectionId, projectId } =
Expand Down
Loading

0 comments on commit 9fec88f

Please sign in to comment.