initial upload

This commit is contained in:
Kai Waggeling 2025-05-17 16:23:48 +02:00
parent ac114da487
commit 7c1cfdff51
63 changed files with 6883 additions and 0 deletions

44
sequelize/db_conn.mjs Normal file
View file

@ -0,0 +1,44 @@
import {
Sequelize
} from 'sequelize';
import Logger from 'pino';
export var DBLogger = Logger(Logger.destination('./logs/database.log'))
DBLogger.level = 10;
export var LabelDB = new Sequelize({
dialect: 'mysql',
host: '10.10.30.10',
port: "3306",
username: "label_print",
password: "mIhAha267oPiVoge1og5F2rub8nERI",
database: "aol_label-print",
logging: (Message) => DBLogger.debug(Message)
});
(async () => {
await import('./media.model.mjs');
await import('./printer.model.mjs');
await import('./template.model.mjs');
await import('./queue.model.mjs');
await import('./perms.model.mjs');
await import('./apps.model.mjs');
await import('./job.model.mjs');
try {
await LabelDB.authenticate();
DBLogger.info('Connection has been established successfully.');
} catch (error) {
DBLogger.error('Unable to connect to the database:', error);
}
try {
await LabelDB.sync({ force: false, alter: true });
DBLogger.info("All models were synchronized successfully.");
} catch (error) {
DBLogger.error(`Failed to synchronize models: ${error}`);
}
})();