converted to ts

This commit is contained in:
Miodec 2022-02-26 22:59:22 +01:00
parent 160f2b830f
commit 0390fa8319

View file

@ -1,14 +1,15 @@
import { UpdateResult } from "mongodb";
import db from "../init/db";
class ConfigDAO {
static async saveConfig(uid, config) {
static async saveConfig(uid, config): Promise<UpdateResult> {
return await db
.collection("configs")
.updateOne({ uid }, { $set: { config } }, { upsert: true });
}
static async getConfig(uid) {
let config = await db.collection("configs").findOne({ uid });
static async getConfig(uid): Promise<object> {
const config = await db.collection("configs").findOne({ uid });
// if (!config) throw new MonkeyError(404, "Config not found");
return config;
}