diff --git a/db/model/Gdoc/GdocFactory.ts b/db/model/Gdoc/GdocFactory.ts index 86e9c94451f..0739efb43c7 100644 --- a/db/model/Gdoc/GdocFactory.ts +++ b/db/model/Gdoc/GdocFactory.ts @@ -93,11 +93,10 @@ export async function createGdocAndInsertIntoDb( knex: KnexReadWriteTransaction, id: string ): Promise { - // Fetch the data from Google Docs and save it to the database + // Fetch the data from Google Docs. // We have to fetch it here because we need to know the type of the Gdoc in load() const base = new GdocBase(id) await base.fetchAndEnrichGdoc() - await upsertGdoc(knex, base) // Load its metadata and state so that subclass parsing & validation is also done. // This involves a second call to the DB and Google, which makes me sad, but it'll do for now. @@ -106,9 +105,9 @@ export async function createGdocAndInsertIntoDb( base, GdocsContentSource.Gdocs ) - - // 2024-03-12 Daniel: We used to save here before the knex refactor but I think that was redundant? - // await gdoc.save() + // Save the enriched Gdoc to the database (including subclass-specific + // enrichments, cf. _enrichSubclassContent()) + await upsertGdoc(knex, gdoc) return gdoc }