aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/account-follow.ts14
-rw-r--r--server/models/account/account-interface.ts2
-rw-r--r--server/models/account/account.ts3
-rw-r--r--server/models/video/video-channel.ts16
-rw-r--r--server/models/video/video.ts7
5 files changed, 23 insertions, 19 deletions
diff --git a/server/models/account/account-follow.ts b/server/models/account/account-follow.ts
index cc9b7c42b..f00c7dcd9 100644
--- a/server/models/account/account-follow.ts
+++ b/server/models/account/account-follow.ts
@@ -78,7 +78,19 @@ loadByAccountAndTarget = function (accountId: number, targetAccountId: number) {
78 where: { 78 where: {
79 accountId, 79 accountId,
80 targetAccountId 80 targetAccountId
81 } 81 },
82 include: [
83 {
84 model: AccountFollow[ 'sequelize' ].models.Account,
85 required: true,
86 as: 'AccountFollower'
87 },
88 {
89 model: AccountFollow['sequelize'].models.Account,
90 required: true,
91 as: 'AccountFollowing'
92 }
93 ]
82 } 94 }
83 95
84 return AccountFollow.findOne(query) 96 return AccountFollow.findOne(query)
diff --git a/server/models/account/account-interface.ts b/server/models/account/account-interface.ts
index 1a567fb7a..e30260f76 100644
--- a/server/models/account/account-interface.ts
+++ b/server/models/account/account-interface.ts
@@ -37,7 +37,7 @@ export interface AccountClass {
37 37
38export interface AccountAttributes { 38export interface AccountAttributes {
39 name: string 39 name: string
40 url: string 40 url?: string
41 publicKey: string 41 publicKey: string
42 privateKey: string 42 privateKey: string
43 followersCount: number 43 followersCount: number
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index faf5fa841..9a2921501 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2
3import { 2import {
4 activityPubContextify, 3 activityPubContextify,
5 isAccountFollowersCountValid, 4 isAccountFollowersCountValid,
@@ -15,7 +14,7 @@ import {
15 isUserUsernameValid 14 isUserUsernameValid
16} from '../../helpers' 15} from '../../helpers'
17import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers/constants' 16import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers/constants'
18import { sendDeleteAccount } from '../../lib/activitypub/send-request' 17import { sendDeleteAccount } from '../../lib/activitypub/send/send-delete'
19 18
20import { addMethodsToModel } from '../utils' 19import { addMethodsToModel } from '../utils'
21import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface' 20import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface'
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index f8414d4a8..93566a5c6 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -1,17 +1,11 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2import { isVideoChannelDescriptionValid, isVideoChannelNameValid } from '../../helpers'
3import { isVideoChannelNameValid, isVideoChannelDescriptionValid } from '../../helpers'
4
5import { addMethodsToModel, getSort } from '../utils'
6import {
7 VideoChannelInstance,
8 VideoChannelAttributes,
9
10 VideoChannelMethods
11} from './video-channel-interface'
12import { sendDeleteVideoChannel } from '../../lib/activitypub/send-request'
13import { isVideoChannelUrlValid } from '../../helpers/custom-validators/video-channels' 3import { isVideoChannelUrlValid } from '../../helpers/custom-validators/video-channels'
14import { CONSTRAINTS_FIELDS } from '../../initializers/constants' 4import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
5import { sendDeleteVideoChannel } from '../../lib/activitypub/send/send-delete'
6
7import { addMethodsToModel, getSort } from '../utils'
8import { VideoChannelAttributes, VideoChannelInstance, VideoChannelMethods } from './video-channel-interface'
15 9
16let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> 10let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes>
17let toFormattedJSON: VideoChannelMethods.ToFormattedJSON 11let toFormattedJSON: VideoChannelMethods.ToFormattedJSON
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index dc10aca1a..e2069eb0c 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -9,7 +9,6 @@ import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/v
9import { 9import {
10 createTorrentPromise, 10 createTorrentPromise,
11 generateImageFromVideoFile, 11 generateImageFromVideoFile,
12 getActivityPubUrl,
13 getVideoFileHeight, 12 getVideoFileHeight,
14 isVideoCategoryValid, 13 isVideoCategoryValid,
15 isVideoDescriptionValid, 14 isVideoDescriptionValid,
@@ -40,13 +39,13 @@ import {
40 VIDEO_LICENCES, 39 VIDEO_LICENCES,
41 VIDEO_PRIVACIES 40 VIDEO_PRIVACIES
42} from '../../initializers' 41} from '../../initializers'
43import { sendDeleteVideo } from '../../lib/activitypub/send-request'
44 42
45import { addMethodsToModel, getSort } from '../utils' 43import { addMethodsToModel, getSort } from '../utils'
46 44
47import { TagInstance } from './tag-interface' 45import { TagInstance } from './tag-interface'
48import { VideoFileInstance, VideoFileModel } from './video-file-interface' 46import { VideoFileInstance, VideoFileModel } from './video-file-interface'
49import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface' 47import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface'
48import { sendDeleteVideo } from '../../lib/index'
50 49
51const Buffer = safeBuffer.Buffer 50const Buffer = safeBuffer.Buffer
52 51
@@ -584,7 +583,7 @@ toActivityPubObject = function (this: VideoInstance) {
584 583
585 const videoObject: VideoTorrentObject = { 584 const videoObject: VideoTorrentObject = {
586 type: 'Video' as 'Video', 585 type: 'Video' as 'Video',
587 id: getActivityPubUrl('video', this.uuid), 586 id: this.url,
588 name: this.name, 587 name: this.name,
589 // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration 588 // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration
590 duration: 'PT' + this.duration + 'S', 589 duration: 'PT' + this.duration + 'S',
@@ -615,7 +614,7 @@ toActivityPubObject = function (this: VideoInstance) {
615 width: THUMBNAILS_SIZE.width, 614 width: THUMBNAILS_SIZE.width,
616 height: THUMBNAILS_SIZE.height 615 height: THUMBNAILS_SIZE.height
617 }, 616 },
618 url 617 url // FIXME: needed?
619 } 618 }
620 619
621 return videoObject 620 return videoObject