From e194c1d81a04a3891f81f13d7dba124306ce3188 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 21 Sep 2023 09:23:47 +0200 Subject: [PATCH] messageCount: Add docs --- src/quota/messageCount.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/quota/messageCount.ts b/src/quota/messageCount.ts index 2e9bc78..a38cfdb 100644 --- a/src/quota/messageCount.ts +++ b/src/quota/messageCount.ts @@ -11,6 +11,10 @@ export default class MessageCount implements IQuota { lookback: number; defaultQuota: number; + /** + * @param defaultQuota the default quota for users that don't have override + * @param lookback lookback to check + */ constructor( defaultQuota: number = 25, lookback: number = 1000 * 60 * 60 * 24 @@ -19,6 +23,9 @@ export default class MessageCount implements IQuota { this.lookback = lookback; } + /** + * Retrives the quota from the database + */ private getUserQuota(id: string) { return database.limits.findUnique({ where: { user: BigInt(id) }, @@ -78,6 +85,9 @@ export default class MessageCount implements IQuota { }; } + /** + * helper funtion to create userQuotaData + */ private createUserQuotaData(quota: number, used: number): userQuotaData { const humanReadable = milisecondsToHumanReadable(this.lookback); return {