team.interface.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import { Rule, RuleType } from '@midwayjs/validate';
  2. import { ApiProperty } from '@midwayjs/swagger';
  3. import { SearchBase } from 'free-midway-component';
  4. import get = require('lodash/get');
  5. const dealVO = (cla, data) => {
  6. for (const key in cla) {
  7. const val = get(data, key);
  8. if (val || val === 0) cla[key] = val;
  9. }
  10. };
  11. export class FVO_team {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '所属管理员' })
  18. 'administrator': string = undefined;
  19. @ApiProperty({ description: '团队名称' })
  20. 'name': string = undefined;
  21. @ApiProperty({ description: '成立时间' })
  22. 'create_time': string = undefined;
  23. @ApiProperty({ description: '单位地址' })
  24. 'address': string = undefined;
  25. @ApiProperty({ description: '手机号' })
  26. 'phone': string = undefined;
  27. @ApiProperty({ description: '团队logo' })
  28. 'logo': Array<any> = undefined;
  29. @ApiProperty({ description: '团队人数' })
  30. 'number': string = undefined;
  31. @ApiProperty({ description: '团队成员' })
  32. 'member': Array<any> = undefined;
  33. @ApiProperty({ description: '状态' })
  34. 'status': string = undefined;
  35. }
  36. export class QDTO_team extends SearchBase {
  37. constructor() {
  38. const like_prop = ['name'];
  39. const props = [
  40. 'administrator',
  41. 'name',
  42. 'create_time',
  43. 'phone',
  44. 'number',
  45. 'status',
  46. ];
  47. const mapping = [];
  48. super({ like_prop, props, mapping });
  49. }
  50. @ApiProperty({ description: '所属管理员' })
  51. 'administrator': string = undefined;
  52. @ApiProperty({ description: '团队名称' })
  53. 'name': string = undefined;
  54. @ApiProperty({ description: '成立时间' })
  55. 'create_time': string = undefined;
  56. @ApiProperty({ description: '手机号' })
  57. 'phone': string = undefined;
  58. @ApiProperty({ description: '团队人数' })
  59. 'number': string = undefined;
  60. @ApiProperty({ description: '状态' })
  61. 'status': string = undefined;
  62. }
  63. export class QVO_team extends FVO_team {
  64. constructor(data: object) {
  65. super(data);
  66. dealVO(this, data);
  67. }
  68. }
  69. export class CDTO_team {
  70. @ApiProperty({ description: '所属管理员' })
  71. @Rule(RuleType['string']().allow('', null))
  72. 'administrator': string = undefined;
  73. @ApiProperty({ description: '团队名称' })
  74. @Rule(RuleType['string']().allow('', null))
  75. 'name': string = undefined;
  76. @ApiProperty({ description: '成立时间' })
  77. @Rule(RuleType['string']().allow('', null))
  78. 'create_time': string = undefined;
  79. @ApiProperty({ description: '单位地址' })
  80. @Rule(RuleType['string']().allow('', null))
  81. 'address': string = undefined;
  82. @ApiProperty({ description: '手机号' })
  83. @Rule(RuleType['string']().allow('', null))
  84. 'phone': string = undefined;
  85. @ApiProperty({ description: '团队logo' })
  86. @Rule(RuleType['array']().allow('', null))
  87. 'logo': Array<any> = undefined;
  88. @ApiProperty({ description: '团队人数' })
  89. @Rule(RuleType['string']().allow('', null))
  90. 'number': string = undefined;
  91. @ApiProperty({ description: '团队成员' })
  92. @Rule(RuleType['array']().allow('', null))
  93. 'member': Array<any> = undefined;
  94. @ApiProperty({ description: '状态' })
  95. @Rule(RuleType['string']().allow('', null))
  96. 'status': string = undefined;
  97. }
  98. export class CVO_team extends FVO_team {
  99. constructor(data: object) {
  100. super(data);
  101. dealVO(this, data);
  102. }
  103. }
  104. export class UDTO_team extends CDTO_team {
  105. @ApiProperty({ description: '数据id' })
  106. @Rule(RuleType['string']().empty(''))
  107. _id: string = undefined;
  108. }
  109. export class UVAO_team extends FVO_team {
  110. constructor(data: object) {
  111. super(data);
  112. dealVO(this, data);
  113. }
  114. }