diff --git a/frontend/package.json b/frontend/package.json index ec57243f00..c11440a954 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -32,7 +32,8 @@ "e2e:heroku": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn run cypress open --config baseUrl='https://unleash.herokuapp.com' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all", "gen:api": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" orval --config orval.config.js", "gen:api:demo": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://app.unleash-hosted.com/demo/docs/openapi.json yarn run gen:api", - "gen:api:sandbox": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://sandbox.getunleash.io/demo2/docs/openapi.json yarn run gen:api" + "gen:api:sandbox": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://sandbox.getunleash.io/demo2/docs/openapi.json yarn run gen:api", + "gen:api:clean": "yarn gen:api && rm -rf src/openapi/apis && sed -i '1q' src/openapi/index.ts" }, "devDependencies": { "@biomejs/biome": "1.5.1", diff --git a/frontend/src/openapi/models/getProjectApplicationsParams.ts b/frontend/src/openapi/models/getProjectApplicationsParams.ts new file mode 100644 index 0000000000..a12efff4b8 --- /dev/null +++ b/frontend/src/openapi/models/getProjectApplicationsParams.ts @@ -0,0 +1,28 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +export type GetProjectApplicationsParams = { + /** + * The search query for the application name, sdk, environment + */ + query?: string; + /** + * The number of applications to skip when returning a page. By default it is set to 0. + */ + offset?: string; + /** + * The number of applications to return in a page. By default it is set to 50. + */ + limit?: string; + /** + * The field to sort the results by. By default it is set to "createdAt". + */ + sortBy?: string; + /** + * The sort order for the sortBy. By default it is det to "asc". + */ + sortOrder?: string; +}; diff --git a/frontend/src/openapi/models/index.ts b/frontend/src/openapi/models/index.ts index 2651db6b59..0244d39115 100644 --- a/frontend/src/openapi/models/index.ts +++ b/frontend/src/openapi/models/index.ts @@ -632,6 +632,7 @@ export * from './getProjectApiTokens404'; export * from './getProjectApplications401'; export * from './getProjectApplications403'; export * from './getProjectApplications404'; +export * from './getProjectApplicationsParams'; export * from './getProjectDora401'; export * from './getProjectDora403'; export * from './getProjectDora404'; diff --git a/src/lib/features/project/project-controller.ts b/src/lib/features/project/project-controller.ts index 61543fff1b..af06abf315 100644 --- a/src/lib/features/project/project-controller.ts +++ b/src/lib/features/project/project-controller.ts @@ -38,6 +38,7 @@ import { ProjectApplicationsSchema, } from '../../openapi/spec/project-applications-schema'; import { NotFoundError } from '../../error'; +import { projectApplicationsQueryParameters } from '../../openapi/spec/project-applications-query-parameters'; export default class ProjectController extends Controller { private projectService: ProjectService; @@ -150,6 +151,7 @@ export default class ProjectController extends Controller { summary: 'Get a list of all applications for a project.', description: 'This endpoint returns an list of all the applications for a project.', + parameters: [...projectApplicationsQueryParameters], responses: { 200: createResponseSchema('projectApplicationsSchema'), ...getStandardResponses(401, 403, 404), diff --git a/src/lib/openapi/spec/project-applications-query-parameters.ts b/src/lib/openapi/spec/project-applications-query-parameters.ts new file mode 100644 index 0000000000..f970546ec2 --- /dev/null +++ b/src/lib/openapi/spec/project-applications-query-parameters.ts @@ -0,0 +1,58 @@ +import { FromQueryParams } from '../util/from-query-params'; + +export const projectApplicationsQueryParameters = [ + { + name: 'query', + schema: { + type: 'string', + example: 'first_app', + }, + description: + 'The search query for the application name, sdk, environment', + in: 'query', + }, + { + name: 'offset', + schema: { + type: 'string', + example: '50', + }, + description: + 'The number of applications to skip when returning a page. By default it is set to 0.', + in: 'query', + }, + { + name: 'limit', + schema: { + type: 'string', + example: '50', + }, + description: + 'The number of applications to return in a page. By default it is set to 50.', + in: 'query', + }, + { + name: 'sortBy', + schema: { + type: 'string', + example: 'type', + }, + description: + 'The field to sort the results by. By default it is set to "appName".', + in: 'query', + }, + { + name: 'sortOrder', + schema: { + type: 'string', + example: 'desc', + }, + description: + 'The sort order for the sortBy. By default it is det to "asc".', + in: 'query', + }, +] as const; + +export type ProjectApplicationsQueryParameters = Partial< + FromQueryParams +>;