expert.interface.ts 5.0 KB

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