More robust objects indexer
This commit is contained in:
parent
f2cb0fc97f
commit
b240253996
|
@ -89,6 +89,8 @@ export function formatChannelForAPI (c: DBChannel, fromHost?: string): APIVideoC
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatChannelForDB (c: IndexableChannel): DBChannel {
|
export function formatChannelForDB (c: IndexableChannel): DBChannel {
|
||||||
|
if (!c.ownerAccount) return undefined
|
||||||
|
|
||||||
return {
|
return {
|
||||||
primaryKey: buildDBChannelPrimaryKey(c),
|
primaryKey: buildDBChannelPrimaryKey(c),
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,11 @@ export async function queryPlaylists (search: PlaylistsSearchQuery) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatPlaylistForAPI (p: DBPlaylist, fromHost?: string): APIPlaylist {
|
export function formatPlaylistForAPI (p: DBPlaylist, fromHost?: string): APIPlaylist {
|
||||||
|
if (!p.ownerAccount) return undefined
|
||||||
|
if (!p.videoChannel) return undefined
|
||||||
|
if (!p.privacy) return undefined
|
||||||
|
if (!p.type) return undefined
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: p.id,
|
id: p.id,
|
||||||
uuid: p.uuid,
|
uuid: p.uuid,
|
||||||
|
|
|
@ -91,6 +91,11 @@ export async function getVideosUpdatedAt (uuids: string[]): Promise<{ updatedAt:
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DBVideo | DBVideoDetails {
|
export function formatVideoForDB (v: IndexableVideo | IndexableVideoDetails): DBVideo | DBVideoDetails {
|
||||||
|
if (!v.category) return undefined
|
||||||
|
if (!v.licence) return undefined
|
||||||
|
if (!v.language) return undefined
|
||||||
|
if (!v.privacy) return undefined
|
||||||
|
|
||||||
const video = {
|
const video = {
|
||||||
id: v.id,
|
id: v.id,
|
||||||
uuid: v.uuid,
|
uuid: v.uuid,
|
||||||
|
|
Loading…
Reference in New Issue