aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-01 10:15:28 +0200
committerChocobozzz <me@florianbigard.com>2019-08-01 10:15:28 +0200
commit970ceac0a6bf4990b8924738591df4949491ec9b (patch)
tree444070d8409fced91971c4401e65640d6fd13cbf /server/models/account
parentbfbd912886eba17b4aa9a40dcef2fddc685d85bf (diff)
downloadPeerTube-970ceac0a6bf4990b8924738591df4949491ec9b.tar.gz
PeerTube-970ceac0a6bf4990b8924738591df4949491ec9b.tar.zst
PeerTube-970ceac0a6bf4990b8924738591df4949491ec9b.zip
Fix multiple server tests
Diffstat (limited to 'server/models/account')
-rw-r--r--server/models/account/account-video-rate.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.ts
index 85af9e378..d5c214ecb 100644
--- a/server/models/account/account-video-rate.ts
+++ b/server/models/account/account-video-rate.ts
@@ -89,6 +89,25 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
89 return AccountVideoRateModel.findOne(options) 89 return AccountVideoRateModel.findOne(options)
90 } 90 }
91 91
92 static loadByAccountAndVideoOrUrl (accountId: number, videoId: number, url: string, transaction?: Transaction) {
93 const options: FindOptions = {
94 where: {
95 [ Op.or]: [
96 {
97 accountId,
98 videoId
99 },
100 {
101 url
102 }
103 ]
104 }
105 }
106 if (transaction) options.transaction = transaction
107
108 return AccountVideoRateModel.findOne(options)
109 }
110
92 static listByAccountForApi (options: { 111 static listByAccountForApi (options: {
93 start: number, 112 start: number,
94 count: number, 113 count: number,
@@ -202,6 +221,23 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
202 videoId, 221 videoId,
203 type 222 type
204 }, 223 },
224 include: [
225 {
226 model: AccountModel.unscoped(),
227 required: true,
228 include: [
229 {
230 model: ActorModel.unscoped(),
231 required: true,
232 where: {
233 serverId: {
234 [Op.ne]: null
235 }
236 }
237 }
238 ]
239 }
240 ],
205 transaction: t 241 transaction: t
206 } 242 }
207 243