Correctly type API models

This commit is contained in:
Chocobozzz 2020-06-10 14:33:20 +02:00
parent 5ff8df46c6
commit 15c2a17972
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 6 additions and 7 deletions

@ -1 +1 @@
Subproject commit 99139e7753e20ab0fba8eae5638d3dd3e792fe43
Subproject commit 3521ab8fc01da85fa804439ca6e297e6fb364c58

View File

@ -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,

View File

@ -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,

View File

@ -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'> {

View File

@ -1,5 +1,5 @@
export interface IndexableDoc {
elasticSearchId: string
host: string
url: string
url?: string
}