From c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 10:42:24 +0200 Subject: Refactor requests --- server/middlewares/validators/shared/abuses.ts | 2 +- server/middlewares/validators/shared/accounts.ts | 2 +- server/middlewares/validators/shared/video-blacklists.ts | 2 +- server/middlewares/validators/shared/video-captions.ts | 2 +- server/middlewares/validators/shared/video-channels.ts | 2 +- server/middlewares/validators/shared/video-comments.ts | 2 +- server/middlewares/validators/shared/video-imports.ts | 2 +- server/middlewares/validators/shared/video-ownerships.ts | 2 +- server/middlewares/validators/shared/video-playlists.ts | 2 +- server/middlewares/validators/shared/videos.ts | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) (limited to 'server/middlewares/validators/shared') diff --git a/server/middlewares/validators/shared/abuses.ts b/server/middlewares/validators/shared/abuses.ts index 4a20a55fa..2b8d86ba5 100644 --- a/server/middlewares/validators/shared/abuses.ts +++ b/server/middlewares/validators/shared/abuses.ts @@ -1,6 +1,6 @@ import { Response } from 'express' import { AbuseModel } from '@server/models/abuse/abuse' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' async function doesAbuseExist (abuseId: number | string, res: Response) { const abuse = await AbuseModel.loadByIdWithReporter(parseInt(abuseId + '', 10)) diff --git a/server/middlewares/validators/shared/accounts.ts b/server/middlewares/validators/shared/accounts.ts index 04da15441..fe4f83aa0 100644 --- a/server/middlewares/validators/shared/accounts.ts +++ b/server/middlewares/validators/shared/accounts.ts @@ -2,7 +2,7 @@ import { Response } from 'express' import { AccountModel } from '@server/models/account/account' import { UserModel } from '@server/models/user/user' import { MAccountDefault } from '@server/types/models' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' function doesAccountIdExist (id: number | string, res: Response, sendNotFound = true) { const promise = AccountModel.load(parseInt(id + '', 10)) diff --git a/server/middlewares/validators/shared/video-blacklists.ts b/server/middlewares/validators/shared/video-blacklists.ts index 01491c10f..f85b39b23 100644 --- a/server/middlewares/validators/shared/video-blacklists.ts +++ b/server/middlewares/validators/shared/video-blacklists.ts @@ -1,6 +1,6 @@ import { Response } from 'express' import { VideoBlacklistModel } from '@server/models/video/video-blacklist' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' async function doesVideoBlacklistExist (videoId: number, res: Response) { const videoBlacklist = await VideoBlacklistModel.loadByVideoId(videoId) diff --git a/server/middlewares/validators/shared/video-captions.ts b/server/middlewares/validators/shared/video-captions.ts index 80f6c5a52..831b366ea 100644 --- a/server/middlewares/validators/shared/video-captions.ts +++ b/server/middlewares/validators/shared/video-captions.ts @@ -1,7 +1,7 @@ import { Response } from 'express' import { VideoCaptionModel } from '@server/models/video/video-caption' import { MVideoId } from '@server/types/models' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' async function doesVideoCaptionExist (video: MVideoId, language: string, res: Response) { const videoCaption = await VideoCaptionModel.loadByVideoIdAndLanguage(video.id, language) diff --git a/server/middlewares/validators/shared/video-channels.ts b/server/middlewares/validators/shared/video-channels.ts index fe2e663b7..3fc3d012a 100644 --- a/server/middlewares/validators/shared/video-channels.ts +++ b/server/middlewares/validators/shared/video-channels.ts @@ -1,7 +1,7 @@ import * as express from 'express' import { VideoChannelModel } from '@server/models/video/video-channel' import { MChannelBannerAccountDefault } from '@server/types/models' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' async function doesLocalVideoChannelNameExist (name: string, res: express.Response) { const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name) diff --git a/server/middlewares/validators/shared/video-comments.ts b/server/middlewares/validators/shared/video-comments.ts index 83ea15c98..60132fb6e 100644 --- a/server/middlewares/validators/shared/video-comments.ts +++ b/server/middlewares/validators/shared/video-comments.ts @@ -1,7 +1,7 @@ import * as express from 'express' import { VideoCommentModel } from '@server/models/video/video-comment' import { MVideoId } from '@server/types/models' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' async function doesVideoCommentThreadExist (idArg: number | string, video: MVideoId, res: express.Response) { const id = parseInt(idArg + '', 10) diff --git a/server/middlewares/validators/shared/video-imports.ts b/server/middlewares/validators/shared/video-imports.ts index 0f984bc17..50b49ffcb 100644 --- a/server/middlewares/validators/shared/video-imports.ts +++ b/server/middlewares/validators/shared/video-imports.ts @@ -1,6 +1,6 @@ import * as express from 'express' import { VideoImportModel } from '@server/models/video/video-import' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' async function doesVideoImportExist (id: number, res: express.Response) { const videoImport = await VideoImportModel.loadAndPopulateVideo(id) diff --git a/server/middlewares/validators/shared/video-ownerships.ts b/server/middlewares/validators/shared/video-ownerships.ts index fc27006ce..93a23ef40 100644 --- a/server/middlewares/validators/shared/video-ownerships.ts +++ b/server/middlewares/validators/shared/video-ownerships.ts @@ -1,6 +1,6 @@ import * as express from 'express' import { VideoChangeOwnershipModel } from '@server/models/video/video-change-ownership' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' async function doesChangeVideoOwnershipExist (idArg: number | string, res: express.Response) { const id = parseInt(idArg + '', 10) diff --git a/server/middlewares/validators/shared/video-playlists.ts b/server/middlewares/validators/shared/video-playlists.ts index d762859a8..3f6768179 100644 --- a/server/middlewares/validators/shared/video-playlists.ts +++ b/server/middlewares/validators/shared/video-playlists.ts @@ -1,7 +1,7 @@ import * as express from 'express' import { VideoPlaylistModel } from '@server/models/video/video-playlist' import { MVideoPlaylist } from '@server/types/models' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' export type VideoPlaylistFetchType = 'summary' | 'all' async function doesVideoPlaylistExist (id: number | string, res: express.Response, fetchType: VideoPlaylistFetchType = 'summary') { diff --git a/server/middlewares/validators/shared/videos.ts b/server/middlewares/validators/shared/videos.ts index 2c66c1a3a..7f42a4893 100644 --- a/server/middlewares/validators/shared/videos.ts +++ b/server/middlewares/validators/shared/videos.ts @@ -12,7 +12,7 @@ import { MVideoImmutable, MVideoThumbnail } from '@server/types/models' -import { HttpStatusCode } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' import { UserRight } from '@shared/models' async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') { -- cgit v1.2.3