From 7a30c363fd5ff1d3ebbaef10ee3e7c3487ef0007 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Fri, 4 Apr 2025 17:19:36 +0100 Subject: [PATCH] fix: update cleanup service methods description --- api/src/extension/cleanup.service.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/api/src/extension/cleanup.service.ts b/api/src/extension/cleanup.service.ts index 994ed5a3..c0b7355e 100644 --- a/api/src/extension/cleanup.service.ts +++ b/api/src/extension/cleanup.service.ts @@ -25,6 +25,14 @@ export class CleanupService { private readonly channelService: ChannelService, ) {} + /** + * Deletes unused settings with the specified criteria. + * + * @param criteria - An array of criteria objects containing: + * - suffix: Regex pattern to match setting groups + * - namespaces: Array of namespaces to exclude from deletion + * @returns A promise that resolves to the result of the deletion operation. + */ private async deleteManyBySuffixAndNamespaces( criteria: TCriteria[], ): Promise { @@ -35,19 +43,33 @@ export class CleanupService { }); } + /** + * Retrieves a list of channel Namespaces. + * + * @returns An array of channel Namespaces. + */ public getChannelNamespaces(): TExtractNamespace<'channel'>[] { return this.channelService .getAll() .map((channel) => channel.getNamespace>()); } + /** + * Retrieves a list of helper Namespaces. + * + * @returns An array of helper Namespaces. + */ public getHelperNamespaces(): TExtractNamespace<'helper'>[] { return this.helperService .getAll() .map((helper) => helper.getNamespace>()); } - public async pruneExtensionSettings() { + /** + * Prune extensions unused settings. + * + */ + public async pruneExtensionSettings(): Promise { const channels = this.getChannelNamespaces(); const helpers = this.getHelperNamespaces(); const { deletedCount } = await this.deleteManyBySuffixAndNamespaces([