mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-27 16:24:41 +08:00
only allowing 100 submissions per language
This commit is contained in:
parent
99111ec3e8
commit
59c34fc988
1 changed files with 11 additions and 0 deletions
|
@ -42,6 +42,17 @@ export async function add(
|
|||
throw new MonkeyError(500, `Invalid language name`, language);
|
||||
}
|
||||
|
||||
const count = await db
|
||||
.collection("new-quotes")
|
||||
.countDocuments({ language: language });
|
||||
|
||||
if (count >= 100) {
|
||||
throw new MonkeyError(
|
||||
409,
|
||||
"There are already 100 quotes in the queue for this language."
|
||||
);
|
||||
}
|
||||
|
||||
//check for duplicate first
|
||||
const fileDir = path.join(
|
||||
__dirname,
|
||||
|
|
Loading…
Reference in a new issue