user.interface.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_user {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '微信小程序id' })
  18. 'openid': string = undefined;
  19. @ApiProperty({ description: '昵称' })
  20. 'nick_name': string = undefined;
  21. @ApiProperty({ description: '电话' })
  22. 'tel': string = undefined;
  23. @ApiProperty({ description: '部门' })
  24. 'dept': string = undefined;
  25. }
  26. export class QDTO_user extends SearchBase {
  27. constructor() {
  28. const like_prop = [];
  29. const props = [];
  30. const mapping = [];
  31. super({ like_prop, props, mapping });
  32. }
  33. }
  34. export class QVO_user extends FVO_user {
  35. constructor(data: object) {
  36. super(data);
  37. dealVO(this, data);
  38. }
  39. }
  40. export class CDTO_user {
  41. @ApiProperty({ description: '微信小程序id' })
  42. @Rule(RuleType['string']().empty(''))
  43. 'openid': string = undefined;
  44. @ApiProperty({ description: '昵称' })
  45. @Rule(RuleType['string']().empty(''))
  46. 'nick_name': string = undefined;
  47. @ApiProperty({ description: '电话' })
  48. @Rule(RuleType['string']().empty(''))
  49. 'tel': string = undefined;
  50. @ApiProperty({ description: '部门' })
  51. @Rule(RuleType['string']().empty(''))
  52. 'dept': string = undefined;
  53. }
  54. export class CVO_user extends FVO_user {
  55. constructor(data: object) {
  56. super(data);
  57. dealVO(this, data);
  58. }
  59. }
  60. export class UDTO_user extends CDTO_user {
  61. @ApiProperty({ description: '数据id' })
  62. @Rule(RuleType['string']().empty(''))
  63. _id: string = undefined;
  64. }
  65. export class UVAO_user extends FVO_user {
  66. constructor(data: object) {
  67. super(data);
  68. dealVO(this, data);
  69. }
  70. }