diff --git a/packages/server/specs/openapi.json b/packages/server/specs/openapi.json index 45ec142fd9..3ec5882046 100644 --- a/packages/server/specs/openapi.json +++ b/packages/server/specs/openapi.json @@ -445,9 +445,11 @@ "type": "object", "properties": { "name": { + "description": "The name of the app.", "type": "string" }, "url": { + "description": "The URL by which the app is accessed, this must be URL encoded.", "type": "string" } }, @@ -463,15 +465,54 @@ "type": "object", "properties": { "name": { + "description": "The name of the app.", "type": "string" }, "url": { + "description": "The URL by which the app is accessed, this must be URL encoded.", + "type": "string" + }, + "status": { + "description": "The status of the app, stating it if is the development or published version.", + "type": "string", + "enum": [ + "development", + "published" + ] + }, + "createdAt": { + "description": "States when the app was created, will be constant. Stored in ISO format.", + "type": "string" + }, + "updatedAt": { + "description": "States the last time the app was updated - stored in ISO format.", + "type": "string" + }, + "version": { + "description": "States the version of the Budibase client this app is currently based on.", + "type": "string" + }, + "tenantId": { + "description": "In a multi-tenant environment this will state the tenant this app is within.", + "type": "string" + }, + "lockedBy": { + "description": "The user this app is currently being built by.", + "type": "object" + }, + "appId": { + "description": "The ID of the app.", "type": "string" } }, "required": [ "name", - "url" + "url", + "status", + "createdAt", + "updatedAt", + "version", + "appId" ] } }, diff --git a/packages/server/specs/openapi.yaml b/packages/server/specs/openapi.yaml index f7059fcc8e..040cbc0b69 100644 --- a/packages/server/specs/openapi.yaml +++ b/packages/server/specs/openapi.yaml @@ -320,8 +320,10 @@ components: type: object properties: name: + description: The name of the app. type: string url: + description: The URL by which the app is accessed, this must be URL encoded. type: string required: - name @@ -333,12 +335,47 @@ components: type: object properties: name: + description: The name of the app. type: string url: + description: The URL by which the app is accessed, this must be URL encoded. + type: string + status: + description: The status of the app, stating it if is the development or + published version. + type: string + enum: + - development + - published + createdAt: + description: States when the app was created, will be constant. Stored in ISO + format. + type: string + updatedAt: + description: States the last time the app was updated - stored in ISO format. + type: string + version: + description: States the version of the Budibase client this app is currently + based on. + type: string + tenantId: + description: In a multi-tenant environment this will state the tenant this app + is within. + type: string + lockedBy: + description: The user this app is currently being built by. + type: object + appId: + description: The ID of the app. type: string required: - name - url + - status + - createdAt + - updatedAt + - version + - appId required: - application row: diff --git a/packages/server/specs/resources/application.js b/packages/server/specs/resources/application.js index cc999cd10d..4063d7ce0b 100644 --- a/packages/server/specs/resources/application.js +++ b/packages/server/specs/resources/application.js @@ -15,16 +15,69 @@ const application = { lockedBy: userResource.getExamples().user.value.user, } -const applicationSchema = object( +const base = { + name: { + description: "The name of the app.", + type: "string", + }, + url: { + description: + "The URL by which the app is accessed, this must be URL encoded.", + type: "string", + }, +} + +const applicationSchema = object(base, { required: ["name", "url"] }) + +const applicationSchemaOutput = object( { - name: { + ...base, + status: { + description: + "The status of the app, stating it if is the development or published version.", + type: "string", + enum: ["development", "published"], + }, + createdAt: { + description: + "States when the app was created, will be constant. Stored in ISO format.", type: "string", }, - url: { + updatedAt: { + description: + "States the last time the app was updated - stored in ISO format.", + type: "string", + }, + version: { + description: + "States the version of the Budibase client this app is currently based on.", + type: "string", + }, + tenantId: { + description: + "In a multi-tenant environment this will state the tenant this app is within.", + type: "string", + }, + lockedBy: { + description: "The user this app is currently being built by.", + type: "object", + }, + appId: { + description: "The ID of the app.", type: "string", }, }, - { required: ["name", "url"] } + { + required: [ + "name", + "url", + "status", + "createdAt", + "updatedAt", + "version", + "appId", + ], + } ) module.exports = new Resource() @@ -43,6 +96,6 @@ module.exports = new Resource() .setSchemas({ application: applicationSchema, applicationOutput: object({ - application: applicationSchema, + application: applicationSchemaOutput, }), }) diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index 00d3efccb8..2ea5083859 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -263,6 +263,7 @@ exports.create = async ctx => { tenantId: getTenantId(), updatedAt: new Date().toISOString(), createdAt: new Date().toISOString(), + status: AppStatus.DEV, } const response = await db.put(newApplication, { force: true }) newApplication._rev = response.rev