photosite/dist/db/index.js

25 lines
759 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DB = void 0;
require("dotenv/config");
const log_1 = require("../log");
const sqlite3_1 = require("sqlite3");
const env_1 = require("../env");
class DB {
constructor() {
this.log = (0, log_1.createLog)('db');
this.db = new sqlite3_1.Database((0, env_1.envString)('DB', 'data/site.db'));
}
async run(query, args = null) {
return new Promise((resolve, reject) => {
return this.db.run(query, args, (err, rows) => {
if (err)
return reject(err);
return resolve(true);
});
});
}
}
exports.DB = DB;
module.exports = { DB };
//# sourceMappingURL=index.js.map