Correctly type API models
This commit is contained in:
parent
5ff8df46c6
commit
15c2a17972
2
PeerTube
2
PeerTube
|
@ -1 +1 @@
|
|||
Subproject commit 99139e7753e20ab0fba8eae5638d3dd3e792fe43
|
||||
Subproject commit 3521ab8fc01da85fa804439ca6e297e6fb364c58
|
|
@ -194,7 +194,7 @@ function formatChannelForDB (c: IndexableChannel): DBChannel {
|
|||
}
|
||||
}
|
||||
|
||||
function formatChannelForAPI (c: DBChannel, fromHost?: string): any {
|
||||
function formatChannelForAPI (c: DBChannel, fromHost?: string): VideoChannel {
|
||||
return {
|
||||
id: c.id,
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import { CONFIG } from '../initializers/constants'
|
|||
import { VideosSearchQuery } from '../types/video-search.model'
|
||||
import { DBVideo, DBVideoDetails, IndexableVideo, IndexableVideoDetails } from '../types/video.model'
|
||||
import { buildAvatarMapping, formatAvatarForAPI, formatAvatarForDB } from './elastic-search-avatar'
|
||||
import { Video } from '../../PeerTube/shared/models'
|
||||
|
||||
function initVideosIndex () {
|
||||
return buildIndex(CONFIG.ELASTIC_SEARCH.INDEXES.VIDEOS, buildVideosMapping())
|
||||
|
@ -355,7 +356,7 @@ function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DBVideo |
|
|||
}
|
||||
}
|
||||
|
||||
function formatVideoForAPI (v: DBVideo, fromHost?: string): any {
|
||||
function formatVideoForAPI (v: DBVideo, fromHost?: string): Video {
|
||||
return {
|
||||
id: v.id,
|
||||
uuid: v.uuid,
|
||||
|
|
|
@ -2,10 +2,8 @@ import { IndexableDoc } from './elastic-search.model'
|
|||
import { VideoChannel, VideoChannelSummary, Avatar } from '@shared/models'
|
||||
import { Account } from '@shared/models/actors/account.model'
|
||||
|
||||
export interface IndexableChannelSummary extends VideoChannelSummary, IndexableDoc {
|
||||
}
|
||||
|
||||
export interface IndexableChannel extends VideoChannel, IndexableDoc {
|
||||
url: string
|
||||
}
|
||||
|
||||
export interface DBChannel extends Omit<VideoChannel, 'isLocal'> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export interface IndexableDoc {
|
||||
elasticSearchId: string
|
||||
host: string
|
||||
url: string
|
||||
url?: string
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue