import mysql from "serverless-mysql";

global.DSQL_DB_CONN = mysql({
    config: {
        host: process.env.DSQL_DB_HOST,
        user: process.env.DSQL_DB_USERNAME,
        password: process.env.DSQL_DB_PASSWORD,
        database: process.env.DSQL_DB_NAME,
        charset: "utf8mb4",
    },
});

global.DSQL_USE_LOCAL = true;

import watchMainDbSchemaJSONFile from "./(functions)/watch-main-db-schema-json-file";
import cronHandleQueue from "./(functions)/queue/handle-queue";

console.log("Running Cron Services ....");

/**
 * # Watch Main JSON DB Schema File
 */
watchMainDbSchemaJSONFile();

/**
 * # Handle Queue
 */
cronHandleQueue();
