From 96c4caa979d45004e9f5a3b2d6f65b723cdfec79 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Thu, 15 May 2025 20:51:50 +0000 Subject: [PATCH] style: fix linting issues met Prettier --- backend/src/services/learning-objects.ts | 5 +---- backend/src/util/api-helper.ts | 22 ++++------------------ 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/backend/src/services/learning-objects.ts b/backend/src/services/learning-objects.ts index 593cb078..cd7c8785 100644 --- a/backend/src/services/learning-objects.ts +++ b/backend/src/services/learning-objects.ts @@ -39,10 +39,7 @@ function filterData(data: LearningObjectMetadata, htmlUrl: string): FilteredLear */ export async function getLearningObjectById(hruid: string, language: string): Promise { const metadataUrl = `${DWENGO_API_BASE}/learningObject/getMetadata?hruid=${hruid}&language=${language}`; - const metadata = await fetchRemote( - metadataUrl, - `Metadata for Learning Object HRUID "${hruid}" (language ${language})` - ); + const metadata = await fetchRemote(metadataUrl, `Metadata for Learning Object HRUID "${hruid}" (language ${language})`); if (!metadata) { getLogger().error(`⚠️ WARNING: Learning object "${hruid}" not found.`); diff --git a/backend/src/util/api-helper.ts b/backend/src/util/api-helper.ts index 74d75aa2..d1e87075 100644 --- a/backend/src/util/api-helper.ts +++ b/backend/src/util/api-helper.ts @@ -26,12 +26,7 @@ interface Options { * @param cacheTTL Time-to-live for the cache in seconds (default: 60 seconds). * @returns The response data if successful, or null if an error occurs. */ -export async function fetchRemote( - url: string, - description: string, - options?: Options, - cacheTTL?: number, -): Promise { +export async function fetchRemote(url: string, description: string, options?: Options, cacheTTL?: number): Promise { if (runMode !== 'dev' && !runMode.includes('test')) { return fetchWithCache(url, description, options, cacheTTL); } @@ -40,12 +35,7 @@ export async function fetchRemote( return fetchWithLogging(url, description, options); } -async function fetchWithCache( - url: string, - description: string, - options?: Options, - cacheTTL?: number, -): Promise { +async function fetchWithCache(url: string, description: string, options?: Options, cacheTTL?: number): Promise { // Combine the URL and parameters to create a unique cache key. // NOTE Using a hash function to keep the key short, since Memcached has a limit on key size const urlWithParams = `${url}${options?.params ? JSON.stringify(options.params) : ''}`; @@ -70,11 +60,7 @@ async function fetchWithCache( return response; } -async function fetchWithLogging( - url: string, - description: string, - options?: Options, -): Promise { +async function fetchWithLogging(url: string, description: string, options?: Options): Promise { try { const config: AxiosRequestConfig = options || {}; const response = await axios.get(url, config); @@ -86,7 +72,7 @@ async function fetchWithLogging( logger.debug(`❌ ERROR: ${description} not found (404) at "${url}".`); } else { logger.debug( - `❌ ERROR: Failed to fetch ${description}. Status: ${error.response.status} - ${error.response.statusText} (URL: "${url}")`, + `❌ ERROR: Failed to fetch ${description}. Status: ${error.response.status} - ${error.response.statusText} (URL: "${url}")` ); } } else {