From 377c20845f110de318ea7e2cb1ed004ae65ea2f6 Mon Sep 17 00:00:00 2001 From: Tarunmeena0901 <97682967+Tarunmeena0901@users.noreply.github.com> Date: Wed, 14 Feb 2024 01:07:21 +0530 Subject: [PATCH] part of BB-768: updating autoCreateNewEditionGroup function for an creditSection field --- src/models/entities/edition.ts | 3 ++- src/util.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/models/entities/edition.ts b/src/models/entities/edition.ts index c015b209..40abd27f 100644 --- a/src/models/entities/edition.ts +++ b/src/models/entities/edition.ts @@ -32,8 +32,9 @@ async function autoCreateNewEditionGroup(model, bookshelf: Bookshelf, options) { const aliasSetId = model.get('aliasSetId'); const revisionId = model.get('revisionId'); const authorCreditId = model.get('authorCreditId'); + const creditSection = model.get('creditSection'); const newEditionGroupBBID = await createEditionGroupForNewEdition( - bookshelf, options.transacting, aliasSetId, revisionId, authorCreditId + bookshelf, options.transacting, aliasSetId, revisionId, authorCreditId, creditSection ); model.set('editionGroupBbid', newEditionGroupBBID); } diff --git a/src/util.ts b/src/util.ts index 150ee8ee..e28c014c 100644 --- a/src/util.ts +++ b/src/util.ts @@ -243,11 +243,12 @@ export function parseDate(date: string): Array { * @param {number|string} aliasSetId - The id of the new edition's alias set * @param {number|string} revisionId - The id of the new edition's revision * @param {number|string} authorCreditId - The id of the new edition's author credit + * @param {boolean} creditSection - The state of author credit section of the new edition * @returns {string} BBID of the newly created Edition Group */ export async function createEditionGroupForNewEdition( orm: Bookshelf, transacting: Transaction, - aliasSetId: number | string, revisionId: number | string, authorCreditId: number | string + aliasSetId: number | string, revisionId: number | string, authorCreditId: number | string, creditSection: boolean ): Promise { const Entity = orm.model('Entity'); const EditionGroup = orm.model('EditionGroup'); @@ -258,6 +259,7 @@ export async function createEditionGroupForNewEdition( aliasSetId, authorCreditId, bbid, + creditSection, revisionId }) .save(null, {method: 'insert', transacting});