Team.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { User } from 'src/models/User.js'
  2. import { Collection, Model } from 'js-abstract-model'
  3. class Team extends Model {
  4. constructor (data) {
  5. super(data, [
  6. { key: 'id' },
  7. { key: 'title' },
  8. { key: 'capacity' },
  9. { key: 'used_capacity' },
  10. { key: 'description' },
  11. { key: 'is_active' },
  12. { key: 'is_deleted' },
  13. { key: 'join_status' },
  14. { key: 'classroom' },
  15. { key: 'leader' },
  16. {
  17. key: 'leader_info',
  18. relatedModel: User
  19. },
  20. { key: 'creation_time' },
  21. { key: 'last_modification_time' }
  22. ], {
  23. join_status: {
  24. infoKey: 'join_status_info',
  25. enumListKey: 'join_statusEnums',
  26. enums: [
  27. {
  28. label: 'فعال',
  29. value: 'ENABLED'
  30. },
  31. {
  32. label: 'ظرفیت تکمیل',
  33. value: 'FULL'
  34. },
  35. {
  36. label: 'عضویت توسط ادمین',
  37. value: 'DISABLED'
  38. },
  39. {
  40. label: 'عضوهستید',
  41. value: 'JOINED'
  42. }
  43. ]
  44. }
  45. })
  46. }
  47. }
  48. class TeamList extends Collection {
  49. model () {
  50. return Team
  51. }
  52. }
  53. export { Team, TeamList }