2023-11-09 14:34:36 +01:00
|
|
|
import { CONFIG, SORTABLE_COLUMNS } from '../../initializers/constants'
|
2021-06-24 15:18:54 +02:00
|
|
|
import { DBPlaylist, IndexablePlaylist } from '../../types/playlist.model'
|
2023-11-09 14:34:36 +01:00
|
|
|
import { formatPlaylistForDB } from '../meilisearch/meilisearch-playlists'
|
2021-06-24 15:18:54 +02:00
|
|
|
import { AbstractIndexer } from './shared'
|
|
|
|
|
|
|
|
export class PlaylistIndexer extends AbstractIndexer <IndexablePlaylist, DBPlaylist> {
|
2023-11-09 14:34:36 +01:00
|
|
|
protected readonly primaryKey = 'uuid'
|
2024-01-15 10:16:57 +01:00
|
|
|
protected readonly filterableAttributes = [ 'uuid', 'host', 'ownerAccount.handle', 'ownerAccount.host', 'videosLength' ]
|
2023-11-09 14:34:36 +01:00
|
|
|
protected readonly sortableAttributes = SORTABLE_COLUMNS.PLAYLISTS_SEARCH
|
|
|
|
// Keep the order, most important first
|
|
|
|
protected readonly searchableAttributes = [ 'displayName', 'videoChannel.displayName', 'ownerAccount.displayName', 'description' ]
|
2021-06-24 15:18:54 +02:00
|
|
|
|
|
|
|
constructor () {
|
2023-11-09 14:34:36 +01:00
|
|
|
super(CONFIG.MEILISEARCH.INDEXES.PLAYLISTS, formatPlaylistForDB)
|
2021-06-24 15:18:54 +02:00
|
|
|
}
|
|
|
|
|
2023-11-13 10:06:43 +01:00
|
|
|
async indexSpecificElement (host: string, uuid: string): Promise<any> {
|
2021-06-24 15:18:54 +02:00
|
|
|
// We don't need to index a specific element yet, since we have all playlist information in the list endpoint
|
|
|
|
throw new Error('Not implemented')
|
|
|
|
}
|
|
|
|
}
|