Skip to content

Commit

Permalink
Merge pull request #315 from Tarunmeena0901/BB-768
Browse files Browse the repository at this point in the history
part of issue BB-768 : updating the edition model function
  • Loading branch information
MonkeyDo authored Jun 3, 2024
2 parents 67276af + 377c208 commit ff24a1c
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 ff24a1c

Please sign in to comment.