diff options
author | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:36:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-08-17 15:36:03 +0200 |
commit | 690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3 (patch) | |
tree | b16b8536acd2098aba8c1d6fe13a336dd6aa01a9 /server/models | |
parent | bbd5aa7ead5f1554a0872963f957effc26d8c630 (diff) | |
download | PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.tar.gz PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.tar.zst PeerTube-690bb8f9f3413147a4f71d5ff0a3cd8170a94ce3.zip |
Prefer using Object.values
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/account/account-video-rate.ts | 3 | ||||
-rw-r--r-- | server/models/actor/actor-follow.ts | 4 | ||||
-rw-r--r-- | server/models/actor/actor.ts | 3 | ||||
-rw-r--r-- | server/models/user/user.ts | 3 | ||||
-rw-r--r-- | server/models/video/video-comment.ts | 4 |
5 files changed, 7 insertions, 10 deletions
diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.ts index 5c7d9cfc0..7afc907da 100644 --- a/server/models/account/account-video-rate.ts +++ b/server/models/account/account-video-rate.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { values } from 'lodash' | ||
2 | import { FindOptions, Op, QueryTypes, Transaction } from 'sequelize' | 1 | import { FindOptions, Op, QueryTypes, Transaction } from 'sequelize' |
3 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' | 2 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' |
4 | import { | 3 | import { |
@@ -45,7 +44,7 @@ import { AccountModel } from './account' | |||
45 | export class AccountVideoRateModel extends Model<Partial<AttributesOnly<AccountVideoRateModel>>> { | 44 | export class AccountVideoRateModel extends Model<Partial<AttributesOnly<AccountVideoRateModel>>> { |
46 | 45 | ||
47 | @AllowNull(false) | 46 | @AllowNull(false) |
48 | @Column(DataType.ENUM(...values(VIDEO_RATE_TYPES))) | 47 | @Column(DataType.ENUM(...Object.values(VIDEO_RATE_TYPES))) |
49 | type: VideoRateType | 48 | type: VideoRateType |
50 | 49 | ||
51 | @AllowNull(false) | 50 | @AllowNull(false) |
diff --git a/server/models/actor/actor-follow.ts b/server/models/actor/actor-follow.ts index 127b29ad7..9615229dd 100644 --- a/server/models/actor/actor-follow.ts +++ b/server/models/actor/actor-follow.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { difference, values } from 'lodash' | 1 | import { difference } from 'lodash' |
2 | import { Attributes, FindOptions, Includeable, IncludeOptions, Op, QueryTypes, Transaction, WhereAttributeHash } from 'sequelize' | 2 | import { Attributes, FindOptions, Includeable, IncludeOptions, Op, QueryTypes, Transaction, WhereAttributeHash } from 'sequelize' |
3 | import { | 3 | import { |
4 | AfterCreate, | 4 | AfterCreate, |
@@ -69,7 +69,7 @@ import { InstanceListFollowingQueryBuilder, ListFollowingOptions } from './sql/i | |||
69 | export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowModel>>> { | 69 | export class ActorFollowModel extends Model<Partial<AttributesOnly<ActorFollowModel>>> { |
70 | 70 | ||
71 | @AllowNull(false) | 71 | @AllowNull(false) |
72 | @Column(DataType.ENUM(...values(FOLLOW_STATES))) | 72 | @Column(DataType.ENUM(...Object.values(FOLLOW_STATES))) |
73 | state: FollowState | 73 | state: FollowState |
74 | 74 | ||
75 | @AllowNull(false) | 75 | @AllowNull(false) |
diff --git a/server/models/actor/actor.ts b/server/models/actor/actor.ts index 7be5a140c..88db241dc 100644 --- a/server/models/actor/actor.ts +++ b/server/models/actor/actor.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { values } from 'lodash' | ||
2 | import { literal, Op, QueryTypes, Transaction } from 'sequelize' | 1 | import { literal, Op, QueryTypes, Transaction } from 'sequelize' |
3 | import { | 2 | import { |
4 | AllowNull, | 3 | AllowNull, |
@@ -163,7 +162,7 @@ export const unusedActorAttributesForAPI = [ | |||
163 | export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> { | 162 | export class ActorModel extends Model<Partial<AttributesOnly<ActorModel>>> { |
164 | 163 | ||
165 | @AllowNull(false) | 164 | @AllowNull(false) |
166 | @Column(DataType.ENUM(...values(ACTIVITY_PUB_ACTOR_TYPES))) | 165 | @Column(DataType.ENUM(...Object.values(ACTIVITY_PUB_ACTOR_TYPES))) |
167 | type: ActivityPubActorType | 166 | type: ActivityPubActorType |
168 | 167 | ||
169 | @AllowNull(false) | 168 | @AllowNull(false) |
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index 3fd359359..a2c2497fd 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { values } from 'lodash' | ||
2 | import { col, FindOptions, fn, literal, Op, QueryTypes, where, WhereOptions } from 'sequelize' | 1 | import { col, FindOptions, fn, literal, Op, QueryTypes, where, WhereOptions } from 'sequelize' |
3 | import { | 2 | import { |
4 | AfterDestroy, | 3 | AfterDestroy, |
@@ -283,7 +282,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> { | |||
283 | 282 | ||
284 | @AllowNull(false) | 283 | @AllowNull(false) |
285 | @Is('UserNSFWPolicy', value => throwIfNotValid(value, isUserNSFWPolicyValid, 'NSFW policy')) | 284 | @Is('UserNSFWPolicy', value => throwIfNotValid(value, isUserNSFWPolicyValid, 'NSFW policy')) |
286 | @Column(DataType.ENUM(...values(NSFW_POLICY_TYPES))) | 285 | @Column(DataType.ENUM(...Object.values(NSFW_POLICY_TYPES))) |
287 | nsfwPolicy: NSFWPolicyType | 286 | nsfwPolicy: NSFWPolicyType |
288 | 287 | ||
289 | @AllowNull(false) | 288 | @AllowNull(false) |
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 1195e47e9..af9614d30 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { uniq } from 'lodash' | ||
2 | import { FindOptions, Op, Order, QueryTypes, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize' | 1 | import { FindOptions, Op, Order, QueryTypes, ScopeOptions, Sequelize, Transaction, WhereOptions } from 'sequelize' |
3 | import { | 2 | import { |
4 | AllowNull, | 3 | AllowNull, |
@@ -17,6 +16,7 @@ import { | |||
17 | import { exists } from '@server/helpers/custom-validators/misc' | 16 | import { exists } from '@server/helpers/custom-validators/misc' |
18 | import { getServerActor } from '@server/models/application/application' | 17 | import { getServerActor } from '@server/models/application/application' |
19 | import { MAccount, MAccountId, MUserAccountId } from '@server/types/models' | 18 | import { MAccount, MAccountId, MUserAccountId } from '@server/types/models' |
19 | import { uniqify } from '@shared/core-utils' | ||
20 | import { VideoPrivacy } from '@shared/models' | 20 | import { VideoPrivacy } from '@shared/models' |
21 | import { AttributesOnly } from '@shared/typescript-utils' | 21 | import { AttributesOnly } from '@shared/typescript-utils' |
22 | import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects' | 22 | import { ActivityTagObject, ActivityTombstoneObject } from '../../../shared/models/activitypub/objects/common-objects' |
@@ -802,7 +802,7 @@ export class VideoCommentModel extends Model<Partial<AttributesOnly<VideoComment | |||
802 | ) | 802 | ) |
803 | } | 803 | } |
804 | 804 | ||
805 | return uniq(result) | 805 | return uniqify(result) |
806 | } | 806 | } |
807 | 807 | ||
808 | toFormattedJSON (this: MCommentFormattable) { | 808 | toFormattedJSON (this: MCommentFormattable) { |