mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-14 09:36:00 +08:00
converted to ts
This commit is contained in:
parent
160f2b830f
commit
0390fa8319
1 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||
}
|
Loading…
Add table
Reference in a new issue