video-comment.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { VideoCommentModel } from '../../../models/video/video-comment'
  2. import { PickWith, PickWithOpt } from '../../utils'
  3. import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
  4. import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
  5. type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
  6. // ############################################################################
  7. export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
  8. export type MCommentTotalReplies = MComment & { totalReplies?: number }
  9. export type MCommentId = Pick<MComment, 'id'>
  10. export type MCommentUrl = Pick<MComment, 'url'>
  11. // ############################################################################
  12. export type MCommentOwner = MComment &
  13. Use<'Account', MAccountDefault>
  14. export type MCommentVideo = MComment &
  15. Use<'Video', MVideoAccountLight>
  16. export type MCommentReply = MComment &
  17. Use<'InReplyToVideoComment', MComment>
  18. export type MCommentOwnerVideo = MComment &
  19. Use<'Account', MAccountDefault> &
  20. Use<'Video', MVideoAccountLight>
  21. export type MCommentOwnerVideoReply = MComment &
  22. Use<'Account', MAccountDefault> &
  23. Use<'Video', MVideoAccountLight> &
  24. Use<'InReplyToVideoComment', MComment>
  25. export type MCommentOwnerReplyVideoLight = MComment &
  26. Use<'Account', MAccountDefault> &
  27. Use<'InReplyToVideoComment', MComment> &
  28. Use<'Video', MVideoIdUrl>
  29. export type MCommentOwnerVideoFeed = MCommentOwner &
  30. Use<'Video', MVideoFeed>
  31. // ############################################################################
  32. export type MCommentAPI = MComment & { totalReplies: number }
  33. // ############################################################################
  34. // Format for API or AP object
  35. export type MCommentFormattable = MCommentTotalReplies &
  36. Use<'Account', MAccountFormattable>
  37. export type MCommentAP = MComment &
  38. Use<'Account', MAccountUrl> &
  39. PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
  40. PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>