Updating application output schema.

This commit is contained in:
mike12345567 2022-02-28 11:29:48 +00:00
parent 716bc5acf1
commit c4f5b42a90
4 changed files with 138 additions and 6 deletions

View File

@ -445,9 +445,11 @@
"type": "object", "type": "object",
"properties": { "properties": {
"name": { "name": {
"description": "The name of the app.",
"type": "string" "type": "string"
}, },
"url": { "url": {
"description": "The URL by which the app is accessed, this must be URL encoded.",
"type": "string" "type": "string"
} }
}, },
@ -463,15 +465,54 @@
"type": "object", "type": "object",
"properties": { "properties": {
"name": { "name": {
"description": "The name of the app.",
"type": "string" "type": "string"
}, },
"url": { "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" "type": "string"
} }
}, },
"required": [ "required": [
"name", "name",
"url" "url",
"status",
"createdAt",
"updatedAt",
"version",
"appId"
] ]
} }
}, },

View File

@ -320,8 +320,10 @@ components:
type: object type: object
properties: properties:
name: name:
description: The name of the app.
type: string type: string
url: url:
description: The URL by which the app is accessed, this must be URL encoded.
type: string type: string
required: required:
- name - name
@ -333,12 +335,47 @@ components:
type: object type: object
properties: properties:
name: name:
description: The name of the app.
type: string type: string
url: 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 type: string
required: required:
- name - name
- url - url
- status
- createdAt
- updatedAt
- version
- appId
required: required:
- application - application
row: row:

View File

@ -15,16 +15,69 @@ const application = {
lockedBy: userResource.getExamples().user.value.user, 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", 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", type: "string",
}, },
}, },
{ required: ["name", "url"] } {
required: [
"name",
"url",
"status",
"createdAt",
"updatedAt",
"version",
"appId",
],
}
) )
module.exports = new Resource() module.exports = new Resource()
@ -43,6 +96,6 @@ module.exports = new Resource()
.setSchemas({ .setSchemas({
application: applicationSchema, application: applicationSchema,
applicationOutput: object({ applicationOutput: object({
application: applicationSchema, application: applicationSchemaOutput,
}), }),
}) })

View File

@ -263,6 +263,7 @@ exports.create = async ctx => {
tenantId: getTenantId(), tenantId: getTenantId(),
updatedAt: new Date().toISOString(), updatedAt: new Date().toISOString(),
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
status: AppStatus.DEV,
} }
const response = await db.put(newApplication, { force: true }) const response = await db.put(newApplication, { force: true })
newApplication._rev = response.rev newApplication._rev = response.rev