docs: add JSDoc to service public methods
One-line JSDoc on 82 methods across 11 service files for quick scanning without reading full implementations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ export interface GuildSettingsData {
|
||||
}
|
||||
|
||||
export const guildSettingsService = {
|
||||
/** Retrieve guild settings by guild ID, or null if none exist. */
|
||||
getSettings: async (guildId: string): Promise<GuildSettingsData | null> => {
|
||||
const settings = await DrizzleClient.query.guildSettings.findFirst({
|
||||
where: eq(guildSettings.guildId, BigInt(guildId)),
|
||||
@@ -44,6 +45,7 @@ export const guildSettingsService = {
|
||||
};
|
||||
},
|
||||
|
||||
/** Create or fully replace guild settings via upsert. */
|
||||
upsertSettings: async (data: Partial<GuildSettingsData> & { guildId: string }) => {
|
||||
const values: typeof guildSettings.$inferInsert = {
|
||||
guildId: BigInt(data.guildId),
|
||||
@@ -73,6 +75,7 @@ export const guildSettingsService = {
|
||||
return result;
|
||||
},
|
||||
|
||||
/** Update a single guild setting by key name; throws if the key is unknown or settings do not exist. */
|
||||
updateSetting: async (
|
||||
guildId: string,
|
||||
key: string,
|
||||
@@ -128,6 +131,7 @@ export const guildSettingsService = {
|
||||
return result;
|
||||
},
|
||||
|
||||
/** Delete all settings for a guild. */
|
||||
deleteSettings: async (guildId: string) => {
|
||||
const [result] = await DrizzleClient.delete(guildSettings)
|
||||
.where(eq(guildSettings.guildId, BigInt(guildId)))
|
||||
@@ -136,6 +140,7 @@ export const guildSettingsService = {
|
||||
return result;
|
||||
},
|
||||
|
||||
/** Add a color role to the guild's allowed list; no-ops if already present. */
|
||||
addColorRole: async (guildId: string, roleId: string) => {
|
||||
const settings = await guildSettingsService.getSettings(guildId);
|
||||
const colorRoleIds = settings?.colorRoleIds ?? [];
|
||||
@@ -148,6 +153,7 @@ export const guildSettingsService = {
|
||||
return await guildSettingsService.upsertSettings({ guildId, colorRoleIds });
|
||||
},
|
||||
|
||||
/** Remove a color role from the guild's allowed list. */
|
||||
removeColorRole: async (guildId: string, roleId: string) => {
|
||||
const settings = await guildSettingsService.getSettings(guildId);
|
||||
if (!settings) return null;
|
||||
|
||||
Reference in New Issue
Block a user