Updating application output schema.
This commit is contained in:
parent
eed4111fe2
commit
2bc2d17066
|
@ -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"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
}),
|
||||
})
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue