Browse Source

feat: add shuffleParam

pull/2558/head
Wing-Kam Wong 2 years ago
parent
commit
3bbe061949
  1. 13
      packages/nocodb/src/lib/meta/api/swagger/helpers/templates/params.ts
  2. 9
      packages/nocodb/src/lib/meta/api/swagger/helpers/templates/paths.ts

13
packages/nocodb/src/lib/meta/api/swagger/helpers/templates/params.ts

@ -74,6 +74,19 @@ export const offsetParam = {
example: 0 example: 0
}; };
export const shuffleParam = {
schema: {
type: 'number',
minimum: 0,
maximum: 1
},
in: 'query',
name: 'shuffle',
description:
'The `shuffle` parameter used for pagination, the response will be shuffled if it is set to 1.',
example: 0
};
export const columnNameQueryParam = { export const columnNameQueryParam = {
schema: { schema: {
type: 'string' type: 'string'

9
packages/nocodb/src/lib/meta/api/swagger/helpers/templates/paths.ts

@ -8,6 +8,7 @@ import {
getNestedParams, getNestedParams,
limitParam, limitParam,
offsetParam, offsetParam,
shuffleParam,
referencedRowIdParam, referencedRowIdParam,
relationTypeParam, relationTypeParam,
rowIdParam, rowIdParam,
@ -35,6 +36,7 @@ export const getModelPaths = async (ctx: {
sortParam, sortParam,
whereParam, whereParam,
limitParam, limitParam,
shuffleParam,
offsetParam, offsetParam,
...(await getNestedParams(ctx.columns)) ...(await getNestedParams(ctx.columns))
], ],
@ -198,6 +200,7 @@ export const getModelPaths = async (ctx: {
sortParam, sortParam,
whereParam, whereParam,
limitParam, limitParam,
shuffleParam,
offsetParam offsetParam
], ],
responses: { responses: {
@ -375,7 +378,7 @@ export const getModelPaths = async (ctx: {
} }
}, },
tags: [ctx.tableName], tags: [ctx.tableName],
parameters: [limitParam, offsetParam] parameters: [limitParam, offsetParam, shuffleParam]
} }
}, },
[`/api/v1/db/data/${ctx.orgs}/${ctx.projectName}/${ctx.tableName}/{rowId}/{relationType}/{columnName}/{refRowId}`]: { [`/api/v1/db/data/${ctx.orgs}/${ctx.projectName}/${ctx.tableName}/{rowId}/{relationType}/{columnName}/{refRowId}`]: {
@ -399,7 +402,7 @@ export const getModelPaths = async (ctx: {
} }
}, },
tags: [ctx.tableName], tags: [ctx.tableName],
parameters: [limitParam, offsetParam], parameters: [limitParam, offsetParam, shuffleParam],
description: '' description: ''
}, },
delete: { delete: {
@ -439,7 +442,7 @@ export const getModelPaths = async (ctx: {
} }
}, },
tags: [ctx.tableName], tags: [ctx.tableName],
parameters: [limitParam, offsetParam] parameters: [limitParam, offsetParam, shuffleParam]
} }
} }
} }

Loading…
Cancel
Save