Skip to content

Commit

Permalink
feat(imports): Add model for imported series
Browse files Browse the repository at this point in the history
  • Loading branch information
kellnerd committed Jul 24, 2024
1 parent 4e11b72 commit aaa2a92
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import revision from './models/revision';
import series from './models/entities/series';
import seriesData from './models/data/seriesData';
import seriesHeader from './models/headers/seriesHeader';
import seriesImport from './models/imports/seriesImport';
import seriesOrderingType from './models/seriesOrderingType';
import seriesRevision from './models/revisions/seriesRevision';
import titleType from './models/titleType';
Expand Down Expand Up @@ -180,6 +181,7 @@ export default function init(config: Knex.Config) {
Series: series(bookshelf),
SeriesData,
SeriesHeader: seriesHeader(bookshelf),
SeriesImport: seriesImport(bookshelf),
SeriesOrderingType: seriesOrderingType(bookshelf),
SeriesRevision: seriesRevision(bookshelf),
TitleType: titleType(bookshelf),
Expand Down
34 changes: 34 additions & 0 deletions src/models/imports/seriesImport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2024 David Kellner
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import type Bookshelf from '@metabrainz/bookshelf';


export default function series(bookshelf: Bookshelf) {
const SeriesData = bookshelf.model('SeriesData');

const SeriesImport = SeriesData.extend({
defaultAlias() {
return this.belongsTo('Alias', 'default_alias_id');
},
idAttribute: 'import_id',
tableName: 'bookbrainz.series_import'
});

return bookshelf.model('SeriesImport', SeriesImport);
}

0 comments on commit aaa2a92

Please sign in to comment.