Updating table schema and adding query endpoints.
This commit is contained in:
parent
6cbf186ead
commit
e71dda53bf
6 changed files with 548 additions and 107 deletions
|
@ -183,9 +183,136 @@
|
||||||
"description": "The name of the table",
|
"description": "The name of the table",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"primaryDisplay": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The name of the column which should be used in relationship tags when relating to this table."
|
||||||
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": {
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"link"
|
||||||
|
],
|
||||||
|
"description": "A relationship column."
|
||||||
|
},
|
||||||
|
"constraints": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "A constraint can be applied to the column which will be validated against when a row is saved.",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"string",
|
||||||
|
"number",
|
||||||
|
"object",
|
||||||
|
"boolean"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"presence": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Defines whether the column is required or not."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The name of the column."
|
||||||
|
},
|
||||||
|
"autocolumn": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Defines whether the column is automatically generated."
|
||||||
|
},
|
||||||
|
"fieldName": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The name of the column which a relationship column is related to in another table."
|
||||||
|
},
|
||||||
|
"tableId": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The ID of the table which a relationship column is related to."
|
||||||
|
},
|
||||||
|
"relationshipType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"one-to-many",
|
||||||
|
"many-to-one",
|
||||||
|
"many-to-many"
|
||||||
|
],
|
||||||
|
"description": "Defines the type of relationship that this column will be used for."
|
||||||
|
},
|
||||||
|
"through": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "When using a SQL table that contains many to many relationships this defines the table the relationships are linked through."
|
||||||
|
},
|
||||||
|
"foreignKey": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "When using a SQL table that contains a one to many relationship this defines the foreign key."
|
||||||
|
},
|
||||||
|
"throughFrom": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "When using a SQL table that utilises a through table, this defines the primary key in the through table for this table."
|
||||||
|
},
|
||||||
|
"throughTo": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "When using a SQL table that utilises a through table, this defines the primary key in the through table for the related table."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"formula"
|
||||||
|
],
|
||||||
|
"description": "A formula column."
|
||||||
|
},
|
||||||
|
"constraints": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "A constraint can be applied to the column which will be validated against when a row is saved.",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"string",
|
||||||
|
"number",
|
||||||
|
"object",
|
||||||
|
"boolean"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"presence": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Defines whether the column is required or not."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The name of the column."
|
||||||
|
},
|
||||||
|
"autocolumn": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Defines whether the column is automatically generated."
|
||||||
|
},
|
||||||
|
"formula": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Defines a Handlebars or JavaScript formula to use, note that Javascript formulas are expected to be provided in the base64 format."
|
||||||
|
},
|
||||||
|
"formulaType": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"static",
|
||||||
|
"dynamic"
|
||||||
|
],
|
||||||
|
"description": "Defines whether this is a static or dynamic formula."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
|
@ -204,10 +331,39 @@
|
||||||
"auto",
|
"auto",
|
||||||
"json",
|
"json",
|
||||||
"internal"
|
"internal"
|
||||||
|
],
|
||||||
|
"description": "Defines the type of the column, most explain themselves, a link column is a relationship."
|
||||||
|
},
|
||||||
|
"constraints": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "A constraint can be applied to the column which will be validated against when a row is saved.",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"string",
|
||||||
|
"number",
|
||||||
|
"object",
|
||||||
|
"boolean"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"presence": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Defines whether the column is required or not."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The name of the column."
|
||||||
|
},
|
||||||
|
"autocolumn": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Defines whether the column is automatically generated."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,6 +375,22 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
|
"/queries/search": {
|
||||||
|
"post": {
|
||||||
|
"summary": "Search for a query based on its name.",
|
||||||
|
"tags": [
|
||||||
|
"queries"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/queries/{queryId}": {
|
||||||
|
"post": {
|
||||||
|
"summary": "Execute a query and retrieve its response.",
|
||||||
|
"tags": [
|
||||||
|
"queries"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"/tables/{tableId}/rows/search": {
|
"/tables/{tableId}/rows/search": {
|
||||||
"post": {
|
"post": {
|
||||||
"summary": "Used to search for rows within a table.",
|
"summary": "Used to search for rows within a table.",
|
||||||
|
@ -573,7 +745,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The name of the table, this should be an exact match (ignoring case)."
|
"description": "The name of the table, this is a case insensitive search using the provided name as a starts with search."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -644,37 +816,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"get": {
|
|
||||||
"summary": "Get all the tables, internal and external within an app.",
|
|
||||||
"tags": [
|
|
||||||
"tables"
|
|
||||||
],
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"$ref": "#/components/parameters/tableId"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$ref": "#/components/parameters/appId"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "Returns all of the tables which were found.",
|
|
||||||
"content": {
|
|
||||||
"application/json": {
|
|
||||||
"schema": {
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"examples": {
|
|
||||||
"table": {
|
|
||||||
"$ref": "#/components/examples/row"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/tables/:tableId": {
|
"/tables/:tableId": {
|
||||||
|
@ -725,6 +866,37 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/tables/{tableId}": {
|
"/tables/{tableId}": {
|
||||||
|
"get": {
|
||||||
|
"summary": "Get a single table by its ID, internal and external within an app.",
|
||||||
|
"tags": [
|
||||||
|
"tables"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"$ref": "#/components/parameters/tableId"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$ref": "#/components/parameters/appId"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Returns the table that was found.",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"table": {
|
||||||
|
"$ref": "#/components/examples/row"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
"summary": "Delete a single table and all of its data.",
|
"summary": "Delete a single table and all of its data.",
|
||||||
"tags": [
|
"tags": [
|
||||||
|
|
|
@ -123,10 +123,110 @@ components:
|
||||||
name:
|
name:
|
||||||
description: The name of the table
|
description: The name of the table
|
||||||
type: string
|
type: string
|
||||||
|
primaryDisplay:
|
||||||
|
type: string
|
||||||
|
description: The name of the column which should be used in relationship tags
|
||||||
|
when relating to this table.
|
||||||
schema:
|
schema:
|
||||||
|
oneOf:
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- link
|
||||||
|
description: A relationship column.
|
||||||
|
constraints:
|
||||||
type: object
|
type: object
|
||||||
additionalProperties:
|
description: A constraint can be applied to the column which will be validated
|
||||||
|
against when a row is saved.
|
||||||
|
properties:
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- string
|
||||||
|
- number
|
||||||
|
- object
|
||||||
|
- boolean
|
||||||
|
presence:
|
||||||
|
type: boolean
|
||||||
|
description: Defines whether the column is required or not.
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: The name of the column.
|
||||||
|
autocolumn:
|
||||||
|
type: boolean
|
||||||
|
description: Defines whether the column is automatically generated.
|
||||||
|
fieldName:
|
||||||
|
type: string
|
||||||
|
description: The name of the column which a relationship column is related to in
|
||||||
|
another table.
|
||||||
|
tableId:
|
||||||
|
type: string
|
||||||
|
description: The ID of the table which a relationship column is related to.
|
||||||
|
relationshipType:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- one-to-many
|
||||||
|
- many-to-one
|
||||||
|
- many-to-many
|
||||||
|
description: Defines the type of relationship that this column will be used for.
|
||||||
|
through:
|
||||||
|
type: string
|
||||||
|
description: When using a SQL table that contains many to many relationships
|
||||||
|
this defines the table the relationships are linked through.
|
||||||
|
foreignKey:
|
||||||
|
type: string
|
||||||
|
description: When using a SQL table that contains a one to many relationship
|
||||||
|
this defines the foreign key.
|
||||||
|
throughFrom:
|
||||||
|
type: string
|
||||||
|
description: When using a SQL table that utilises a through table, this defines
|
||||||
|
the primary key in the through table for this table.
|
||||||
|
throughTo:
|
||||||
|
type: string
|
||||||
|
description: When using a SQL table that utilises a through table, this defines
|
||||||
|
the primary key in the through table for the related table.
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- formula
|
||||||
|
description: A formula column.
|
||||||
|
constraints:
|
||||||
type: object
|
type: object
|
||||||
|
description: A constraint can be applied to the column which will be validated
|
||||||
|
against when a row is saved.
|
||||||
|
properties:
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- string
|
||||||
|
- number
|
||||||
|
- object
|
||||||
|
- boolean
|
||||||
|
presence:
|
||||||
|
type: boolean
|
||||||
|
description: Defines whether the column is required or not.
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: The name of the column.
|
||||||
|
autocolumn:
|
||||||
|
type: boolean
|
||||||
|
description: Defines whether the column is automatically generated.
|
||||||
|
formula:
|
||||||
|
type: string
|
||||||
|
description: Defines a Handlebars or JavaScript formula to use, note that
|
||||||
|
Javascript formulas are expected to be provided in the
|
||||||
|
base64 format.
|
||||||
|
formulaType:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- static
|
||||||
|
- dynamic
|
||||||
|
description: Defines whether this is a static or dynamic formula.
|
||||||
|
- type: object
|
||||||
properties:
|
properties:
|
||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
|
@ -144,9 +244,42 @@ components:
|
||||||
- auto
|
- auto
|
||||||
- json
|
- json
|
||||||
- internal
|
- internal
|
||||||
|
description: Defines the type of the column, most explain themselves, a link
|
||||||
|
column is a relationship.
|
||||||
|
constraints:
|
||||||
|
type: object
|
||||||
|
description: A constraint can be applied to the column which will be validated
|
||||||
|
against when a row is saved.
|
||||||
|
properties:
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- string
|
||||||
|
- number
|
||||||
|
- object
|
||||||
|
- boolean
|
||||||
|
presence:
|
||||||
|
type: boolean
|
||||||
|
description: Defines whether the column is required or not.
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: The name of the column.
|
||||||
|
autocolumn:
|
||||||
|
type: boolean
|
||||||
|
description: Defines whether the column is automatically generated.
|
||||||
security:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
paths:
|
paths:
|
||||||
|
/queries/search:
|
||||||
|
post:
|
||||||
|
summary: Search for a query based on its name.
|
||||||
|
tags:
|
||||||
|
- queries
|
||||||
|
"/queries/{queryId}":
|
||||||
|
post:
|
||||||
|
summary: Execute a query and retrieve its response.
|
||||||
|
tags:
|
||||||
|
- queries
|
||||||
"/tables/{tableId}/rows/search":
|
"/tables/{tableId}/rows/search":
|
||||||
post:
|
post:
|
||||||
summary: Used to search for rows within a table.
|
summary: Used to search for rows within a table.
|
||||||
|
@ -380,8 +513,8 @@ paths:
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
description: The name of the table, this should be an exact match (ignoring
|
description: The name of the table, this is a case insensitive search using the
|
||||||
case).
|
provided name as a starts with search.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Returns the found tables, based on the search parameters.
|
description: Returns the found tables, based on the search parameters.
|
||||||
|
@ -420,23 +553,6 @@ paths:
|
||||||
examples:
|
examples:
|
||||||
table:
|
table:
|
||||||
$ref: "#/components/examples/table"
|
$ref: "#/components/examples/table"
|
||||||
get:
|
|
||||||
summary: Get all the tables, internal and external within an app.
|
|
||||||
tags:
|
|
||||||
- tables
|
|
||||||
parameters:
|
|
||||||
- $ref: "#/components/parameters/tableId"
|
|
||||||
- $ref: "#/components/parameters/appId"
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: Returns all of the tables which were found.
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
examples:
|
|
||||||
table:
|
|
||||||
$ref: "#/components/examples/row"
|
|
||||||
/tables/:tableId:
|
/tables/:tableId:
|
||||||
put:
|
put:
|
||||||
summary: Update the specified table. This can be for internal or external tables.
|
summary: Update the specified table. This can be for internal or external tables.
|
||||||
|
@ -464,6 +580,23 @@ paths:
|
||||||
table:
|
table:
|
||||||
$ref: "#/components/examples/row"
|
$ref: "#/components/examples/row"
|
||||||
"/tables/{tableId}":
|
"/tables/{tableId}":
|
||||||
|
get:
|
||||||
|
summary: Get a single table by its ID, internal and external within an app.
|
||||||
|
tags:
|
||||||
|
- tables
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/tableId"
|
||||||
|
- $ref: "#/components/parameters/appId"
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Returns the table that was found.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
examples:
|
||||||
|
table:
|
||||||
|
$ref: "#/components/examples/row"
|
||||||
delete:
|
delete:
|
||||||
summary: Delete a single table and all of its data.
|
summary: Delete a single table and all of its data.
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
const { FieldTypes } = require("../src/constants")
|
const {
|
||||||
|
FieldTypes,
|
||||||
|
RelationshipTypes,
|
||||||
|
FormulaTypes,
|
||||||
|
} = require("../src/constants")
|
||||||
|
|
||||||
exports.row = {
|
exports.row = {
|
||||||
description: "The row to be created/updated, based on the table schema.",
|
description: "The row to be created/updated, based on the table schema.",
|
||||||
|
@ -14,6 +18,38 @@ exports.row = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const baseColumnDef = {
|
||||||
|
type: {
|
||||||
|
type: "string",
|
||||||
|
enum: Object.values(FieldTypes),
|
||||||
|
description:
|
||||||
|
"Defines the type of the column, most explain themselves, a link column is a relationship.",
|
||||||
|
},
|
||||||
|
constraints: {
|
||||||
|
type: "object",
|
||||||
|
description:
|
||||||
|
"A constraint can be applied to the column which will be validated against when a row is saved.",
|
||||||
|
properties: {
|
||||||
|
type: {
|
||||||
|
type: "string",
|
||||||
|
enum: ["string", "number", "object", "boolean"],
|
||||||
|
},
|
||||||
|
presence: {
|
||||||
|
type: "boolean",
|
||||||
|
description: "Defines whether the column is required or not.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: "string",
|
||||||
|
description: "The name of the column.",
|
||||||
|
},
|
||||||
|
autocolumn: {
|
||||||
|
type: "boolean",
|
||||||
|
description: "Defines whether the column is automatically generated.",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
exports.table = {
|
exports.table = {
|
||||||
description: "The table to be created/updated.",
|
description: "The table to be created/updated.",
|
||||||
type: "object",
|
type: "object",
|
||||||
|
@ -22,17 +58,88 @@ exports.table = {
|
||||||
description: "The name of the table",
|
description: "The name of the table",
|
||||||
type: "string",
|
type: "string",
|
||||||
},
|
},
|
||||||
|
primaryDisplay: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"The name of the column which should be used in relationship tags when relating to this table.",
|
||||||
|
},
|
||||||
schema: {
|
schema: {
|
||||||
type: "object",
|
oneOf: [
|
||||||
additionalProperties: {
|
// relationship
|
||||||
|
{
|
||||||
type: "object",
|
type: "object",
|
||||||
properties: {
|
properties: {
|
||||||
|
...baseColumnDef,
|
||||||
type: {
|
type: {
|
||||||
type: "string",
|
type: "string",
|
||||||
enum: Object.values(FieldTypes),
|
enum: [FieldTypes.LINK],
|
||||||
|
description: "A relationship column.",
|
||||||
|
},
|
||||||
|
fieldName: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"The name of the column which a relationship column is related to in another table.",
|
||||||
|
},
|
||||||
|
tableId: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"The ID of the table which a relationship column is related to.",
|
||||||
|
},
|
||||||
|
relationshipType: {
|
||||||
|
type: "string",
|
||||||
|
enum: Object.values(RelationshipTypes),
|
||||||
|
description:
|
||||||
|
"Defines the type of relationship that this column will be used for.",
|
||||||
|
},
|
||||||
|
through: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"When using a SQL table that contains many to many relationships this defines the table the relationships are linked through.",
|
||||||
|
},
|
||||||
|
foreignKey: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"When using a SQL table that contains a one to many relationship this defines the foreign key.",
|
||||||
|
},
|
||||||
|
throughFrom: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"When using a SQL table that utilises a through table, this defines the primary key in the through table for this table.",
|
||||||
|
},
|
||||||
|
throughTo: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"When using a SQL table that utilises a through table, this defines the primary key in the through table for the related table.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: "object",
|
||||||
|
properties: {
|
||||||
|
...baseColumnDef,
|
||||||
|
type: {
|
||||||
|
type: "string",
|
||||||
|
enum: [FieldTypes.FORMULA],
|
||||||
|
description: "A formula column.",
|
||||||
|
},
|
||||||
|
formula: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"Defines a Handlebars or JavaScript formula to use, note that Javascript formulas are expected to be provided in the base64 format.",
|
||||||
|
},
|
||||||
|
formulaType: {
|
||||||
|
type: "string",
|
||||||
|
enum: Object.values(FormulaTypes),
|
||||||
|
description:
|
||||||
|
"Defines whether this is a static or dynamic formula.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "object",
|
||||||
|
properties: baseColumnDef,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
7
packages/server/src/api/controllers/public/queries.js
Normal file
7
packages/server/src/api/controllers/public/queries.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
exports.search = () => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.execute = () => {
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,26 @@
|
||||||
const Router = require("@koa/router")
|
const Router = require("@koa/router")
|
||||||
|
const controller = require("../../controllers/public/queries")
|
||||||
|
|
||||||
const router = Router()
|
const router = Router()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @openapi
|
||||||
|
* /queries/search:
|
||||||
|
* post:
|
||||||
|
* summary: Search for a query based on its name.
|
||||||
|
* tags:
|
||||||
|
* - queries
|
||||||
|
*/
|
||||||
|
router.post("/queries/search", controller.search)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @openapi
|
||||||
|
* /queries/{queryId}:
|
||||||
|
* post:
|
||||||
|
* summary: Execute a query and retrieve its response.
|
||||||
|
* tags:
|
||||||
|
* - queries
|
||||||
|
*/
|
||||||
|
router.post("/queries/:queryId", controller.execute)
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|
|
@ -20,7 +20,8 @@ const router = Router()
|
||||||
* properties:
|
* properties:
|
||||||
* name:
|
* name:
|
||||||
* type: string
|
* type: string
|
||||||
* description: The name of the table, this should be an exact match (ignoring case).
|
* description: The name of the table, this is a case insensitive search using the provided
|
||||||
|
* name as a starts with search.
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Returns the found tables, based on the search parameters.
|
* description: Returns the found tables, based on the search parameters.
|
||||||
|
@ -100,9 +101,9 @@ router.put("/tables/:tableId", controller.update)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
* /tables:
|
* /tables/{tableId}:
|
||||||
* get:
|
* get:
|
||||||
* summary: Get all the tables, internal and external within an app.
|
* summary: Get a single table by its ID, internal and external within an app.
|
||||||
* tags:
|
* tags:
|
||||||
* - tables
|
* - tables
|
||||||
* parameters:
|
* parameters:
|
||||||
|
@ -110,7 +111,7 @@ router.put("/tables/:tableId", controller.update)
|
||||||
* - $ref: '#/components/parameters/appId'
|
* - $ref: '#/components/parameters/appId'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Returns all of the tables which were found.
|
* description: Returns the table that was found.
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
|
@ -119,7 +120,7 @@ router.put("/tables/:tableId", controller.update)
|
||||||
* table:
|
* table:
|
||||||
* $ref: '#/components/examples/row'
|
* $ref: '#/components/examples/row'
|
||||||
*/
|
*/
|
||||||
router.get("/tables", controller.singleRead)
|
router.get("/tables/:tableId", controller.singleRead)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @openapi
|
* @openapi
|
||||||
|
|
Loading…
Reference in a new issue