config.interface.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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_config {
  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. 'icon': Array<any> = undefined;
  21. @ApiProperty({ description: 'logo' })
  22. 'logo': Array<any> = undefined;
  23. @ApiProperty({ description: '联系电话' })
  24. 'phone': string = undefined;
  25. @ApiProperty({ description: '首页轮播图' })
  26. 'file': Array<any> = undefined;
  27. @ApiProperty({ description: '底部提示语' })
  28. 'bottom_title': string = undefined;
  29. @ApiProperty({ description: '通知' })
  30. 'notice': string = undefined;
  31. @ApiProperty({ description: '用户协议' })
  32. 'agreement': string = undefined;
  33. @ApiProperty({ description: '简介' })
  34. 'brief': string = undefined;
  35. }
  36. export class QDTO_config extends SearchBase {
  37. constructor() {
  38. const like_prop = [];
  39. const props = [];
  40. const mapping = [];
  41. super({ like_prop, props, mapping });
  42. }
  43. }
  44. export class QVO_config extends FVO_config {
  45. constructor(data: object) {
  46. super(data);
  47. dealVO(this, data);
  48. }
  49. }
  50. export class CDTO_config {
  51. @ApiProperty({ description: '标题' })
  52. @Rule(RuleType['string']().empty(''))
  53. 'title': string = undefined;
  54. @ApiProperty({ description: '用户默认头像' })
  55. @Rule(RuleType['array']().empty(''))
  56. 'icon': Array<any> = undefined;
  57. @ApiProperty({ description: 'logo' })
  58. @Rule(RuleType['array']().empty(''))
  59. 'logo': Array<any> = undefined;
  60. @ApiProperty({ description: '联系电话' })
  61. @Rule(RuleType['string']().empty(''))
  62. 'phone': string = undefined;
  63. @ApiProperty({ description: '首页轮播图' })
  64. @Rule(RuleType['array']().empty(''))
  65. 'file': Array<any> = undefined;
  66. @ApiProperty({ description: '底部提示语' })
  67. @Rule(RuleType['string']().empty(''))
  68. 'bottom_title': string = undefined;
  69. @ApiProperty({ description: '通知' })
  70. @Rule(RuleType['string']().empty(''))
  71. 'notice': string = undefined;
  72. @ApiProperty({ description: '用户协议' })
  73. @Rule(RuleType['string']().empty(''))
  74. 'agreement': string = undefined;
  75. @ApiProperty({ description: '简介' })
  76. @Rule(RuleType['string']().empty(''))
  77. 'brief': string = undefined;
  78. }
  79. export class CVO_config extends FVO_config {
  80. constructor(data: object) {
  81. super(data);
  82. dealVO(this, data);
  83. }
  84. }
  85. export class UDTO_config extends CDTO_config {
  86. @ApiProperty({ description: '数据id' })
  87. @Rule(RuleType['string']().empty(''))
  88. _id: string = undefined;
  89. }
  90. export class UVAO_config extends FVO_config {
  91. constructor(data: object) {
  92. super(data);
  93. dealVO(this, data);
  94. }
  95. }