From e519cf4646d6db8b2ecb09aa62354169cd981f74 Mon Sep 17 00:00:00 2001 From: Seth Battis Date: Thu, 26 Dec 2024 16:33:58 -0500 Subject: [PATCH] Handle topic cover info --- .../api/DataDirect/common/prepareContent.ts | 3 +++ .../src/workflows/Snapshot/Topics.ts | 26 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/datadirect/src/api/DataDirect/common/prepareContent.ts b/packages/datadirect/src/api/DataDirect/common/prepareContent.ts index b74b15f..2af698b 100644 --- a/packages/datadirect/src/api/DataDirect/common/prepareContent.ts +++ b/packages/datadirect/src/api/DataDirect/common/prepareContent.ts @@ -36,6 +36,9 @@ export function prepareContent( case 'Cover Brief': case 'Cover Image': case 'Cover Title': + throw new Error( + `All content for ${contentType.Content} is captured by /api/topiccontentget/:TopicID` + ); case 'Roster': case 'Learning Tool': throw new Error(`Capturing ${contentType.Content} is not yet supported`); diff --git a/packages/myschoolapp-reporting/src/workflows/Snapshot/Topics.ts b/packages/myschoolapp-reporting/src/workflows/Snapshot/Topics.ts index 1a22320..c8e35b8 100644 --- a/packages/myschoolapp-reporting/src/workflows/Snapshot/Topics.ts +++ b/packages/myschoolapp-reporting/src/workflows/Snapshot/Topics.ts @@ -78,16 +78,22 @@ export async function capture( ) }); } catch (error) { - Content?.push({ - ...item, - ObjectType, - Content: { error } - }); - cli.log.error( - `Error capturing Topic ${TopicID} content of type ${ - ObjectType?.Name - } for group ${Id}: ${cli.colors.error(error)}` - ); + if ( + `${error}`.endsWith('is captured by /api/topiccontentget/:TopicID') + ) { + Content.push({ ...item, ObjectType }); + } else { + Content?.push({ + ...item, + ObjectType, + Content: { error } + }); + cli.log.error( + `Error capturing Topic ${TopicID} content of type ${ + ObjectType?.Name + } for group ${Id}: ${cli.colors.error(error)}` + ); + } } } Topics.push({ ...topic, Content: Content.length ? Content : undefined });