From 868fce62f86812759ccedccf7634236ac3701d9a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 3 Jun 2021 18:10:56 +0200 Subject: fetch -> load avoid confusion with AP fetch functions --- server/lib/model-loaders/actor.ts | 9 ++++---- server/lib/model-loaders/video.ts | 45 ++++++++++++++++++++------------------- 2 files changed, 28 insertions(+), 26 deletions(-) (limited to 'server/lib/model-loaders') diff --git a/server/lib/model-loaders/actor.ts b/server/lib/model-loaders/actor.ts index 234cb344f..1355d8ee2 100644 --- a/server/lib/model-loaders/actor.ts +++ b/server/lib/model-loaders/actor.ts @@ -2,15 +2,16 @@ import { ActorModel } from '../../models/actor/actor' import { MActorAccountChannelId, MActorFull } from '../../types/models' -type ActorFetchByUrlType = 'all' | 'association-ids' +type ActorLoadByUrlType = 'all' | 'association-ids' -function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType): Promise { +function loadActorByUrl (url: string, fetchType: ActorLoadByUrlType): Promise { if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url) if (fetchType === 'association-ids') return ActorModel.loadByUrl(url) } export { - ActorFetchByUrlType, - fetchActorByUrl + ActorLoadByUrlType, + + loadActorByUrl } diff --git a/server/lib/model-loaders/video.ts b/server/lib/model-loaders/video.ts index 7aaf00e89..597c94395 100644 --- a/server/lib/model-loaders/video.ts +++ b/server/lib/model-loaders/video.ts @@ -8,21 +8,21 @@ import { MVideoWithRights } from '@server/types/models' -type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes' +type VideoLoadType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes' -function fetchVideo (id: number | string, fetchType: 'all', userId?: number): Promise -function fetchVideo (id: number | string, fetchType: 'only-immutable-attributes'): Promise -function fetchVideo (id: number | string, fetchType: 'only-video', userId?: number): Promise -function fetchVideo (id: number | string, fetchType: 'only-video-with-rights', userId?: number): Promise -function fetchVideo (id: number | string, fetchType: 'id' | 'none', userId?: number): Promise -function fetchVideo ( +function loadVideo (id: number | string, fetchType: 'all', userId?: number): Promise +function loadVideo (id: number | string, fetchType: 'only-immutable-attributes'): Promise +function loadVideo (id: number | string, fetchType: 'only-video', userId?: number): Promise +function loadVideo (id: number | string, fetchType: 'only-video-with-rights', userId?: number): Promise +function loadVideo (id: number | string, fetchType: 'id' | 'none', userId?: number): Promise +function loadVideo ( id: number | string, - fetchType: VideoFetchType, + fetchType: VideoLoadType, userId?: number ): Promise -function fetchVideo ( +function loadVideo ( id: number | string, - fetchType: VideoFetchType, + fetchType: VideoLoadType, userId?: number ): Promise { if (fetchType === 'all') return VideoModel.loadAndPopulateAccountAndServerAndTags(id, undefined, userId) @@ -36,18 +36,18 @@ function fetchVideo ( if (fetchType === 'id' || fetchType === 'none') return VideoModel.loadOnlyId(id) } -type VideoFetchByUrlType = 'all' | 'only-video' | 'only-immutable-attributes' +type VideoLoadByUrlType = 'all' | 'only-video' | 'only-immutable-attributes' -function fetchVideoByUrl (url: string, fetchType: 'all'): Promise -function fetchVideoByUrl (url: string, fetchType: 'only-immutable-attributes'): Promise -function fetchVideoByUrl (url: string, fetchType: 'only-video'): Promise -function fetchVideoByUrl ( +function loadVideoByUrl (url: string, fetchType: 'all'): Promise +function loadVideoByUrl (url: string, fetchType: 'only-immutable-attributes'): Promise +function loadVideoByUrl (url: string, fetchType: 'only-video'): Promise +function loadVideoByUrl ( url: string, - fetchType: VideoFetchByUrlType + fetchType: VideoLoadByUrlType ): Promise -function fetchVideoByUrl ( +function loadVideoByUrl ( url: string, - fetchType: VideoFetchByUrlType + fetchType: VideoLoadByUrlType ): Promise { if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url) @@ -57,8 +57,9 @@ function fetchVideoByUrl ( } export { - VideoFetchType, - VideoFetchByUrlType, - fetchVideo, - fetchVideoByUrl + VideoLoadType, + VideoLoadByUrlType, + + loadVideo, + loadVideoByUrl } -- cgit v1.2.3