Config.interface.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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: 'logo' })
  18. 'logo_url': Array<any> = undefined;
  19. @ApiProperty({ description: '男头像' })
  20. 'boy_url': Array<any> = undefined;
  21. @ApiProperty({ description: '女头像' })
  22. 'girl_url': Array<any> = undefined;
  23. @ApiProperty({ description: '用户协议' })
  24. 'agree': string = undefined;
  25. @ApiProperty({ description: '底部文案' })
  26. 'bottom_title': string = undefined;
  27. }
  28. export class QDTO_Config extends SearchBase {
  29. constructor() {
  30. const like_prop = [];
  31. const props = [];
  32. const mapping = [];
  33. super({ like_prop, props, mapping });
  34. }
  35. }
  36. export class QVO_Config extends FVO_Config {
  37. constructor(data: object) {
  38. super(data);
  39. dealVO(this, data);
  40. }
  41. }
  42. export class CDTO_Config {
  43. @ApiProperty({ description: 'logo' })
  44. @Rule(RuleType['array']().empty(''))
  45. 'logo_url': Array<any> = undefined;
  46. @ApiProperty({ description: '男头像' })
  47. @Rule(RuleType['array']().empty(''))
  48. 'boy_url': Array<any> = undefined;
  49. @ApiProperty({ description: '女头像' })
  50. @Rule(RuleType['array']().empty(''))
  51. 'girl_url': Array<any> = undefined;
  52. @ApiProperty({ description: '用户协议' })
  53. @Rule(RuleType['string']().empty(''))
  54. 'agree': string = undefined;
  55. @ApiProperty({ description: '底部文案' })
  56. @Rule(RuleType['string']().empty(''))
  57. 'bottom_title': string = undefined;
  58. }
  59. export class CVO_Config extends FVO_Config {
  60. constructor(data: object) {
  61. super(data);
  62. dealVO(this, data);
  63. }
  64. }
  65. export class UDTO_Config extends CDTO_Config {
  66. @ApiProperty({ description: '数据id' })
  67. @Rule(RuleType['string']().empty(''))
  68. _id: string = undefined;
  69. }
  70. export class UVAO_Config extends FVO_Config {
  71. constructor(data: object) {
  72. super(data);
  73. dealVO(this, data);
  74. }
  75. }