aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-20 10:22:05 +0200
committerChocobozzz <me@florianbigard.com>2019-08-20 10:22:05 +0200
commit96ca24f00e5ae5471dee9ee596489fe50af2b46f (patch)
tree64b7091518d802cc6e812bbe0787e11eeed2fcd5 /server/models/video
parent453e83ea5d81d203ba34bc43cd5c2c750ba40568 (diff)
downloadPeerTube-96ca24f00e5ae5471dee9ee596489fe50af2b46f.tar.gz
PeerTube-96ca24f00e5ae5471dee9ee596489fe50af2b46f.tar.zst
PeerTube-96ca24f00e5ae5471dee9ee596489fe50af2b46f.zip
Fix tests
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/tag.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/models/video/tag.ts b/server/models/video/tag.ts
index 0fc3cfd4c..b110f2a43 100644
--- a/server/models/video/tag.ts
+++ b/server/models/video/tag.ts
@@ -6,6 +6,7 @@ import { throwIfNotValid } from '../utils'
6import { VideoModel } from './video' 6import { VideoModel } from './video'
7import { VideoTagModel } from './video-tag' 7import { VideoTagModel } from './video-tag'
8import { VideoPrivacy, VideoState } from '../../../shared/models/videos' 8import { VideoPrivacy, VideoState } from '../../../shared/models/videos'
9import { MTag } from '@server/typings/models'
9 10
10@Table({ 11@Table({
11 tableName: 'tag', 12 tableName: 'tag',
@@ -37,10 +38,10 @@ export class TagModel extends Model<TagModel> {
37 }) 38 })
38 Videos: VideoModel[] 39 Videos: VideoModel[]
39 40
40 static findOrCreateTags (tags: string[], transaction: Transaction) { 41 static findOrCreateTags (tags: string[], transaction: Transaction): Promise<MTag[]> {
41 if (tags === null) return [] 42 if (tags === null) return Promise.resolve([])
42 43
43 const tasks: Bluebird<TagModel>[] = [] 44 const tasks: Bluebird<MTag>[] = []
44 tags.forEach(tag => { 45 tags.forEach(tag => {
45 const query = { 46 const query = {
46 where: { 47 where: {
@@ -52,7 +53,7 @@ export class TagModel extends Model<TagModel> {
52 transaction 53 transaction
53 } 54 }
54 55
55 const promise = TagModel.findOrCreate(query) 56 const promise = TagModel.findOrCreate<MTag>(query)
56 .then(([ tagInstance ]) => tagInstance) 57 .then(([ tagInstance ]) => tagInstance)
57 tasks.push(promise) 58 tasks.push(promise)
58 }) 59 })