More robust objects indexer

This commit is contained in:
Chocobozzz 2024-02-09 10:14:11 +01:00
parent f2cb0fc97f
commit b240253996
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 12 additions and 0 deletions

View File

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

View File

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

View File

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