diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/pod/pod-interface.ts | 2 | ||||
-rw-r--r-- | server/models/pod/pod.ts | 6 | ||||
-rw-r--r-- | server/models/user/user-video-rate-interface.ts | 2 | ||||
-rw-r--r-- | server/models/user/user-video-rate.ts | 2 | ||||
-rw-r--r-- | server/models/user/user.ts | 5 | ||||
-rw-r--r-- | server/models/video/video-interface.ts | 2 | ||||
-rw-r--r-- | server/models/video/video.ts | 4 |
7 files changed, 12 insertions, 11 deletions
diff --git a/server/models/pod/pod-interface.ts b/server/models/pod/pod-interface.ts index 8b0b72167..fc763acac 100644 --- a/server/models/pod/pod-interface.ts +++ b/server/models/pod/pod-interface.ts | |||
@@ -42,6 +42,7 @@ export interface PodClass { | |||
42 | } | 42 | } |
43 | 43 | ||
44 | export interface PodAttributes { | 44 | export interface PodAttributes { |
45 | id?: number | ||
45 | host?: string | 46 | host?: string |
46 | publicKey?: string | 47 | publicKey?: string |
47 | score?: number | Sequelize.literal // Sequelize literal for 'score +' + value | 48 | score?: number | Sequelize.literal // Sequelize literal for 'score +' + value |
@@ -49,7 +50,6 @@ export interface PodAttributes { | |||
49 | } | 50 | } |
50 | 51 | ||
51 | export interface PodInstance extends PodClass, PodAttributes, Sequelize.Instance<PodAttributes> { | 52 | export interface PodInstance extends PodClass, PodAttributes, Sequelize.Instance<PodAttributes> { |
52 | id: number | ||
53 | createdAt: Date | 53 | createdAt: Date |
54 | updatedAt: Date | 54 | updatedAt: Date |
55 | 55 | ||
diff --git a/server/models/pod/pod.ts b/server/models/pod/pod.ts index 56918e358..df6412721 100644 --- a/server/models/pod/pod.ts +++ b/server/models/pod/pod.ts | |||
@@ -143,7 +143,7 @@ list = function () { | |||
143 | } | 143 | } |
144 | 144 | ||
145 | listAllIds = function (transaction: Sequelize.Transaction) { | 145 | listAllIds = function (transaction: Sequelize.Transaction) { |
146 | const query: Sequelize.FindOptions = { | 146 | const query = { |
147 | attributes: [ 'id' ], | 147 | attributes: [ 'id' ], |
148 | transaction | 148 | transaction |
149 | } | 149 | } |
@@ -170,9 +170,7 @@ listRandomPodIdsWithRequest = function (limit: number, tableWithPods: string, ta | |||
170 | limit: limit, | 170 | limit: limit, |
171 | where: { | 171 | where: { |
172 | id: { | 172 | id: { |
173 | $in: [ | 173 | $in: Sequelize.literal(`(SELECT DISTINCT "${tableWithPods}"."podId" FROM "${tableWithPods}" ${tableWithPodsJoins})`) |
174 | Sequelize.literal(`SELECT DISTINCT "${tableWithPods}"."podId" FROM "${tableWithPods}" ${tableWithPodsJoins}`) | ||
175 | ] | ||
176 | } | 174 | } |
177 | } | 175 | } |
178 | } | 176 | } |
diff --git a/server/models/user/user-video-rate-interface.ts b/server/models/user/user-video-rate-interface.ts index 4e6efc01a..ea0fdc4d9 100644 --- a/server/models/user/user-video-rate-interface.ts +++ b/server/models/user/user-video-rate-interface.ts | |||
@@ -13,6 +13,8 @@ export interface UserVideoRateClass { | |||
13 | 13 | ||
14 | export interface UserVideoRateAttributes { | 14 | export interface UserVideoRateAttributes { |
15 | type: VideoRateType | 15 | type: VideoRateType |
16 | userId: number | ||
17 | videoId: number | ||
16 | } | 18 | } |
17 | 19 | ||
18 | export interface UserVideoRateInstance extends UserVideoRateClass, UserVideoRateAttributes, Sequelize.Instance<UserVideoRateAttributes> { | 20 | export interface UserVideoRateInstance extends UserVideoRateClass, UserVideoRateAttributes, Sequelize.Instance<UserVideoRateAttributes> { |
diff --git a/server/models/user/user-video-rate.ts b/server/models/user/user-video-rate.ts index c14598650..7d6dd7281 100644 --- a/server/models/user/user-video-rate.ts +++ b/server/models/user/user-video-rate.ts | |||
@@ -66,7 +66,7 @@ function associate (models) { | |||
66 | } | 66 | } |
67 | 67 | ||
68 | load = function (userId: number, videoId: number, transaction: Sequelize.Transaction) { | 68 | load = function (userId: number, videoId: number, transaction: Sequelize.Transaction) { |
69 | const options: Sequelize.FindOptions = { | 69 | const options: Sequelize.FindOptions<UserVideoRateAttributes> = { |
70 | where: { | 70 | where: { |
71 | userId, | 71 | userId, |
72 | videoId | 72 | videoId |
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index e1b933988..d481fa13c 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -198,7 +198,7 @@ loadById = function (id: number) { | |||
198 | loadByUsername = function (username: string) { | 198 | loadByUsername = function (username: string) { |
199 | const query = { | 199 | const query = { |
200 | where: { | 200 | where: { |
201 | username: username | 201 | username |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
@@ -212,5 +212,6 @@ loadByUsernameOrEmail = function (username: string, email: string) { | |||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | return User.findOne(query) | 215 | // FIXME: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18387 |
216 | return (User as any).findOne(query) | ||
216 | } | 217 | } |
diff --git a/server/models/video/video-interface.ts b/server/models/video/video-interface.ts index cc214fd60..fb31c6a8f 100644 --- a/server/models/video/video-interface.ts +++ b/server/models/video/video-interface.ts | |||
@@ -121,6 +121,7 @@ export interface VideoClass { | |||
121 | } | 121 | } |
122 | 122 | ||
123 | export interface VideoAttributes { | 123 | export interface VideoAttributes { |
124 | id?: number | ||
124 | uuid?: string | 125 | uuid?: string |
125 | name: string | 126 | name: string |
126 | category: number | 127 | category: number |
@@ -140,7 +141,6 @@ export interface VideoAttributes { | |||
140 | } | 141 | } |
141 | 142 | ||
142 | export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> { | 143 | export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> { |
143 | id: number | ||
144 | createdAt: Date | 144 | createdAt: Date |
145 | updatedAt: Date | 145 | updatedAt: Date |
146 | 146 | ||
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index b3ca1e668..7dfea8ac9 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -643,7 +643,7 @@ list = function () { | |||
643 | } | 643 | } |
644 | 644 | ||
645 | listForApi = function (start: number, count: number, sort: string) { | 645 | listForApi = function (start: number, count: number, sort: string) { |
646 | // Exclude Blakclisted videos from the list | 646 | // Exclude blacklisted videos from the list |
647 | const query = { | 647 | const query = { |
648 | distinct: true, | 648 | distinct: true, |
649 | offset: start, | 649 | offset: start, |
@@ -807,7 +807,7 @@ searchAndPopulateAuthorAndPodAndTags = function (value: string, field: string, s | |||
807 | model: Video['sequelize'].models.VideoFile | 807 | model: Video['sequelize'].models.VideoFile |
808 | } | 808 | } |
809 | 809 | ||
810 | const query: Sequelize.FindOptions = { | 810 | const query: Sequelize.FindOptions<VideoAttributes> = { |
811 | distinct: true, | 811 | distinct: true, |
812 | where: createBaseVideosWhere(), | 812 | where: createBaseVideosWhere(), |
813 | offset: start, | 813 | offset: start, |