Renamed folder utilities > application, added baseEntity class, updated baseRepo class, removed prisma helper

This commit is contained in:
2024-12-25 16:50:01 +01:00
parent f5a7a348e0
commit f4746722af
120 changed files with 423 additions and 378 deletions

View File

@ -1,16 +1,15 @@
import fs from 'fs'
import express, { Application } from 'express'
import config from '#utilities/config'
import { getAppPath } from '#utilities/storage'
import config from '#application/config'
import { getAppPath } from '#application/storage'
import { createServer as httpServer, Server as HTTPServer } from 'http'
import { addHttpRoutes } from './http'
import cors from 'cors'
import { Server as SocketServer } from 'socket.io'
import { Authentication } from '#middleware/authentication'
import { TSocket } from '#utilities/types'
import { Database } from '#utilities/database'
import prisma from '#utilities/prisma' // @TODO: Remove this
import { appLogger, watchLogs } from '#utilities/logger'
import { TSocket } from '#application/types'
import { Database } from '#application/database'
import { appLogger, watchLogs } from '#application/logger'
import ZoneManager from '#managers/zoneManager'
import UserManager from '#managers/userManager'
import CommandManager from '#managers/commandManager'
@ -50,19 +49,11 @@ export class Server {
// Read log file and print to console for debugging
watchLogs()
// Check prisma connection
try {
await prisma.$connect()
appLogger.info('Database connected')
} catch (error: any) {
appLogger.error(`Database connection failed: ${error.message}`)
}
// MikroORM
// Connect to database
try {
await Database.getInstance()
} catch (error: any) {
appLogger.error(`Database 2 connection failed: ${error.message}`)
appLogger.error(`Database connection failed: ${error.message}`)
}
// Start the server