video-redundancy.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
  2. import { PickWith, PickWithOpt } from '@server/typings/utils'
  3. import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
  4. import { VideoFileModel } from '@server/models/video/video-file'
  5. import { MVideoFile, MVideoFileVideo } from './video-file'
  6. import { MStreamingPlaylistVideo } from './video-streaming-playlist'
  7. import { MVideoUrl } from './video'
  8. type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
  9. // ############################################################################
  10. export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'>
  11. export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>
  12. // ############################################################################
  13. export type MVideoRedundancyFile = MVideoRedundancy &
  14. Use<'VideoFile', MVideoFile>
  15. export type MVideoRedundancyFileVideo = MVideoRedundancy &
  16. Use<'VideoFile', MVideoFileVideo>
  17. export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy &
  18. Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
  19. export type MVideoRedundancyVideo = MVideoRedundancy &
  20. Use<'VideoFile', MVideoFileVideo> &
  21. Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
  22. // ############################################################################
  23. // Format for API or AP object
  24. export type MVideoRedundancyAP = MVideoRedundancy &
  25. PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &
  26. PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>>