From 372fda4730cdc14e159c786c85416f500b7c0598 Mon Sep 17 00:00:00 2001 From: ARtheboss Date: Thu, 4 Apr 2024 19:51:19 -0700 Subject: [PATCH] added resiliency against variance between updated and updatedAt --- backend/src/modules/catalog/controller.ts | 1 + backend/src/modules/catalog/formatter.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/modules/catalog/controller.ts b/backend/src/modules/catalog/controller.ts index de10f20e9..ac4f6d319 100644 --- a/backend/src/modules/catalog/controller.ts +++ b/backend/src/modules/catalog/controller.ts @@ -45,6 +45,7 @@ export async function getCatalog(term: TermInput, info: GraphQLResolveInfo): Pro fromDate: { $lte: getTermStartMonth(term) }, }, { + _updatedAt: 1, _updated: 1, identifiers: 1, title: 1, diff --git a/backend/src/modules/catalog/formatter.ts b/backend/src/modules/catalog/formatter.ts index b1f3f6b09..486e41b3f 100644 --- a/backend/src/modules/catalog/formatter.ts +++ b/backend/src/modules/catalog/formatter.ts @@ -7,7 +7,7 @@ import { stringToTerm } from "../../utils/term"; export function formatMetadata(data: any) { return { - lastUpdated: data._updated as Date, + lastUpdated: (!data._updated) ? data._updatedAt as Date : data._updated as Date, raw: data, } }