channel.interface.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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_channel {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '房间号' })
  18. 'room_id': string = undefined;
  19. @ApiProperty({ description: '用户类型' })
  20. 'type': string = undefined;
  21. @ApiProperty({ description: '密码' })
  22. 'password': string = undefined;
  23. @ApiProperty({ description: '标题' })
  24. 'title': string = undefined;
  25. @ApiProperty({ description: '来源' })
  26. 'origin': string = undefined;
  27. @ApiProperty({ description: '类别' })
  28. 'channel_type': string = undefined;
  29. @ApiProperty({ description: '简介' })
  30. 'brief': string = undefined;
  31. @ApiProperty({ description: '状态' })
  32. 'status': string = undefined;
  33. }
  34. export class QDTO_channel extends SearchBase {
  35. constructor() {
  36. const like_prop = [];
  37. const props = [
  38. 'room_id',
  39. 'type',
  40. 'title',
  41. 'origin',
  42. 'channel_type',
  43. 'status',
  44. ];
  45. const mapping = [];
  46. super({ like_prop, props, mapping });
  47. }
  48. @ApiProperty({ description: '房间号' })
  49. 'room_id': string = undefined;
  50. @ApiProperty({ description: '用户类型' })
  51. 'type': string = undefined;
  52. @ApiProperty({ description: '标题' })
  53. 'title': string = undefined;
  54. @ApiProperty({ description: '来源' })
  55. 'origin': string = undefined;
  56. @ApiProperty({ description: '类别' })
  57. 'channel_type': string = undefined;
  58. @ApiProperty({ description: '状态' })
  59. 'status': string = undefined;
  60. }
  61. export class QVO_channel extends FVO_channel {
  62. constructor(data: object) {
  63. super(data);
  64. dealVO(this, data);
  65. }
  66. }
  67. export class CDTO_channel {
  68. @ApiProperty({ description: '房间号' })
  69. @Rule(RuleType['string']().empty(''))
  70. 'room_id': string = undefined;
  71. @ApiProperty({ description: '用户类型' })
  72. @Rule(RuleType['string']().empty(''))
  73. 'type': string = undefined;
  74. @ApiProperty({ description: '密码' })
  75. @Rule(RuleType['string']().empty(''))
  76. 'password': string = undefined;
  77. @ApiProperty({ description: '标题' })
  78. @Rule(RuleType['string']().empty(''))
  79. 'title': string = undefined;
  80. @ApiProperty({ description: '来源' })
  81. @Rule(RuleType['string']().empty(''))
  82. 'origin': string = undefined;
  83. @ApiProperty({ description: '类别' })
  84. @Rule(RuleType['string']().empty(''))
  85. 'channel_type': string = undefined;
  86. @ApiProperty({ description: '简介' })
  87. @Rule(RuleType['string']().empty(''))
  88. 'brief': string = undefined;
  89. @ApiProperty({ description: '状态' })
  90. @Rule(RuleType['string']().empty(''))
  91. 'status': string = undefined;
  92. }
  93. export class CVO_channel extends FVO_channel {
  94. constructor(data: object) {
  95. super(data);
  96. dealVO(this, data);
  97. }
  98. }
  99. export class UDTO_channel extends CDTO_channel {
  100. @ApiProperty({ description: '数据id' })
  101. @Rule(RuleType['string']().empty(''))
  102. _id: string = undefined;
  103. }
  104. export class UVAO_channel extends FVO_channel {
  105. constructor(data: object) {
  106. super(data);
  107. dealVO(this, data);
  108. }
  109. }