Updating table schema and adding query endpoints.
This commit is contained in:
parent
6cbf186ead
commit
e71dda53bf
|
@ -183,31 +183,187 @@
|
||||||
"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": {
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
"string",
|
"link"
|
||||||
"longform",
|
],
|
||||||
"options",
|
"description": "A relationship column."
|
||||||
"number",
|
},
|
||||||
"boolean",
|
"constraints": {
|
||||||
"array",
|
"type": "object",
|
||||||
"datetime",
|
"description": "A constraint can be applied to the column which will be validated against when a row is saved.",
|
||||||
"attachment",
|
"properties": {
|
||||||
"link",
|
"type": {
|
||||||
"formula",
|
"type": "string",
|
||||||
"auto",
|
"enum": [
|
||||||
"json",
|
"string",
|
||||||
"internal"
|
"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",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"string",
|
||||||
|
"longform",
|
||||||
|
"options",
|
||||||
|
"number",
|
||||||
|
"boolean",
|
||||||
|
"array",
|
||||||
|
"datetime",
|
||||||
|
"attachment",
|
||||||
|
"link",
|
||||||
|
"formula",
|
||||||
|
"auto",
|
||||||
|
"json",
|
||||||
|
"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,30 +123,163 @@ 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:
|
||||||
type: object
|
oneOf:
|
||||||
additionalProperties:
|
- type: object
|
||||||
type: object
|
properties:
|
||||||
properties:
|
type:
|
||||||
type:
|
type: string
|
||||||
type: string
|
enum:
|
||||||
enum:
|
- link
|
||||||
- string
|
description: A relationship column.
|
||||||
- longform
|
constraints:
|
||||||
- options
|
type: object
|
||||||
- number
|
description: A constraint can be applied to the column which will be validated
|
||||||
- boolean
|
against when a row is saved.
|
||||||
- array
|
properties:
|
||||||
- datetime
|
type:
|
||||||
- attachment
|
type: string
|
||||||
- link
|
enum:
|
||||||
- formula
|
- string
|
||||||
- auto
|
- number
|
||||||
- json
|
- object
|
||||||
- internal
|
- 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
|
||||||
|
properties:
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- string
|
||||||
|
- longform
|
||||||
|
- options
|
||||||
|
- number
|
||||||
|
- boolean
|
||||||
|
- array
|
||||||
|
- datetime
|
||||||
|
- attachment
|
||||||
|
- link
|
||||||
|
- formula
|
||||||
|
- auto
|
||||||
|
- json
|
||||||
|
- 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",
|
{
|
||||||
properties: {
|
type: "object",
|
||||||
type: {
|
properties: {
|
||||||
type: "string",
|
...baseColumnDef,
|
||||||
enum: Object.values(FieldTypes),
|
type: {
|
||||||
|
type: "string",
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 New Issue