From 29df8bf2c4113365d4e6c37ea13e8ee8002aa50d Mon Sep 17 00:00:00 2001 From: Anthony Berg Date: Thu, 27 Jul 2023 12:07:15 +0100 Subject: [PATCH] docs(database): add JSDoc for ban functions --- src/utils/database/ban.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/utils/database/ban.ts b/src/utils/database/ban.ts index 2319d57..9404e6e 100644 --- a/src/utils/database/ban.ts +++ b/src/utils/database/ban.ts @@ -1,5 +1,11 @@ import { container } from '@sapphire/framework'; +/** + * Add an entry to the database to log a ban for a user + * @param {string} userId Snowflake for the User to ban + * @param {string} modId Snowflake for the Moderator who is banning the user + * @param {string} reason Reason for banning the user + */ export async function addBan(userId: string, modId: string, reason: string) { // Add the user to the database await container.database.ban.create({ @@ -19,6 +25,11 @@ export async function addBan(userId: string, modId: string, reason: string) { }); } +/** + * Deactivates the ban on the database for the user + * @param {string} userId Snowflake for the User to unban + * @param {string} modId Snowflake for the Moderator who is unbanning the user + */ export async function removeBan(userId: string, modId: string) { const ban = await container.database.ban.findFirst({ where: { @@ -46,6 +57,11 @@ export async function removeBan(userId: string, modId: string) { }); } +/** + * Check if the user is banned on the database + * @param userId Snowflake of the User to check the ban on + * @return {boolean} If the ban is active on the database + */ export async function checkBan(userId: string) { const ban = await container.database.ban.findFirst({ where: { @@ -63,6 +79,11 @@ export async function checkBan(userId: string) { return ban.active; } +/** + * Get the ban reason for a user from the database + * @param {string} userId Snowflake for the User + * @return {string} User's reason for being banned + */ export async function getBanReason(userId: string) { const ban = await container.database.ban.findFirst({ where: {