PeerTube/server/core/lib/model-loaders/actor.ts

17 lines
529 B
TypeScript
Raw Permalink Normal View History

import { ActorModel } from '../../models/actor/actor.js'
import { MActorAccountChannelId, MActorFull } from '../../types/models/index.js'
type ActorLoadByUrlType = 'all' | 'association-ids'
2019-08-15 04:53:26 -05:00
function loadActorByUrl (url: string, fetchType: ActorLoadByUrlType): Promise<MActorFull | MActorAccountChannelId> {
if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url)
2019-08-15 04:53:26 -05:00
if (fetchType === 'association-ids') return ActorModel.loadByUrl(url)
}
export {
type ActorLoadByUrlType,
loadActorByUrl
}