From 130b7e4f81ac2f3d476209a4c5e023191865f411 Mon Sep 17 00:00:00 2001 From: Jared Galanis Date: Tue, 26 Sep 2023 11:55:21 -0400 Subject: [PATCH] refactor: remove publisher and contributor (#1214) Closes: https://github.com/eclipse-pass/main/issues/734 --- app/initializers/pass-api-inflector.js | 2 -- app/models/contributor.js | 22 ---------------------- app/models/journal.js | 6 ------ app/models/publisher.js | 23 ----------------------- tests/unit/models/contributor-test.js | 12 ------------ 5 files changed, 65 deletions(-) delete mode 100644 app/models/contributor.js delete mode 100644 app/models/publisher.js delete mode 100644 tests/unit/models/contributor-test.js diff --git a/app/initializers/pass-api-inflector.js b/app/initializers/pass-api-inflector.js index 88b81ae53..942674b88 100644 --- a/app/initializers/pass-api-inflector.js +++ b/app/initializers/pass-api-inflector.js @@ -10,7 +10,6 @@ export function initialize() { // Tell the inflector to not pluralize our model names // by saying the plural is the same word - inflector.uncountable('contributor'); inflector.uncountable('deposit'); inflector.uncountable('file'); inflector.uncountable('funder'); @@ -19,7 +18,6 @@ export function initialize() { inflector.uncountable('person'); inflector.uncountable('policy'); inflector.uncountable('publication'); - inflector.uncountable('publisher'); inflector.uncountable('repositoryCopy'); inflector.uncountable('repository'); inflector.uncountable('submissionEvent'); diff --git a/app/models/contributor.js b/app/models/contributor.js deleted file mode 100644 index 3260d0543..000000000 --- a/app/models/contributor.js +++ /dev/null @@ -1,22 +0,0 @@ -import Model, { attr, belongsTo } from '@ember-data/model'; - -export default class ContributorModel extends Model { - @attr('string') firstName; - @attr('string') middleName; - @attr('string') lastName; - @attr('string') displayName; - @attr('string') email; - @attr('string') orcidId; - @attr('set') affiliation; - @attr('set') roles; - - @belongsTo('user') user; - @belongsTo('publication') publication; -} - -export const Role = { - AUTHOR: 'AUTHOR', - FIRST_AUTHOR: 'FIRST_AUTHOR', - LAST_AUTHOR: 'LAST_AUTHOR', - CORRESPONDING_AUTHOR: 'CORRESPONDING_AUTHOR', -}; diff --git a/app/models/journal.js b/app/models/journal.js index e26898d58..bb98a220c 100644 --- a/app/models/journal.js +++ b/app/models/journal.js @@ -1,7 +1,6 @@ /* eslint-disable ember/no-computed-properties-in-native-classes */ import Model, { attr, belongsTo } from '@ember-data/model'; import { computed } from '@ember/object'; -import { PMCParticipation as PublisherPMCParticipation } from './publisher'; export default class JournalModel extends Model { /** @@ -12,8 +11,6 @@ export default class JournalModel extends Model { @attr('string') pmcParticipation; @attr('set') issns; - @belongsTo('publisher') publisher; - @computed('pmcParticipation') get isMethodA() { return this.pmcParticipation ? this.pmcParticipation === PMCParticipation.A : false; @@ -24,6 +21,3 @@ export default class JournalModel extends Model { return this.pmcParticipation ? this.pmcParticipation === PMCParticipation.B : false; } } - -/** Re-export from Publisher model, since they use th same codes */ -export const PMCParticipation = PublisherPMCParticipation; diff --git a/app/models/publisher.js b/app/models/publisher.js deleted file mode 100644 index 20fa825bd..000000000 --- a/app/models/publisher.js +++ /dev/null @@ -1,23 +0,0 @@ -import Model, { attr } from '@ember-data/model'; - -export default class PublisherModel extends Model { - /** Name of the publisher (REQUIRED) */ - @attr('string') name; - /** - * Publisher participation in NIH Public Access Program by sending final published article to PMC. - * - * Possible values: - * - A (Route A: journal automatically post paper to PMC) - * - B (Route B: authors must make special arrangements for some journals and publishers to post the paper directly to PMC) - * - C (Route C: authors or deignee must submit manuscripts to NIHMS) - * - D (Route D: some publishers will submit manuscripts to NIHMS) - */ - @attr('string') pmcParticipation; -} - -export const PMCParticipation = { - A: 'A', - B: 'B', - C: 'C', - D: 'D', -}; diff --git a/tests/unit/models/contributor-test.js b/tests/unit/models/contributor-test.js deleted file mode 100644 index cc490d1c7..000000000 --- a/tests/unit/models/contributor-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; -import { run } from '@ember/runloop'; - -module('Unit | Model | contributor', (hooks) => { - setupTest(hooks); - - test('it exists', function (assert) { - const contributor = run(() => this.owner.lookup('service:store').createRecord('contributor')); - assert.ok(contributor); - }); -});