Unit.js 639 B

12345678910111213141516171819202122232425262728293031
  1. import { User } from 'src/models/User.js'
  2. import { Model, Collection } from 'js-abstract-model'
  3. // import { UnitCategory } from 'src/models/UnitCategory.js'
  4. class Unit extends Model {
  5. constructor (data) {
  6. super(data, [
  7. { key: 'id' },
  8. { key: 'creator' },
  9. {
  10. key: 'creator_info',
  11. relatedModel: User
  12. },
  13. { key: 'category' },
  14. {
  15. key: 'category_info'
  16. // relatedModel: UnitCategory
  17. },
  18. { key: 'title' },
  19. { key: 'rules' },
  20. { key: 'codes' }
  21. ])
  22. }
  23. }
  24. class UnitList extends Collection {
  25. model () {
  26. return Unit
  27. }
  28. }
  29. export { Unit, UnitList }