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 {