UnitCategory.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { User } from 'src/models/User.js'
  2. import { UnitList } from 'src/models/Unit.js'
  3. import { Model, Collection } from 'js-abstract-model'
  4. class UnitCategory extends Model {
  5. constructor (data) {
  6. super(data, [
  7. { key: 'id' },
  8. { key: 'title' },
  9. { key: 'creator' },
  10. {
  11. key: 'creator_info',
  12. relatedModel: User
  13. },
  14. {
  15. key: 'units_info',
  16. relatedModel: UnitList
  17. },
  18. { key: 'type' },
  19. { key: 'creation_time' },
  20. { key: 'last_modification_time' },
  21. { key: 'is_active' },
  22. { key: 'is_deleted' }
  23. ], {
  24. type: {
  25. infoKey: 'type_info',
  26. enumListKey: 'typeEnums',
  27. enums: [
  28. {
  29. label: 'دوره آموزشی',
  30. value: 'TRAINING'
  31. },
  32. {
  33. label: 'حلقه مباحثاتی',
  34. value: 'DiscussionCircles'
  35. },
  36. {
  37. label: 'رویداد',
  38. value: 'EVENT'
  39. }
  40. ]
  41. }
  42. })
  43. }
  44. }
  45. class UnitCategoryList extends Collection {
  46. model () {
  47. return UnitCategory
  48. }
  49. }
  50. export { UnitCategory, UnitCategoryList }