record.interface.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_record {
  12. constructor(data: object) {
  13. dealVO(this, data);
  14. }
  15. @ApiProperty({ description: '数据id' })
  16. _id: string = undefined;
  17. @ApiProperty({ description: '用户id' })
  18. 'user_id': string = undefined;
  19. @ApiProperty({ description: '视频id' })
  20. 'video_id': string = undefined;
  21. @ApiProperty({ description: '观看时长' })
  22. 'time': string = undefined;
  23. @ApiProperty({ description: '开始时间' })
  24. 'start_time': string = undefined;
  25. @ApiProperty({ description: '结束时间' })
  26. 'end_time': string = undefined;
  27. }
  28. export class QDTO_record extends SearchBase {
  29. constructor() {
  30. const like_prop = [];
  31. const props = ['user_id', 'video_id', 'time'];
  32. const mapping = [];
  33. super({ like_prop, props, mapping });
  34. }
  35. @ApiProperty({ description: '用户id' })
  36. 'user_id': string = undefined;
  37. @ApiProperty({ description: '视频id' })
  38. 'video_id': string = undefined;
  39. @ApiProperty({ description: '观看时长' })
  40. 'time': string = undefined;
  41. }
  42. export class QVO_record extends FVO_record {
  43. constructor(data: object) {
  44. super(data);
  45. dealVO(this, data);
  46. }
  47. }
  48. export class CDTO_record {
  49. @ApiProperty({ description: '用户id' })
  50. @Rule(RuleType['string']().empty(''))
  51. 'user_id': string = undefined;
  52. @ApiProperty({ description: '视频id' })
  53. @Rule(RuleType['string']().empty(''))
  54. 'video_id': string = undefined;
  55. @ApiProperty({ description: '观看时长' })
  56. @Rule(RuleType['string']().empty(''))
  57. 'time': string = undefined;
  58. @ApiProperty({ description: '开始时间' })
  59. @Rule(RuleType['string']().empty(''))
  60. 'start_time': string = undefined;
  61. @ApiProperty({ description: '结束时间' })
  62. @Rule(RuleType['string']().empty(''))
  63. 'end_time': string = undefined;
  64. }
  65. export class CVO_record extends FVO_record {
  66. constructor(data: object) {
  67. super(data);
  68. dealVO(this, data);
  69. }
  70. }
  71. export class UDTO_record extends CDTO_record {
  72. @ApiProperty({ description: '数据id' })
  73. @Rule(RuleType['string']().empty(''))
  74. _id: string = undefined;
  75. }
  76. export class UVAO_record extends FVO_record {
  77. constructor(data: object) {
  78. super(data);
  79. dealVO(this, data);
  80. }
  81. }