API Docs for: 0.25.0
Show:

File: addon/models/comment.js

  1. import DS from 'ember-data';
  2.  
  3. import OsfModel from './osf-model';
  4.  
  5. /**
  6. * @module ember-osf
  7. * @submodule models
  8. */
  9.  
  10. /**
  11. * Model for OSF APIv2 comments. This model may be used with one of several API endpoints. It may be queried directly,
  12. * or accessed via relationship fields.
  13. * For field and usage information, see:
  14. * * https://api.osf.io/v2/docs/#!/v2/Comment_Detail_GET
  15. * * https://api.osf.io/v2/docs/#!/v2/Node_Comments_List_GET
  16. * * https://api.osf.io/v2/docs/#!/v2/Registration_Comments_List_GET
  17. *
  18. * @class Comment
  19. */
  20. export default OsfModel.extend({
  21. // TODO validation: maxLength
  22. content: DS.attr('fixstring'),
  23. page: DS.attr('fixstring'),
  24.  
  25. // Placeholder for comment creation: allow specifying attributes that are sent to the server, but not as attributes
  26. // Both type and ID will be serialized into relationships field
  27. targetID: DS.attr('fixstring'),
  28. targetType: DS.attr('fixstring'),
  29.  
  30. // TODO dynamic belongsTo
  31. user: DS.belongsTo('user'),
  32. node: DS.belongsTo('node'),
  33. replies: DS.hasMany('comment', {
  34. inverse: null
  35. }),
  36.  
  37. //reports: DS.hasMany('comment-report'),
  38.  
  39. dateCreated: DS.attr('date'),
  40. dateModified: DS.attr('date'),
  41. modified: DS.attr('boolean'),
  42. deleted: DS.attr('boolean'),
  43. isAbuse: DS.attr('boolean'),
  44. hasChildren: DS.attr('boolean'),
  45. canEdit: DS.attr('boolean')
  46. });
  47.