expert.interface.ts 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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_expert {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '平台用户id' })
  18. 'user': string = undefined;
  19. @ApiProperty({ description: '专家姓名' })
  20. 'name': string = undefined;
  21. @ApiProperty({ description: '头像' })
  22. 'icon': Array<any> = undefined;
  23. @ApiProperty({ description: '性别' })
  24. 'gender': string = undefined;
  25. @ApiProperty({ description: '出生年月' })
  26. 'birth': string = undefined;
  27. @ApiProperty({ description: '证件类型' })
  28. 'cardType': string = undefined;
  29. @ApiProperty({ description: '证件号码' })
  30. 'card': string = undefined;
  31. @ApiProperty({ description: '联系电话' })
  32. 'phone': string = undefined;
  33. @ApiProperty({ description: '所属领域' })
  34. 'field': string = undefined;
  35. @ApiProperty({ description: '研究方向' })
  36. 'direction': string = undefined;
  37. @ApiProperty({ description: '学历' })
  38. 'education': string = undefined;
  39. @ApiProperty({ description: '工作单位' })
  40. 'work': string = undefined;
  41. @ApiProperty({ description: '职称' })
  42. 'title': string = undefined;
  43. @ApiProperty({ description: '简介' })
  44. 'brief': string = undefined;
  45. @ApiProperty({ description: '所在地区' })
  46. 'area': Array<any> = undefined;
  47. @ApiProperty({ description: '是否公开' })
  48. 'is_show': string = undefined;
  49. @ApiProperty({ description: '状态' })
  50. 'status': string = undefined;
  51. }
  52. export class QDTO_expert extends SearchBase {
  53. constructor() {
  54. const like_prop = ['name'];
  55. const props = ['user', 'name', 'gender', 'phone', 'field', 'direction', 'education', 'title', 'area', 'is_show', 'status'];
  56. const mapping = [];
  57. super({ like_prop, props, mapping });
  58. }
  59. @ApiProperty({ description: '平台用户id' })
  60. 'user': string = undefined;
  61. @ApiProperty({ description: '专家姓名' })
  62. 'name': string = undefined;
  63. @ApiProperty({ description: '性别' })
  64. 'gender': string = undefined;
  65. @ApiProperty({ description: '联系电话' })
  66. 'phone': string = undefined;
  67. @ApiProperty({ description: '所属领域' })
  68. 'field': string = undefined;
  69. @ApiProperty({ description: '研究方向' })
  70. 'direction': string = undefined;
  71. @ApiProperty({ description: '学历' })
  72. 'education': string = undefined;
  73. @ApiProperty({ description: '职称' })
  74. 'title': string = undefined;
  75. @ApiProperty({ description: '所在地区' })
  76. 'area': Array<any> = undefined;
  77. @ApiProperty({ description: '是否公开' })
  78. 'is_show': string = undefined;
  79. @ApiProperty({ description: '状态' })
  80. 'status': string = undefined;
  81. }
  82. export class QVO_expert extends FVO_expert {
  83. constructor(data: object) {
  84. super(data);
  85. dealVO(this, data);
  86. }
  87. }
  88. export class CDTO_expert {
  89. @ApiProperty({ description: '平台用户id' })
  90. @Rule(RuleType['string']().empty(''))
  91. 'user': string = undefined;
  92. @ApiProperty({ description: '专家姓名' })
  93. @Rule(RuleType['string']().empty(''))
  94. 'name': string = undefined;
  95. @ApiProperty({ description: '头像' })
  96. @Rule(RuleType['array']().empty(''))
  97. 'icon': Array<any> = undefined;
  98. @ApiProperty({ description: '性别' })
  99. @Rule(RuleType['string']().empty(''))
  100. 'gender': string = undefined;
  101. @ApiProperty({ description: '出生年月' })
  102. @Rule(RuleType['string']().empty(''))
  103. 'birth': string = undefined;
  104. @ApiProperty({ description: '证件类型' })
  105. @Rule(RuleType['string']().empty(''))
  106. 'cardType': string = undefined;
  107. @ApiProperty({ description: '证件号码' })
  108. @Rule(RuleType['string']().empty(''))
  109. 'card': string = undefined;
  110. @ApiProperty({ description: '联系电话' })
  111. @Rule(RuleType['string']().empty(''))
  112. 'phone': string = undefined;
  113. @ApiProperty({ description: '所属领域' })
  114. @Rule(RuleType['string']().empty(''))
  115. 'field': string = undefined;
  116. @ApiProperty({ description: '研究方向' })
  117. @Rule(RuleType['string']().empty(''))
  118. 'direction': string = undefined;
  119. @ApiProperty({ description: '学历' })
  120. @Rule(RuleType['string']().empty(''))
  121. 'education': string = undefined;
  122. @ApiProperty({ description: '工作单位' })
  123. @Rule(RuleType['string']().empty(''))
  124. 'work': string = undefined;
  125. @ApiProperty({ description: '职称' })
  126. @Rule(RuleType['string']().empty(''))
  127. 'title': string = undefined;
  128. @ApiProperty({ description: '简介' })
  129. @Rule(RuleType['string']().empty(''))
  130. 'brief': string = undefined;
  131. @ApiProperty({ description: '所在地区' })
  132. @Rule(RuleType['array']().empty(''))
  133. 'area': Array<any> = undefined;
  134. @ApiProperty({ description: '是否公开' })
  135. @Rule(RuleType['string']().empty(''))
  136. 'is_show': string = undefined;
  137. @ApiProperty({ description: '状态' })
  138. @Rule(RuleType['string']().empty(''))
  139. 'status': string = undefined;
  140. }
  141. export class CVO_expert extends FVO_expert {
  142. constructor(data: object) {
  143. super(data);
  144. dealVO(this, data);
  145. }
  146. }
  147. export class UDTO_expert extends CDTO_expert {
  148. @ApiProperty({ description: '数据id' })
  149. @Rule(RuleType['string']().empty(''))
  150. _id: string = undefined;
  151. }
  152. export class UVAO_expert extends FVO_expert {
  153. constructor(data: object) {
  154. super(data);
  155. dealVO(this, data);
  156. }
  157. }