export getUserLimit

will be used in a command that check the user limit
This commit is contained in:
Wroclaw 2023-05-10 03:02:49 +02:00
parent ae3a5133b3
commit c1b165024d

View file

@ -28,13 +28,11 @@ export function getAuthor(request: apiRequest) {
* @param requestTimestamp the timestamp of the user request * @param requestTimestamp the timestamp of the user request
* @returns object containing the limit and remaining usage or `false` if there is no limit * @returns object containing the limit and remaining usage or `false` if there is no limit
*/ */
async function getUserLimit(user: string | {id: string}, requestTimestamp: Date) { export async function getUserLimit(user: string | { id: string }, requestTimestamp: Date) {
const userId: string = typeof user === "string" ? user : user.id; const userId: string = typeof user === "string" ? user : user.id;
const userLimits = await database.limits.findUnique({ const userLimits = await database.limits.findUnique({
where: { where: { user: BigInt(userId) }
user: BigInt(userId)
}
}); });
if (userLimits?.vip) return false; if (userLimits?.vip) return false;