export getUserLimit
will be used in a command that check the user limit
This commit is contained in:
parent
ae3a5133b3
commit
c1b165024d
1 changed files with 2 additions and 4 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue