Skip to content

Commit

Permalink
chore: Delete unused createEntity and its exclusive dependencies
Browse files Browse the repository at this point in the history
It is no longer needed to edit imported entities during approval.
They are now approved before being edited, just like regular entities.
Last usage was removed in metabrainz/bookbrainz-site@d9830e5
  • Loading branch information
kellnerd committed Dec 9, 2024
1 parent fdc7cbb commit f860e4e
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 414 deletions.
151 changes: 0 additions & 151 deletions src/func/create-entity.ts

This file was deleted.

28 changes: 0 additions & 28 deletions src/func/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copied from bookbrainz-site
* Copyright (C) 2016 Sean Burke
* 2016 Ben Ockmore
* 2018 Shivam Tripathi
*
* 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
Expand All @@ -19,33 +18,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import {ORM} from '..';
import type {Transaction} from './types';

/**
* Adds 1 to the edit count of the specified editor
*
* @param {ORM} orm - the BookBrainz ORM, initialized during app setup
* @param {string} id - row ID of editor to be updated
* @param {Transaction} transacting - Bookshelf transaction object (must be in
* progress)
* @returns {Promise} - Resolves to the updated editor model
*/
export function incrementEditorEditCountById(
orm: ORM,
id: string,
transacting: Transaction
): Promise<any> {
const {Editor} = orm;
return new Editor({id})
.fetch({transacting})
.then((editor) => {
// @ts-expect-error -- Types for custom methods of Bookshelf models are lacking
editor.incrementEditCount();
return editor.save(null, {transacting});
});
}

/* eslint-disable camelcase */
function getEditorIDByMetaBrainzID(trx, metabrainzUserID) {
return trx('bookbrainz.editor')
Expand Down
105 changes: 0 additions & 105 deletions src/func/entity-sets.ts

This file was deleted.

53 changes: 0 additions & 53 deletions src/func/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,59 +79,6 @@ export function getAdditionalEntityProps(
}
}

export type EntitySetMetadataT = {
entityIdField: string;
idField: string;
mutableFields?: string[];
name: string;
propName: string;
};

/**
* @param {string} entityType - Entity type string
* @returns {Object} - Returns entitySetMetadata (derivedSets)
*/
export function getEntitySetMetadataByType(entityType: EntityTypeString): EntitySetMetadataT[] {
if (entityType === 'Edition') {
return [
{
entityIdField: 'languageSetId',
idField: 'id',
name: 'languageSet',
propName: 'languages'
},
{
entityIdField: 'publisherSetId',
idField: 'bbid',
name: 'publisherSet',
propName: 'publishers'
},
{
entityIdField: 'releaseEventSetId',
idField: 'id',
mutableFields: [
'date',
'areaId'
],
name: 'releaseEventSet',
propName: 'releaseEvents'
}
];
}
else if (entityType === 'Work') {
return [
{
entityIdField: 'languageSetId',
idField: 'id',
name: 'languageSet',
propName: 'languages'
}
];
}

return [];
}

/**
* Returns all entity models defined in bookbrainz-data-js
*
Expand Down
1 change: 0 additions & 1 deletion src/func/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ export * as relationshipAttributes from './relationshipAttributes';
export * as releaseEvent from './releaseEvent';
export * as set from './set';
export * as work from './work';
export {createEntity} from './create-entity';
Loading

0 comments on commit f860e4e

Please sign in to comment.