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

18 lines
513 B
TypeScript
Raw Normal View History

2020-12-08 14:30:29 +01:00
import { ActorModel } from '../../models/actor/actor'
import { MActorAccountChannelId, MActorFull } from '../../types/models'
type ActorLoadByUrlType = 'all' | 'association-ids'
2019-08-15 11:53:26 +02:00
function loadActorByUrl (url: string, fetchType: ActorLoadByUrlType): Promise<MActorFull | MActorAccountChannelId> {
if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url)
2019-08-15 11:53:26 +02:00
if (fetchType === 'association-ids') return ActorModel.loadByUrl(url)
}
export {
ActorLoadByUrlType,
loadActorByUrl
}