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",
"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"
]
}
},

View File

@ -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:

View File

@ -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(
{
...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",
},
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,
}),
})

View File

@ -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