new.interface.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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_new {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '标题' })
  18. 'title': string = undefined;
  19. @ApiProperty({ description: '类型' })
  20. 'type': string = undefined;
  21. @ApiProperty({ description: '发布时间' })
  22. 'time': string = undefined;
  23. @ApiProperty({ description: '内容' })
  24. 'content': string = undefined;
  25. @ApiProperty({ description: '是否使用' })
  26. 'is_use': string = undefined;
  27. @ApiProperty({ description: '状态' })
  28. 'status': string = undefined;
  29. }
  30. export class QDTO_new extends SearchBase {
  31. constructor() {
  32. const like_prop = [];
  33. const props = ['title', 'type', 'is_use', 'status'];
  34. const mapping = [];
  35. super({ like_prop, props, mapping });
  36. }
  37. @ApiProperty({ description: '标题' })
  38. 'title': string = undefined;
  39. @ApiProperty({ description: '类型' })
  40. 'type': string = undefined;
  41. @ApiProperty({ description: '是否使用' })
  42. 'is_use': string = undefined;
  43. @ApiProperty({ description: '状态' })
  44. 'status': string = undefined;
  45. }
  46. export class QVO_new extends FVO_new {
  47. constructor(data: object) {
  48. super(data);
  49. dealVO(this, data);
  50. }
  51. }
  52. export class CDTO_new {
  53. @ApiProperty({ description: '标题' })
  54. @Rule(RuleType['string']().empty(''))
  55. 'title': string = undefined;
  56. @ApiProperty({ description: '类型' })
  57. @Rule(RuleType['string']().empty(''))
  58. 'type': string = undefined;
  59. @ApiProperty({ description: '发布时间' })
  60. @Rule(RuleType['string']().empty(''))
  61. 'time': string = undefined;
  62. @ApiProperty({ description: '内容' })
  63. @Rule(RuleType['string']().empty(''))
  64. 'content': string = undefined;
  65. @ApiProperty({ description: '是否使用' })
  66. @Rule(RuleType['string']().empty(''))
  67. 'is_use': string = undefined;
  68. @ApiProperty({ description: '状态' })
  69. @Rule(RuleType['string']().empty(''))
  70. 'status': string = undefined;
  71. }
  72. export class CVO_new extends FVO_new {
  73. constructor(data: object) {
  74. super(data);
  75. dealVO(this, data);
  76. }
  77. }
  78. export class UDTO_new extends CDTO_new {
  79. @ApiProperty({ description: '数据id' })
  80. @Rule(RuleType['string']().empty(''))
  81. _id: string = undefined;
  82. }
  83. export class UVAO_new extends FVO_new {
  84. constructor(data: object) {
  85. super(data);
  86. dealVO(this, data);
  87. }
  88. }