From b49f22d8f9a52ab75fd38db2d377249eb58fa678 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 8 Dec 2020 14:30:29 +0100 Subject: Upgrade sequelize to v6 --- server/helpers/actor.ts | 6 +++--- server/helpers/middlewares/accounts.ts | 7 +++---- server/helpers/video.ts | 25 ++++++++++++------------- 3 files changed, 18 insertions(+), 20 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/actor.ts b/server/helpers/actor.ts index 015b4a39f..a60d3ed5d 100644 --- a/server/helpers/actor.ts +++ b/server/helpers/actor.ts @@ -1,10 +1,10 @@ + import { ActorModel } from '../models/activitypub/actor' -import * as Bluebird from 'bluebird' -import { MActorFull, MActorAccountChannelId } from '../types/models' +import { MActorAccountChannelId, MActorFull } from '../types/models' type ActorFetchByUrlType = 'all' | 'association-ids' -function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType): Bluebird { +function fetchActorByUrl (url: string, fetchType: ActorFetchByUrlType): Promise { if (fetchType === 'all') return ActorModel.loadByUrlAndPopulateAccountAndChannel(url) if (fetchType === 'association-ids') return ActorModel.loadByUrl(url) diff --git a/server/helpers/middlewares/accounts.ts b/server/helpers/middlewares/accounts.ts index 23470cac6..13ae6cdf4 100644 --- a/server/helpers/middlewares/accounts.ts +++ b/server/helpers/middlewares/accounts.ts @@ -1,9 +1,8 @@ import { Response } from 'express' -import { AccountModel } from '../../models/account/account' -import * as Bluebird from 'bluebird' -import { MAccountDefault } from '../../types/models' import { UserModel } from '@server/models/account/user' import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' +import { AccountModel } from '../../models/account/account' +import { MAccountDefault } from '../../types/models' function doesAccountIdExist (id: number | string, res: Response, sendNotFound = true) { const promise = AccountModel.load(parseInt(id + '', 10)) @@ -23,7 +22,7 @@ function doesAccountNameWithHostExist (nameWithDomain: string, res: Response, se return doesAccountExist(promise, res, sendNotFound) } -async function doesAccountExist (p: Bluebird, res: Response, sendNotFound: boolean) { +async function doesAccountExist (p: Promise, res: Response, sendNotFound: boolean) { const account = await p if (!account) { diff --git a/server/helpers/video.ts b/server/helpers/video.ts index 999137c6d..5d1cd7de1 100644 --- a/server/helpers/video.ts +++ b/server/helpers/video.ts @@ -1,4 +1,3 @@ -import * as Bluebird from 'bluebird' import { Response } from 'express' import { CONFIG } from '@server/initializers/config' import { DEFAULT_AUDIO_RESOLUTION } from '@server/initializers/constants' @@ -20,21 +19,21 @@ import { VideoModel } from '../models/video/video' type VideoFetchType = 'all' | 'only-video' | 'only-video-with-rights' | 'id' | 'none' | 'only-immutable-attributes' -function fetchVideo (id: number | string, fetchType: 'all', userId?: number): Bluebird -function fetchVideo (id: number | string, fetchType: 'only-immutable-attributes'): Bluebird -function fetchVideo (id: number | string, fetchType: 'only-video', userId?: number): Bluebird -function fetchVideo (id: number | string, fetchType: 'only-video-with-rights', userId?: number): Bluebird -function fetchVideo (id: number | string, fetchType: 'id' | 'none', userId?: number): Bluebird +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 ( id: number | string, fetchType: VideoFetchType, userId?: number -): Bluebird +): Promise function fetchVideo ( id: number | string, fetchType: VideoFetchType, userId?: number -): Bluebird { +): Promise { if (fetchType === 'all') return VideoModel.loadAndPopulateAccountAndServerAndTags(id, undefined, userId) if (fetchType === 'only-immutable-attributes') return VideoModel.loadImmutableAttributes(id) @@ -48,17 +47,17 @@ function fetchVideo ( type VideoFetchByUrlType = 'all' | 'only-video' | 'only-immutable-attributes' -function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird -function fetchVideoByUrl (url: string, fetchType: 'only-immutable-attributes'): Bluebird -function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird +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 ( url: string, fetchType: VideoFetchByUrlType -): Bluebird +): Promise function fetchVideoByUrl ( url: string, fetchType: VideoFetchByUrlType -): Bluebird { +): Promise { if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url) if (fetchType === 'only-immutable-attributes') return VideoModel.loadByUrlImmutableAttributes(url) -- cgit v1.2.3