From ee01a689e255bcf8775387b3d5e4e8a6577908a3 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 8 Aug 2022 22:55:14 +0200 Subject: rename initDatabase to clarify function --- gateway/src/Server.ts | 4 ++-- gateway/src/opcodes/LazyRequest.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gateway') diff --git a/gateway/src/Server.ts b/gateway/src/Server.ts index 254820c9..82fbeba2 100644 --- a/gateway/src/Server.ts +++ b/gateway/src/Server.ts @@ -1,6 +1,6 @@ import dotenv from "dotenv"; dotenv.config(); -import { closeDatabase, Config, initDatabase, initEvent } from "@fosscord/util"; +import { closeDatabase, Config, getOrInitialiseDatabase, initEvent } from "@fosscord/util"; import ws from "ws"; import { Connection } from "./events/Connection"; import http from "http"; @@ -46,7 +46,7 @@ export class Server { } async start(): Promise { - await initDatabase(); + await getOrInitialiseDatabase(); await Config.init(); await initEvent(); if (!this.server.listening) { diff --git a/gateway/src/opcodes/LazyRequest.ts b/gateway/src/opcodes/LazyRequest.ts index 0dbdb526..5ba65cdd 100644 --- a/gateway/src/opcodes/LazyRequest.ts +++ b/gateway/src/opcodes/LazyRequest.ts @@ -1,4 +1,4 @@ -import { getPermission, listenEvent, Member, Role, initDatabase } from "@fosscord/util"; +import { getPermission, listenEvent, Member, Role, getOrInitialiseDatabase } from "@fosscord/util"; import { LazyRequest } from "../schema/LazyRequest"; import { Send } from "../util/Send"; import { OPCODES } from "../util/Constants"; @@ -17,7 +17,7 @@ async function getMembers(guild_id: string, range: [number, number]) { // TODO: wait for typeorm to implement ordering for .find queries https://github.com/typeorm/typeorm/issues/2620 // TODO: rewrite this, released in 0.3.0 - let members = await (await initDatabase()).getRepository(Member) + let members = await (await getOrInitialiseDatabase()).getRepository(Member) .createQueryBuilder("member") .where("member.guild_id = :guild_id", { guild_id }) .leftJoinAndSelect("member.roles", "role") -- cgit 1.4.1