|
| 1 | +import DS from 'ember-data'; |
| 2 | +import OsfModel from './osf-model'; |
| 3 | + |
| 4 | +/** |
| 5 | + * @module ember-preprints |
| 6 | + * @submodule models |
| 7 | + */ |
| 8 | + |
| 9 | +/** |
| 10 | + * Model for OSF APIv2 preprints. This model may be used with one of several API endpoints. It may be queried directly, |
| 11 | + * or accessed via relationship fields. |
| 12 | + * For field and usage information, see: |
| 13 | + * https://api.osf.io/v2/docs/#!/v2/Preprint_List_GET |
| 14 | + * https://api.osf.io/v2/docs/#!/v2/Preprint_Detail_GET |
| 15 | + * https://api.osf.io/v2/docs/#!/v2/User_Preprints_GET |
| 16 | + * @class Preprint |
| 17 | + */ |
| 18 | +export default OsfModel.extend({ |
| 19 | + title: DS.attr('string'), |
| 20 | + // TODO: May be a relationship in the future pending APIv2 changes |
| 21 | + subjects: DS.attr(), |
| 22 | + dateCreated: DS.attr('date'), |
| 23 | + datePublished: DS.attr('date'), |
| 24 | + dateModifed: DS.attr('date'), |
| 25 | + doi: DS.attr('string'), |
| 26 | + isPublished: DS.attr('boolean'), |
| 27 | + isPreprintOrphan: DS.attr('boolean'), |
| 28 | + |
| 29 | + // Relationships |
| 30 | + node: DS.belongsTo('node', { inverse: null, async: true }), |
| 31 | + primaryFile: DS.belongsTo('file', { inverse: null }), |
| 32 | + provider: DS.belongsTo('preprint-provider', { inverse: 'preprints', async: true }), |
| 33 | +}); |
0 commit comments