Browse Source

Review comments and linting.

master
mike12345567 5 years ago
parent
commit
dadf3fef02
  1. 54
      packages/server/specs/openapi.json
  2. 21
      packages/server/specs/openapi.yaml
  3. 9
      packages/server/specs/resources/query.js
  4. 9
      packages/server/specs/resources/row.js
  5. 4
      packages/server/src/api/controllers/public/mapping/applications.ts
  6. 4
      packages/server/src/api/controllers/public/mapping/queries.ts
  7. 4
      packages/server/src/api/controllers/public/mapping/rows.ts
  8. 4
      packages/server/src/api/controllers/public/mapping/tables.ts
  9. 6
      packages/server/src/api/controllers/public/mapping/types.ts
  10. 4
      packages/server/src/api/controllers/public/mapping/users.ts
  11. 839
      packages/server/src/definitions/openapi.ts

54
packages/server/specs/openapi.json

@ -497,23 +497,7 @@
"description": "The row to be created/updated, based on the table schema.",
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "object"
},
{
"type": "integer"
},
{
"type": "array"
},
{
"type": "boolean"
}
]
"description": "Key value properties of any type, depending on the table schema."
}
},
"searchOutput": {
@ -553,23 +537,7 @@
"description": "The row to be created/updated, based on the table schema.",
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "object"
},
{
"type": "integer"
},
{
"type": "array"
},
{
"type": "boolean"
}
]
"description": "Key value properties of any type, depending on the table schema."
},
"properties": {
"_id": {
@ -1006,23 +974,7 @@
"description": "The query body must contain the required parameters for the query, this depends on query type, setup and bindings.",
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "object"
},
{
"type": "integer"
},
{
"type": "array"
},
{
"type": "boolean"
}
]
"description": "Key value properties of any type, depending on the query output schema."
}
},
"executeQueryOutput": {

21
packages/server/specs/openapi.yaml

@ -356,12 +356,7 @@ components:
description: The row to be created/updated, based on the table schema.
type: object
additionalProperties:
oneOf:
- type: string
- type: object
- type: integer
- type: array
- type: boolean
description: Key value properties of any type, depending on the table schema.
searchOutput:
type: object
required:
@ -389,12 +384,7 @@ components:
description: The row to be created/updated, based on the table schema.
type: object
additionalProperties:
oneOf:
- type: string
- type: object
- type: integer
- type: array
- type: boolean
description: Key value properties of any type, depending on the table schema.
properties:
_id:
description: The ID of the row.
@ -737,12 +727,7 @@ components:
this depends on query type, setup and bindings.
type: object
additionalProperties:
oneOf:
- type: string
- type: object
- type: integer
- type: array
- type: boolean
description: Key value properties of any type, depending on the query output schema.
executeQueryOutput:
type: object
properties:

9
packages/server/specs/resources/query.js

@ -128,13 +128,8 @@ const executeQuerySchema = {
"The query body must contain the required parameters for the query, this depends on query type, setup and bindings.",
type: "object",
additionalProperties: {
oneOf: [
{ type: "string" },
{ type: "object" },
{ type: "integer" },
{ type: "array" },
{ type: "boolean" },
],
description:
"Key value properties of any type, depending on the query output schema.",
},
}

9
packages/server/specs/resources/row.js

@ -48,13 +48,8 @@ const rowSchema = {
description: "The row to be created/updated, based on the table schema.",
type: "object",
additionalProperties: {
oneOf: [
{ type: "string" },
{ type: "object" },
{ type: "integer" },
{ type: "array" },
{ type: "boolean" },
],
description:
"Key value properties of any type, depending on the table schema.",
},
}

4
packages/server/src/api/controllers/public/mapping/applications.ts

@ -1,4 +1,4 @@
import { Application, ApplicationOutput } from "./types"
import { Application } from "./types"
function application(body: any): Application {
let app = body?.application ? body.application : body
@ -15,7 +15,7 @@ function application(body: any): Application {
}
}
function mapApplication(ctx: any): ApplicationOutput {
function mapApplication(ctx: any): { data: Application } {
return {
data: application(ctx.body),
}

4
packages/server/src/api/controllers/public/mapping/queries.ts

@ -1,4 +1,4 @@
import { Query, ExecuteQueryOutput } from "./types"
import { Query, ExecuteQuery } from "./types"
function query(body: any): Query {
return {
@ -21,7 +21,7 @@ function mapQueries(ctx: any): { data: Query[] } {
}
}
function mapQueryExecution(ctx: any): ExecuteQueryOutput {
function mapQueryExecution(ctx: any): ExecuteQuery {
// very little we can map here, structure mostly unknown
return {
data: ctx.body.data,

4
packages/server/src/api/controllers/public/mapping/rows.ts

@ -1,4 +1,4 @@
import { Row, RowSearch, RowOutput } from "./types"
import { Row, RowSearch } from "./types"
function row(body: any): Row {
delete body._rev
@ -19,7 +19,7 @@ function mapRowSearch(ctx: any): RowSearch {
}
}
function mapRow(ctx: any): RowOutput {
function mapRow(ctx: any): { data: Row } {
return {
data: row(ctx.body),
}

4
packages/server/src/api/controllers/public/mapping/tables.ts

@ -1,4 +1,4 @@
import { Table, TableOutput } from "./types"
import { Table } from "./types"
function table(body: any): Table {
return {
@ -9,7 +9,7 @@ function table(body: any): Table {
}
}
function mapTable(ctx: any): TableOutput {
function mapTable(ctx: any): { data: Table } {
return {
data: table(ctx.body),
}

6
packages/server/src/api/controllers/public/mapping/types.ts

@ -1,17 +1,13 @@
import { components } from "../../../../definitions/openapi"
export type Query = components["schemas"]["query"]
export type ExecuteQueryOutput = components["schemas"]["executeQueryOutput"]
export type ExecuteQuery = components["schemas"]["executeQueryOutput"]
export type Application = components["schemas"]["applicationOutput"]["data"]
export type ApplicationOutput = components["schemas"]["applicationOutput"]
export type Table = components["schemas"]["tableOutput"]["data"]
export type TableOutput = components["schemas"]["tableOutput"]
export type Row = components["schemas"]["rowOutput"]["data"]
export type RowOutput = components["schemas"]["rowOutput"]
export type RowSearch = components["schemas"]["searchOutput"]
export type User = components["schemas"]["userOutput"]["data"]
export type UserOutput = components["schemas"]["userOutput"]

4
packages/server/src/api/controllers/public/mapping/users.ts

@ -1,4 +1,4 @@
import { User, UserOutput } from "./types"
import { User } from "./types"
function user(body: any): User {
return {
@ -15,7 +15,7 @@ function user(body: any): User {
}
}
function mapUser(ctx: any): UserOutput {
function mapUser(ctx: any): { data: User } {
return {
data: user(ctx.body),
}

839
packages/server/src/definitions/openapi.ts

File diff suppressed because it is too large
Loading…
Cancel
Save