aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-08-25 18:36:49 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-08-25 18:36:49 +0200
commit556ddc319242aafef51bae9301423ecf8701a3af (patch)
tree413829b522193584df348f0356a702b3222c3419 /server/models
parentd15ab38a905e6b50972e6f884917db9198279daf (diff)
downloadPeerTube-556ddc319242aafef51bae9301423ecf8701a3af.tar.gz
PeerTube-556ddc319242aafef51bae9301423ecf8701a3af.tar.zst
PeerTube-556ddc319242aafef51bae9301423ecf8701a3af.zip
Upgrade common server dependencies
Diffstat (limited to 'server/models')
-rw-r--r--server/models/pod/pod-interface.ts2
-rw-r--r--server/models/pod/pod.ts6
-rw-r--r--server/models/user/user-video-rate-interface.ts2
-rw-r--r--server/models/user/user-video-rate.ts2
-rw-r--r--server/models/user/user.ts5
-rw-r--r--server/models/video/video-interface.ts2
-rw-r--r--server/models/video/video.ts4
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
44export interface PodAttributes { 44export 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
51export interface PodInstance extends PodClass, PodAttributes, Sequelize.Instance<PodAttributes> { 52export 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
145listAllIds = function (transaction: Sequelize.Transaction) { 145listAllIds = 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
14export interface UserVideoRateAttributes { 14export interface UserVideoRateAttributes {
15 type: VideoRateType 15 type: VideoRateType
16 userId: number
17 videoId: number
16} 18}
17 19
18export interface UserVideoRateInstance extends UserVideoRateClass, UserVideoRateAttributes, Sequelize.Instance<UserVideoRateAttributes> { 20export 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
68load = function (userId: number, videoId: number, transaction: Sequelize.Transaction) { 68load = 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) {
198loadByUsername = function (username: string) { 198loadByUsername = 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
123export interface VideoAttributes { 123export 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
142export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> { 143export 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
645listForApi = function (start: number, count: number, sort: string) { 645listForApi = 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,