diff options
Diffstat (limited to 'server/models/video/video-channel.ts')
-rw-r--r-- | server/models/video/video-channel.ts | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index b7ffbd3b1..8c4357009 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { FindOptions, Includeable, literal, Op, QueryTypes, ScopeOptions } from 'sequelize' | 1 | import { FindOptions, Includeable, literal, Op, QueryTypes, ScopeOptions, Transaction } from 'sequelize' |
2 | import { | 2 | import { |
3 | AllowNull, | 3 | AllowNull, |
4 | BeforeDestroy, | 4 | BeforeDestroy, |
@@ -17,7 +17,9 @@ import { | |||
17 | Table, | 17 | Table, |
18 | UpdatedAt | 18 | UpdatedAt |
19 | } from 'sequelize-typescript' | 19 | } from 'sequelize-typescript' |
20 | import { setAsUpdated } from '@server/helpers/database-utils' | ||
20 | import { MAccountActor } from '@server/types/models' | 21 | import { MAccountActor } from '@server/types/models' |
22 | import { AttributesOnly } from '@shared/core-utils' | ||
21 | import { ActivityPubActor } from '../../../shared/models/activitypub' | 23 | import { ActivityPubActor } from '../../../shared/models/activitypub' |
22 | import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos' | 24 | import { VideoChannel, VideoChannelSummary } from '../../../shared/models/videos' |
23 | import { | 25 | import { |
@@ -35,9 +37,9 @@ import { | |||
35 | MChannelSummaryFormattable | 37 | MChannelSummaryFormattable |
36 | } from '../../types/models/video' | 38 | } from '../../types/models/video' |
37 | import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account' | 39 | import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account' |
38 | import { ActorImageModel } from '../account/actor-image' | 40 | import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor' |
39 | import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor' | 41 | import { ActorFollowModel } from '../actor/actor-follow' |
40 | import { ActorFollowModel } from '../activitypub/actor-follow' | 42 | import { ActorImageModel } from '../actor/actor-image' |
41 | import { ServerModel } from '../server/server' | 43 | import { ServerModel } from '../server/server' |
42 | import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils' | 44 | import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils' |
43 | import { VideoModel } from './video' | 45 | import { VideoModel } from './video' |
@@ -245,7 +247,7 @@ export type SummaryOptions = { | |||
245 | } | 247 | } |
246 | ] | 248 | ] |
247 | }) | 249 | }) |
248 | export class VideoChannelModel extends Model { | 250 | export class VideoChannelModel extends Model<Partial<AttributesOnly<VideoChannelModel>>> { |
249 | 251 | ||
250 | @AllowNull(false) | 252 | @AllowNull(false) |
251 | @Is('VideoChannelName', value => throwIfNotValid(value, isVideoChannelNameValid, 'name')) | 253 | @Is('VideoChannelName', value => throwIfNotValid(value, isVideoChannelNameValid, 'name')) |
@@ -653,7 +655,6 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"` | |||
653 | description: this.description, | 655 | description: this.description, |
654 | support: this.support, | 656 | support: this.support, |
655 | isLocal: this.Actor.isOwned(), | 657 | isLocal: this.Actor.isOwned(), |
656 | createdAt: this.createdAt, | ||
657 | updatedAt: this.updatedAt, | 658 | updatedAt: this.updatedAt, |
658 | ownerAccount: undefined, | 659 | ownerAccount: undefined, |
659 | videosCount, | 660 | videosCount, |
@@ -691,4 +692,8 @@ ON "Account->Actor"."serverId" = "Account->Actor->Server"."id"` | |||
691 | isOutdated () { | 692 | isOutdated () { |
692 | return this.Actor.isOutdated() | 693 | return this.Actor.isOutdated() |
693 | } | 694 | } |
695 | |||
696 | setAsUpdated (transaction: Transaction) { | ||
697 | return setAsUpdated('videoChannel', this.id, transaction) | ||
698 | } | ||
694 | } | 699 | } |