PeerTube/server/typings/models/video/video-comment.ts

52 lines
1.8 KiB
TypeScript
Raw Normal View History

2019-08-15 11:53:26 +02:00
import { VideoCommentModel } from '../../../models/video/video-comment'
import { PickWith } from '../../utils'
2019-08-20 19:05:31 +02:00
import { MAccountDefault, MAccountFormattable } from '../account'
2019-08-20 13:52:49 +02:00
import { MVideoAccountLight, MVideoFeed, MVideoIdUrl } from './video'
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-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>