89 lines
2.1 KiB
TypeScript
89 lines
2.1 KiB
TypeScript
import type { OpenAPIV3_1 } from "openapi-types";
|
|
|
|
export const datamartAddSpec: OpenAPIV3_1.PathsObject = {
|
|
"/api/datamart": {
|
|
post: {
|
|
summary: "New datamart query",
|
|
description:
|
|
"Creates a new query entry in the datamart. Must be called on the main server. The SQL can be provided as a file upload.",
|
|
tags: ["Datamart"],
|
|
requestBody: {
|
|
required: true,
|
|
content: {
|
|
"multipart/form-data": {
|
|
schema: {
|
|
type: "object",
|
|
required: ["name", "description", "queryFile"],
|
|
properties: {
|
|
name: {
|
|
type: "string",
|
|
example: "active_av",
|
|
description: "Unique name for the query",
|
|
},
|
|
description: {
|
|
type: "string",
|
|
example: "Gets active audio/visual records",
|
|
description: "Short explanation of what this query does",
|
|
},
|
|
options: {
|
|
type: "string",
|
|
example: "foo,baz",
|
|
description:
|
|
"Optional comma separated options string passed to the query",
|
|
},
|
|
publicAccess: {
|
|
type: "boolean",
|
|
example: "true",
|
|
description:
|
|
"Will this query be accessible by the frontend's",
|
|
},
|
|
queryFile: {
|
|
type: "string",
|
|
format: "binary",
|
|
description: "SQL file containing the query text",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
responses: {
|
|
"200": {
|
|
description: "Query successfully created",
|
|
content: {
|
|
"application/json": {
|
|
schema: {
|
|
type: "object",
|
|
properties: {
|
|
success: { type: "boolean", example: true },
|
|
message: {
|
|
type: "string",
|
|
example: "active_av was just added",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
"400": {
|
|
description: "Validation or input error",
|
|
content: {
|
|
"application/json": {
|
|
schema: {
|
|
type: "object",
|
|
properties: {
|
|
success: { type: "boolean", example: false },
|
|
message: {
|
|
type: "string",
|
|
example: "Validation failed",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|