M knexfile.ts => knexfile.ts +1 -1
@@ 20,4 20,4 @@ const config: { [key: string]: Knex.Config } = {
};
-module.exports = config;
+module.exports = config; // eslint-disable-line
M migrations/20230419111959_setup_base_db.ts => migrations/20230419111959_setup_base_db.ts +2 -3
@@ 1,7 1,8 @@
import {Knex} from "knex";
+
import {SCHEMA_NAME} from "../src/environment";
-export async function up(knex: Knex): Promise<void> {
+export async function up(knex: Readonly<Knex>): Promise<void> {
await knex.schema.createSchemaIfNotExists(SCHEMA_NAME);
await knex.schema.withSchema(SCHEMA_NAME).createTable('images', (table) => {
@@ 24,8 25,6 @@ export async function up(knex: Knex): Promise<void> {
});
}
-
export function down(): void {
return;
}
-
M migrations/20230419134314_add_servers_table.ts => migrations/20230419134314_add_servers_table.ts +4 -4
@@ 1,8 1,9 @@
import { Knex } from "knex";
+
import {SCHEMA_NAME} from "../src/environment";
-export async function up(knex: Knex): Promise<void> {
+export async function up(knex: Readonly<Knex>): Promise<void> {
await knex.schema.withSchema(SCHEMA_NAME).createTable('servers', (table) => {
table
.uuid('id')
@@ 28,7 29,6 @@ export async function up(knex: Knex): Promise<void> {
});
}
-
-export async function down(knex: Knex): Promise<void> {
+export function down(): void {
+ return;
}
-
M migrations/20230419152153_add_perms_table.ts => migrations/20230419152153_add_perms_table.ts +4 -4
@@ 1,8 1,9 @@
import { Knex } from "knex";
+
import { SCHEMA_NAME } from "../src/environment";
-export async function up(knex: Knex): Promise<void> {
+export async function up(knex: Readonly<Knex>): Promise<void> {
await knex.schema.withSchema(SCHEMA_NAME).createTable('neos_permissions', (table) => {
table
.uuid('id')
@@ 21,7 22,6 @@ export async function up(knex: Knex): Promise<void> {
});
}
-
-export async function down(knex: Knex): Promise<void> {
+export function down(): void {
+ return;
}
-
M src/index.ts => src/index.ts +4 -2
@@ 1,7 1,9 @@
-import fastify from 'fastify';
+import { join } from 'path';
+
import autoLoad from '@fastify/autoload';
+import fastify from 'fastify';
+
import {HOST, PRODUCTION } from "./environment";
-import { join } from 'path';
import {generateLogger} from "./utils/loggerUtils";
const log = generateLogger('index.ts');
M src/routes/root.ts => src/routes/root.ts +1 -1
@@ 2,7 2,7 @@ import {FastifyPluginCallback} from "fastify";
const plugin: FastifyPluginCallback = (fastify, opts, next): void => {
fastify.get("/", async(request, reply) => {
- reply.type('application/json').send({"status": "ok"});
+ await reply.type('application/json').send({"status": "ok"});
});
next();
M src/utils/configUtils.ts => src/utils/configUtils.ts +4 -2
@@ 1,10 1,12 @@
-import {TGenericBaseConfig} from "../types/genericConfig";
import * as fs from "fs";
+
+import {TGenericBaseConfig} from "../types/genericConfig";
+
import {generateLogger} from "./loggerUtils";
const log = generateLogger(('configUtils.ts'));
-export const outputConfigFile = (config: TGenericBaseConfig, outputPath: string): void => {
+export const outputConfigFile = (config: Readonly<TGenericBaseConfig>, outputPath: string): void => {
fs.writeFile(outputPath, JSON.stringify(config), (e) => {
log.error(e);
})
M src/utils/dbUtils.ts => src/utils/dbUtils.ts +2 -2
@@ 1,9 1,9 @@
-import knex, { Knex } from "knex";
import * as dotenv from 'dotenv';
+import knex, { Knex } from "knex";
dotenv.config();
-let db: Knex;
+let db: Knex; // eslint-disable-line
export const dbConn = (): Knex => {
if (!db) {
M src/utils/dockerUtils.ts => src/utils/dockerUtils.ts +1 -0
@@ 1,4 1,5 @@
import * as Dockerode from "dockerode";
+
import {generateLogger} from "./loggerUtils";
const dockerDaemon = new Dockerode();
M src/utils/imageUtils.ts => src/utils/imageUtils.ts +1 -0
@@ 1,4 1,5 @@
import {ImageTable} from "../types/dbTypes";
+
import {dbConn} from "./dbUtils";
export const fetchImages = async (): Promise<readonly ImageTable[]> => {