Skip to content

Commit

Permalink
part of BB-768: updating autoCreateNewEditionGroup function for an cr…
Browse files Browse the repository at this point in the history
…editSection field
  • Loading branch information
Tarunmeena0901 committed Feb 13, 2024
1 parent 67276af commit 377c208
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/models/entities/edition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,12 @@ export function parseDate(date: string): Array<number | null> {
* @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<string> {
const Entity = orm.model('Entity');
const EditionGroup = orm.model('EditionGroup');
Expand All @@ -258,6 +259,7 @@ export async function createEditionGroupForNewEdition(
aliasSetId,
authorCreditId,
bbid,
creditSection,
revisionId
})
.save(null, {method: 'insert', transacting});
Expand Down

0 comments on commit 377c208

Please sign in to comment.