diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/user/user.ts | 6 | ||||
-rw-r--r-- | server/models/utils.ts | 5 | ||||
-rw-r--r-- | server/models/video/video-file.ts | 5 |
3 files changed, 7 insertions, 9 deletions
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index e7bf22806..ad8ce08cb 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -48,14 +48,14 @@ import { | |||
48 | isUserEmailVerifiedValid, | 48 | isUserEmailVerifiedValid, |
49 | isUserNoModal, | 49 | isUserNoModal, |
50 | isUserNSFWPolicyValid, | 50 | isUserNSFWPolicyValid, |
51 | isUserP2PEnabledValid, | ||
51 | isUserPasswordValid, | 52 | isUserPasswordValid, |
52 | isUserRoleValid, | 53 | isUserRoleValid, |
53 | isUserUsernameValid, | 54 | isUserUsernameValid, |
54 | isUserVideoLanguages, | 55 | isUserVideoLanguages, |
55 | isUserVideoQuotaDailyValid, | 56 | isUserVideoQuotaDailyValid, |
56 | isUserVideoQuotaValid, | 57 | isUserVideoQuotaValid, |
57 | isUserVideosHistoryEnabledValid, | 58 | isUserVideosHistoryEnabledValid |
58 | isUserP2PEnabledValid | ||
59 | } from '../../helpers/custom-validators/users' | 59 | } from '../../helpers/custom-validators/users' |
60 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' | 60 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' |
61 | import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' | 61 | import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' |
@@ -623,7 +623,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> { | |||
623 | const query = { | 623 | const query = { |
624 | where: { | 624 | where: { |
625 | [Op.or]: [ | 625 | [Op.or]: [ |
626 | where(fn('lower', col('username')), '=', fn('lower', username)), | 626 | where(fn('lower', col('username')), fn('lower', username) as any), |
627 | 627 | ||
628 | { email } | 628 | { email } |
629 | ] | 629 | ] |
diff --git a/server/models/utils.ts b/server/models/utils.ts index 0950f5f32..66b653e3d 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { literal, Op, OrderItem, Sequelize } from 'sequelize' | 1 | import { literal, Op, OrderItem, Sequelize } from 'sequelize' |
2 | import { Col } from 'sequelize/types/utils' | ||
3 | import validator from 'validator' | 2 | import validator from 'validator' |
4 | 3 | ||
5 | type SortType = { sortModel: string, sortValue: string } | 4 | type SortType = { sortModel: string, sortValue: string } |
@@ -8,7 +7,7 @@ type SortType = { sortModel: string, sortValue: string } | |||
8 | function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { | 7 | function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { |
9 | const { direction, field } = buildDirectionAndField(value) | 8 | const { direction, field } = buildDirectionAndField(value) |
10 | 9 | ||
11 | let finalField: string | Col | 10 | let finalField: string | ReturnType<typeof Sequelize.col> |
12 | 11 | ||
13 | if (field.toLowerCase() === 'match') { // Search | 12 | if (field.toLowerCase() === 'match') { // Search |
14 | finalField = Sequelize.col('similarity') | 13 | finalField = Sequelize.col('similarity') |
@@ -65,7 +64,7 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or | |||
65 | ] | 64 | ] |
66 | } | 65 | } |
67 | 66 | ||
68 | let finalField: string | Col | 67 | let finalField: string | ReturnType<typeof Sequelize.col> |
69 | 68 | ||
70 | // Alias | 69 | // Alias |
71 | if (field.toLowerCase() === 'match') { // Search | 70 | if (field.toLowerCase() === 'match') { // Search |
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 1a9f4561a..fae76c6f2 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { remove } from 'fs-extra' | 1 | import { remove } from 'fs-extra' |
2 | import memoizee from 'memoizee' | 2 | import memoizee from 'memoizee' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { FindOptions, Op, Transaction } from 'sequelize' | 4 | import { FindOptions, Op, Transaction, WhereOptions } from 'sequelize' |
5 | import { | 5 | import { |
6 | AllowNull, | 6 | AllowNull, |
7 | BelongsTo, | 7 | BelongsTo, |
@@ -18,7 +18,6 @@ import { | |||
18 | Table, | 18 | Table, |
19 | UpdatedAt | 19 | UpdatedAt |
20 | } from 'sequelize-typescript' | 20 | } from 'sequelize-typescript' |
21 | import { Where } from 'sequelize/types/utils' | ||
22 | import validator from 'validator' | 21 | import validator from 'validator' |
23 | import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub' | 22 | import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub' |
24 | import { logger } from '@server/helpers/logger' | 23 | import { logger } from '@server/helpers/logger' |
@@ -70,7 +69,7 @@ export enum ScopeNames { | |||
70 | } | 69 | } |
71 | ] | 70 | ] |
72 | }, | 71 | }, |
73 | [ScopeNames.WITH_VIDEO_OR_PLAYLIST]: (options: { whereVideo?: Where } = {}) => { | 72 | [ScopeNames.WITH_VIDEO_OR_PLAYLIST]: (options: { whereVideo?: WhereOptions } = {}) => { |
74 | return { | 73 | return { |
75 | include: [ | 74 | include: [ |
76 | { | 75 | { |