Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

part of issue BB-768 : updating the edition model function #315

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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