Compare commits
No commits in common. "39b932a81c22fd54fbf9ae059b340eb16c9a70e4" and "c3aa88c212a65789732708157f8c4c56c8d60c29" have entirely different histories.
39b932a81c
...
c3aa88c212
13
.drone.yml
13
.drone.yml
@ -92,18 +92,7 @@ steps:
|
|||||||
tags:
|
tags:
|
||||||
- $DRONE_TAG
|
- $DRONE_TAG
|
||||||
registry: registry.odit.services
|
registry: registry.odit.services
|
||||||
- name: trigger lib build
|
|
||||||
depends_on: [clone]
|
|
||||||
image: plugins/downstream
|
|
||||||
settings:
|
|
||||||
server: https://ci.odit.services/
|
|
||||||
token:
|
|
||||||
from_secret: BOT_DRONE_KEY
|
|
||||||
fork: false
|
|
||||||
repositories:
|
|
||||||
- lfk/lib
|
|
||||||
params:
|
|
||||||
- SOURCE_TAG: $DRONE_TAG
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -133,4 +133,3 @@ build
|
|||||||
*.sqlite
|
*.sqlite
|
||||||
*.sqlite-jurnal
|
*.sqlite-jurnal
|
||||||
docs
|
docs
|
||||||
lib
|
|
@ -38,11 +38,11 @@
|
|||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"routing-controllers": "^0.9.0-alpha.6",
|
"routing-controllers": "^0.9.0-alpha.6",
|
||||||
"routing-controllers-openapi": "^2.1.0",
|
"routing-controllers-openapi": "^2.1.0",
|
||||||
"sqlite3": "^5.0.0",
|
|
||||||
"swagger-ui-express": "^4.1.5",
|
"swagger-ui-express": "^4.1.5",
|
||||||
"typeorm": "^0.2.29",
|
"typeorm": "^0.2.29",
|
||||||
"typeorm-routing-controllers-extensions": "^0.2.0",
|
"typeorm-routing-controllers-extensions": "^0.2.0",
|
||||||
"typeorm-seeding": "^1.6.1",
|
"typeorm-seeding": "^1.6.1",
|
||||||
|
"sqlite3": "^5.0.0",
|
||||||
"uuid": "^8.3.1"
|
"uuid": "^8.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -56,7 +56,6 @@
|
|||||||
"axios": "^0.21.0",
|
"axios": "^0.21.0",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
"nodemon": "^2.0.6",
|
"nodemon": "^2.0.6",
|
||||||
"rimraf": "^2.7.1",
|
|
||||||
"start-server-and-test": "^1.11.6",
|
"start-server-and-test": "^1.11.6",
|
||||||
"ts-jest": "^26.4.4",
|
"ts-jest": "^26.4.4",
|
||||||
"ts-node": "^9.0.0",
|
"ts-node": "^9.0.0",
|
||||||
@ -70,8 +69,7 @@
|
|||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watchAll",
|
"test:watch": "jest --watchAll",
|
||||||
"test:ci": "start-server-and-test dev http://localhost:4010/api/openapi.json test",
|
"test:ci": "start-server-and-test dev http://localhost:4010/api/openapi.json test",
|
||||||
"seed": "ts-node ./node_modules/typeorm/cli.js schema:sync && ts-node ./node_modules/typeorm-seeding/dist/cli.js seed",
|
"seed": "ts-node ./node_modules/typeorm/cli.js schema:sync && ts-node ./node_modules/typeorm-seeding/dist/cli.js seed"
|
||||||
"openapi:export": "ts-node src/openapi_export.ts"
|
|
||||||
},
|
},
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
"ignore": [
|
"ignore": [
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
import { validationMetadatasToSchemas } from 'class-validator-jsonschema';
|
|
||||||
import consola from "consola";
|
|
||||||
import fs from "fs";
|
|
||||||
import "reflect-metadata";
|
|
||||||
import { createExpressServer, getMetadataArgsStorage } from "routing-controllers";
|
|
||||||
import { routingControllersToSpec } from 'routing-controllers-openapi';
|
|
||||||
import authchecker from "./authchecker";
|
|
||||||
import { config } from './config';
|
|
||||||
import { ErrorHandler } from './middlewares/ErrorHandler';
|
|
||||||
|
|
||||||
const CONTROLLERS_FILE_EXTENSION = process.env.NODE_ENV === 'production' ? 'js' : 'ts';
|
|
||||||
createExpressServer({
|
|
||||||
authorizationChecker: authchecker,
|
|
||||||
middlewares: [ErrorHandler],
|
|
||||||
development: config.development,
|
|
||||||
cors: true,
|
|
||||||
routePrefix: "/api",
|
|
||||||
controllers: [`${__dirname}/controllers/*.${CONTROLLERS_FILE_EXTENSION}`],
|
|
||||||
});
|
|
||||||
|
|
||||||
const storage = getMetadataArgsStorage();
|
|
||||||
const schemas = validationMetadatasToSchemas({
|
|
||||||
refPointerPrefix: "#/components/schemas/",
|
|
||||||
});
|
|
||||||
|
|
||||||
//Spec creation based on the previously created schemas
|
|
||||||
const spec = routingControllersToSpec(
|
|
||||||
storage,
|
|
||||||
{
|
|
||||||
routePrefix: "/api"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
components: {
|
|
||||||
schemas,
|
|
||||||
"securitySchemes": {
|
|
||||||
"AuthToken": {
|
|
||||||
"type": "http",
|
|
||||||
"scheme": "bearer",
|
|
||||||
"bearerFormat": "JWT"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
info: {
|
|
||||||
description: "The the backend API for the LfK! runner system.",
|
|
||||||
title: "LfK! Backend API",
|
|
||||||
version: "1.0.0",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
|
||||||
fs.writeFileSync("./openapi.json", JSON.stringify(spec), { encoding: "utf-8" });
|
|
||||||
consola.success("Exported openapi spec to openapi.json");
|
|
||||||
} catch (error) {
|
|
||||||
consola.error("Couldn't export the openapi spec");
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user