2019-08-15 11:53:26 +02:00
|
|
|
import { VideoCommentModel } from '../../../models/video/video-comment'
|
2019-08-21 14:31:57 +02:00
|
|
|
import { PickWith, PickWithOpt } from '../../utils'
|
2019-11-15 15:06:03 +01:00
|
|
|
import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account'
|
2019-08-21 14:31:57 +02:00
|
|
|
import { MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUrl } from './video'
|
2019-08-20 13:52:49 +02:00
|
|
|
|
|
|
|
type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
|
|
|
|
|
|
|
|
// ############################################################################
|
2019-08-15 11:53:26 +02:00
|
|
|
|
|
|
|
export type MComment = Omit<VideoCommentModel, 'OriginVideoComment' | 'InReplyToVideoComment' | 'Video' | 'Account'>
|
2019-08-20 19:05:31 +02:00
|
|
|
export type MCommentTotalReplies = MComment & { totalReplies?: number }
|
2019-08-15 11:53:26 +02:00
|
|
|
export type MCommentId = Pick<MComment, 'id'>
|
2019-08-21 14:31:57 +02:00
|
|
|
export type MCommentUrl = Pick<MComment, 'url'>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
2019-08-20 13:52:49 +02:00
|
|
|
// ############################################################################
|
2019-08-15 11:53:26 +02:00
|
|
|
|
|
|
|
export type MCommentOwner = MComment &
|
2019-08-20 13:52:49 +02:00
|
|
|
Use<'Account', MAccountDefault>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
|
|
|
export type MCommentVideo = MComment &
|
2019-08-20 13:52:49 +02:00
|
|
|
Use<'Video', MVideoAccountLight>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
|
|
|
export type MCommentReply = MComment &
|
2019-08-20 13:52:49 +02:00
|
|
|
Use<'InReplyToVideoComment', MComment>
|
|
|
|
|
|
|
|
export type MCommentOwnerVideo = MComment &
|
|
|
|
Use<'Account', MAccountDefault> &
|
|
|
|
Use<'Video', MVideoAccountLight>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
2019-08-20 13:52:49 +02:00
|
|
|
export type MCommentOwnerVideoReply = MComment &
|
|
|
|
Use<'Account', MAccountDefault> &
|
|
|
|
Use<'Video', MVideoAccountLight> &
|
|
|
|
Use<'InReplyToVideoComment', MComment>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
2019-08-20 13:52:49 +02:00
|
|
|
export type MCommentOwnerReplyVideoLight = MComment &
|
|
|
|
Use<'Account', MAccountDefault> &
|
|
|
|
Use<'InReplyToVideoComment', MComment> &
|
|
|
|
Use<'Video', MVideoIdUrl>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
|
|
|
export type MCommentOwnerVideoFeed = MCommentOwner &
|
2019-08-20 13:52:49 +02:00
|
|
|
Use<'Video', MVideoFeed>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
export type MCommentAPI = MComment & { totalReplies: number }
|
2019-08-20 19:05:31 +02:00
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
|
|
|
// Format for API or AP object
|
|
|
|
|
|
|
|
export type MCommentFormattable = MCommentTotalReplies &
|
|
|
|
Use<'Account', MAccountFormattable>
|
2019-08-21 14:31:57 +02:00
|
|
|
|
|
|
|
export type MCommentAP = MComment &
|
|
|
|
Use<'Account', MAccountUrl> &
|
|
|
|
PickWithOpt<VideoCommentModel, 'Video', MVideoUrl> &
|
|
|
|
PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>
|