File size: 351 Bytes
03b405b
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
const { allowRate } = require("./rateLimit");
const { AppError } = require("../utils/errors");

function assertUserCanCreateJob(userId) {
  if (!allowRate(`jobs:${userId}`, 12, 60 * 60 * 1000)) {
    throw new AppError("Rate limit reached. Please wait before sending more videos.", "RATE_LIMITED");
  }
}

module.exports = { assertUserCanCreateJob };