Donation.js 652 B

12345678910111213141516171819202122232425262728293031
  1. import { Collection, Model } from 'js-abstract-model'
  2. import { DonationCategory } from 'src/models/DonationCategory.js'
  3. class Donation extends Model {
  4. constructor (data) {
  5. super(data, [
  6. { key: 'id' },
  7. { key: 'title' },
  8. { key: 'description' },
  9. { key: 'summary' },
  10. { key: 'thumbnail' },
  11. { key: 'category' },
  12. {
  13. key: 'category_info',
  14. relatedModel: DonationCategory
  15. }
  16. ])
  17. if (!this.thumbnail) {
  18. this.thumbnail = '/img/sample-post-thumbnail.jpg'
  19. }
  20. }
  21. }
  22. class DonationList extends Collection {
  23. model () {
  24. return Donation
  25. }
  26. }
  27. export { Donation, DonationList }