match.interface.ts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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_match {
  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. 'type': string = undefined;
  23. @ApiProperty({ description: '行业' })
  24. 'industry': string = undefined;
  25. @ApiProperty({ description: '类别' })
  26. 'form': string = undefined;
  27. @ApiProperty({ description: '有效期' })
  28. 'time': Array<any> = undefined;
  29. @ApiProperty({ description: '奖金' })
  30. 'money': string = undefined;
  31. @ApiProperty({ description: '赛事规则' })
  32. 'rules': object = undefined;
  33. @ApiProperty({ description: '简介' })
  34. 'brief': string = undefined;
  35. @ApiProperty({ description: '封面' })
  36. 'file': Array<any> = undefined;
  37. @ApiProperty({ description: '赛事状态' })
  38. 'match_status': string = undefined;
  39. @ApiProperty({ description: '是否公开' })
  40. 'is_use': string = undefined;
  41. @ApiProperty({ description: '状态' })
  42. 'status': string = undefined;
  43. }
  44. export class QDTO_match extends SearchBase {
  45. constructor() {
  46. const like_prop = ['name'];
  47. const props = ['user', 'industry', 'name', 'type', 'status', 'form', 'match_status', 'is_use'];
  48. const mapping = [];
  49. super({ like_prop, props, mapping });
  50. }
  51. @ApiProperty({ description: '用户id' })
  52. 'user': string = undefined;
  53. @ApiProperty({ description: '名称' })
  54. 'name': string = undefined;
  55. @ApiProperty({ description: '类型' })
  56. 'type': string = undefined;
  57. @ApiProperty({ description: '行业' })
  58. 'industry': string = undefined;
  59. @ApiProperty({ description: '类别' })
  60. 'form': string = undefined;
  61. @ApiProperty({ description: '赛事状态' })
  62. 'match_status': string = undefined;
  63. @ApiProperty({ description: '是否公开' })
  64. 'is_use': string = undefined;
  65. @ApiProperty({ description: '状态' })
  66. 'status': string = undefined;
  67. }
  68. export class QVO_match extends FVO_match {
  69. constructor(data: object) {
  70. super(data);
  71. dealVO(this, data);
  72. }
  73. }
  74. export class CDTO_match {
  75. @ApiProperty({ description: '用户id' })
  76. @Rule(RuleType['string']().empty(''))
  77. 'user': string = undefined;
  78. @ApiProperty({ description: '名称' })
  79. @Rule(RuleType['string']().empty(''))
  80. 'name': string = undefined;
  81. @ApiProperty({ description: '类型' })
  82. @Rule(RuleType['string']().empty(''))
  83. 'type': string = undefined;
  84. @ApiProperty({ description: '行业' })
  85. @Rule(RuleType['string']().empty(''))
  86. 'industry': string = undefined;
  87. @ApiProperty({ description: '类别' })
  88. @Rule(RuleType['string']().empty(''))
  89. 'form': string = undefined;
  90. @ApiProperty({ description: '有效期' })
  91. @Rule(RuleType['array']().empty(''))
  92. 'time': Array<any> = undefined;
  93. @ApiProperty({ description: '奖金' })
  94. @Rule(RuleType['string']().empty(''))
  95. 'money': string = undefined;
  96. @ApiProperty({ description: '赛事规则' })
  97. @Rule(RuleType['object']().empty(''))
  98. 'rules': object = undefined;
  99. @ApiProperty({ description: '简介' })
  100. @Rule(RuleType['string']().empty(''))
  101. 'brief': string = undefined;
  102. @ApiProperty({ description: '封面' })
  103. @Rule(RuleType['array']().empty(''))
  104. 'file': Array<any> = undefined;
  105. @ApiProperty({ description: '赛事状态' })
  106. @Rule(RuleType['string']().empty(''))
  107. 'match_status': string = undefined;
  108. @ApiProperty({ description: '是否公开' })
  109. @Rule(RuleType['string']().empty(''))
  110. 'is_use': string = undefined;
  111. @ApiProperty({ description: '状态' })
  112. @Rule(RuleType['string']().empty(''))
  113. 'status': string = undefined;
  114. }
  115. export class CVO_match extends FVO_match {
  116. constructor(data: object) {
  117. super(data);
  118. dealVO(this, data);
  119. }
  120. }
  121. export class UDTO_match extends CDTO_match {
  122. @ApiProperty({ description: '数据id' })
  123. @Rule(RuleType['string']().empty(''))
  124. _id: string = undefined;
  125. }
  126. export class UVAO_match extends FVO_match {
  127. constructor(data: object) {
  128. super(data);
  129. dealVO(this, data);
  130. }
  131. }