mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-22 05:26:14 +08:00
checking size of config
removed confusing error
This commit is contained in:
parent
52f16fe095
commit
d3c093bb42
1 changed files with 3 additions and 6 deletions
|
@ -51,14 +51,11 @@ class PresetDAO {
|
|||
name: string,
|
||||
config: any
|
||||
): Promise<void> {
|
||||
const presetUpdates = config ? { name, config } : { name };
|
||||
const updateResult = await db
|
||||
const presetUpdates =
|
||||
config && Object.keys(config).length > 0 ? { name, config } : { name };
|
||||
await db
|
||||
.collection(COLLECTION_NAME)
|
||||
.updateOne(getPresetKeyFilter(uid, presetId), { $set: presetUpdates });
|
||||
|
||||
if (updateResult.modifiedCount === 0) {
|
||||
throw new MonkeyError(404, "Preset not found");
|
||||
}
|
||||
}
|
||||
|
||||
static async removePreset(uid: string, presetId: string): Promise<void> {
|
||||
|
|
Loading…
Add table
Reference in a new issue