WIP: Format code with Google Typescript formatting guidelines
This commit is contained in:
24
database.ts
24
database.ts
@@ -1,9 +1,9 @@
|
||||
import { Model, Sequelize, STRING } from "sequelize";
|
||||
import {Model, Sequelize, STRING} from 'sequelize';
|
||||
|
||||
import "node:fs/promises";
|
||||
import { readFile } from "node:fs";
|
||||
import 'node:fs/promises';
|
||||
import {readFile} from 'node:fs';
|
||||
|
||||
export const sql = new Sequelize("sqlite://./blitzcrank.sqlite");
|
||||
export const sql = new Sequelize('sqlite://./blitzcrank.sqlite');
|
||||
|
||||
export class GuildSetting extends Model {
|
||||
declare guildId: string;
|
||||
@@ -13,19 +13,19 @@ export class GuildSetting extends Model {
|
||||
|
||||
GuildSetting.init(
|
||||
{
|
||||
guildId: { type: STRING },
|
||||
key: { type: STRING },
|
||||
value: { type: STRING },
|
||||
guildId: {type: STRING},
|
||||
key: {type: STRING},
|
||||
value: {type: STRING},
|
||||
},
|
||||
{ sequelize: sql },
|
||||
{sequelize: sql},
|
||||
);
|
||||
|
||||
export async function initDb() {
|
||||
try {
|
||||
await sql.authenticate();
|
||||
console.log("Connected to database");
|
||||
console.log('Connected to database');
|
||||
} catch (error) {
|
||||
console.error("Unable to connect to the database:", error);
|
||||
console.error('Unable to connect to the database:', error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ export async function readSettingsFromFile(path: string) {
|
||||
});
|
||||
}
|
||||
}
|
||||
GuildSetting.bulkCreate(toInsert, { updateOnDuplicate: ["value"] });
|
||||
GuildSetting.bulkCreate(toInsert, {updateOnDuplicate: ['value']});
|
||||
} catch (error) {
|
||||
// TODO
|
||||
console.log("Could not read settings:", error);
|
||||
console.log('Could not read settings:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user