aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-17 10:56:27 +0200
committerChocobozzz <me@florianbigard.com>2018-04-17 10:56:27 +0200
commit7b87d2d5141d0eb48db2a3fd162208d6a79b2035 (patch)
tree6c7b40ae79671fa2cf1b8418092acca031006d07
parentcc1561f9f7b33d739d66b23bacae23ea49f2fa12 (diff)
downloadPeerTube-7b87d2d5141d0eb48db2a3fd162208d6a79b2035.tar.gz
PeerTube-7b87d2d5141d0eb48db2a3fd162208d6a79b2035.tar.zst
PeerTube-7b87d2d5141d0eb48db2a3fd162208d6a79b2035.zip
Handle sort in rss
-rw-r--r--client/src/app/shared/video/abstract-video-list.ts8
-rw-r--r--client/src/app/shared/video/sort-field.type.ts2
-rw-r--r--client/src/app/shared/video/video.service.ts39
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.service.ts4
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts4
-rw-r--r--client/src/app/videos/video-list/video-local.component.ts13
-rw-r--r--client/src/app/videos/video-list/video-recently-added.component.ts8
-rw-r--r--client/src/app/videos/video-list/video-trending.component.ts6
-rw-r--r--server/controllers/api/users.ts2
-rw-r--r--server/controllers/feeds.ts31
-rw-r--r--server/models/video/video.ts4
11 files changed, 58 insertions, 63 deletions
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts
index c1c07e628..7f2cf2d7e 100644
--- a/client/src/app/shared/video/abstract-video-list.ts
+++ b/client/src/app/shared/video/abstract-video-list.ts
@@ -9,7 +9,7 @@ import { fromEvent } from 'rxjs/observable/fromEvent'
9import { Subscription } from 'rxjs/Subscription' 9import { Subscription } from 'rxjs/Subscription'
10import { AuthService } from '../../core/auth' 10import { AuthService } from '../../core/auth'
11import { ComponentPagination } from '../rest/component-pagination.model' 11import { ComponentPagination } from '../rest/component-pagination.model'
12import { SortField } from './sort-field.type' 12import { VideoSortField } from './sort-field.type'
13import { Video } from './video.model' 13import { Video } from './video.model'
14 14
15export abstract class AbstractVideoList implements OnInit, OnDestroy { 15export abstract class AbstractVideoList implements OnInit, OnDestroy {
@@ -23,8 +23,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
23 itemsPerPage: 10, 23 itemsPerPage: 10,
24 totalItems: null 24 totalItems: null
25 } 25 }
26 sort: SortField = '-createdAt' 26 sort: VideoSortField = '-createdAt'
27 defaultSort: SortField = '-createdAt' 27 defaultSort: VideoSortField = '-createdAt'
28 syndicationItems = [] 28 syndicationItems = []
29 29
30 loadOnInit = true 30 loadOnInit = true
@@ -154,7 +154,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy {
154 } 154 }
155 155
156 protected loadRouteParams (routeParams: { [ key: string ]: any }) { 156 protected loadRouteParams (routeParams: { [ key: string ]: any }) {
157 this.sort = routeParams['sort'] as SortField || this.defaultSort 157 this.sort = routeParams['sort'] as VideoSortField || this.defaultSort
158 158
159 if (routeParams['page'] !== undefined) { 159 if (routeParams['page'] !== undefined) {
160 this.pagination.currentPage = parseInt(routeParams['page'], 10) 160 this.pagination.currentPage = parseInt(routeParams['page'], 10)
diff --git a/client/src/app/shared/video/sort-field.type.ts b/client/src/app/shared/video/sort-field.type.ts
index 776f360f8..2a3ae4ddd 100644
--- a/client/src/app/shared/video/sort-field.type.ts
+++ b/client/src/app/shared/video/sort-field.type.ts
@@ -1,4 +1,4 @@
1export type SortField = 'name' | '-name' 1export type VideoSortField = 'name' | '-name'
2 | 'duration' | '-duration' 2 | 'duration' | '-duration'
3 | 'createdAt' | '-createdAt' 3 | 'createdAt' | '-createdAt'
4 | 'views' | '-views' 4 | 'views' | '-views'
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 4c19c3765..ef8babd55 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -16,7 +16,7 @@ import { ComponentPagination } from '../rest/component-pagination.model'
16import { RestExtractor } from '../rest/rest-extractor.service' 16import { RestExtractor } from '../rest/rest-extractor.service'
17import { RestService } from '../rest/rest.service' 17import { RestService } from '../rest/rest.service'
18import { UserService } from '../users/user.service' 18import { UserService } from '../users/user.service'
19import { SortField } from './sort-field.type' 19import { VideoSortField } from './sort-field.type'
20import { VideoDetails } from './video-details.model' 20import { VideoDetails } from './video-details.model'
21import { VideoEdit } from './video-edit.model' 21import { VideoEdit } from './video-edit.model'
22import { Video } from './video.model' 22import { Video } from './video.model'
@@ -86,7 +86,7 @@ export class VideoService {
86 .catch(this.restExtractor.handleError) 86 .catch(this.restExtractor.handleError)
87 } 87 }
88 88
89 getMyVideos (videoPagination: ComponentPagination, sort: SortField): Observable<{ videos: Video[], totalVideos: number}> { 89 getMyVideos (videoPagination: ComponentPagination, sort: VideoSortField): Observable<{ videos: Video[], totalVideos: number}> {
90 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 90 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
91 91
92 let params = new HttpParams() 92 let params = new HttpParams()
@@ -99,7 +99,7 @@ export class VideoService {
99 99
100 getVideos ( 100 getVideos (
101 videoPagination: ComponentPagination, 101 videoPagination: ComponentPagination,
102 sort: SortField, 102 sort: VideoSortField,
103 filter?: VideoFilter 103 filter?: VideoFilter
104 ): Observable<{ videos: Video[], totalVideos: number}> { 104 ): Observable<{ videos: Video[], totalVideos: number}> {
105 const pagination = this.restService.componentPaginationToRestPagination(videoPagination) 105 const pagination = this.restService.componentPaginationToRestPagination(videoPagination)
@@ -117,7 +117,7 @@ export class VideoService {
117 .catch((res) => this.restExtractor.handleError(res)) 117 .catch((res) => this.restExtractor.handleError(res))
118 } 118 }
119 119
120 buildBaseFeedUrls () { 120 buildBaseFeedUrls (params: HttpParams) {
121 const feeds = [ 121 const feeds = [
122 { 122 {
123 label: 'rss 2.0', 123 label: 'rss 2.0',
@@ -133,43 +133,34 @@ export class VideoService {
133 } 133 }
134 ] 134 ]
135 135
136 if (params && params.keys().length !== 0) {
137 for (const feed of feeds) {
138 feed.url += '?' + params.toString()
139 }
140 }
141
136 return feeds 142 return feeds
137 } 143 }
138 144
139 getVideoFeedUrls (filter?: VideoFilter) { 145 getVideoFeedUrls (sort: VideoSortField, filter?: VideoFilter) {
140 let params = this.restService.addRestGetParams(new HttpParams()) 146 let params = this.restService.addRestGetParams(new HttpParams(), undefined, sort)
141 const feeds = this.buildBaseFeedUrls()
142 147
143 if (filter) params = params.set('filter', filter) 148 if (filter) params = params.set('filter', filter)
144 149
145 if (params.keys().length !== 0) { 150 return this.buildBaseFeedUrls(params)
146 for (let item of feeds) {
147 item.url += `?${params.toString()}`
148 }
149 }
150
151 return feeds
152 } 151 }
153 152
154 getAccountFeedUrls (accountId: number) { 153 getAccountFeedUrls (accountId: number) {
155 let params = this.restService.addRestGetParams(new HttpParams()) 154 let params = this.restService.addRestGetParams(new HttpParams())
156 const feeds = this.buildBaseFeedUrls()
157
158 params = params.set('accountId', accountId.toString()) 155 params = params.set('accountId', accountId.toString())
159 156
160 if (params.keys().length !== 0) { 157 return this.buildBaseFeedUrls(params)
161 for (let item of feeds) {
162 item.url += `?${params.toString()}`
163 }
164 }
165
166 return feeds
167 } 158 }
168 159
169 searchVideos ( 160 searchVideos (
170 search: string, 161 search: string,
171 videoPagination: ComponentPagination, 162 videoPagination: ComponentPagination,
172 sort: SortField 163 sort: VideoSortField
173 ): Observable<{ videos: Video[], totalVideos: number}> { 164 ): Observable<{ videos: Video[], totalVideos: number}> {
174 const url = VideoService.BASE_VIDEO_URL + 'search' 165 const url = VideoService.BASE_VIDEO_URL + 'search'
175 166
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts
index 470af1230..0bf7696fe 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts
@@ -14,7 +14,7 @@ import {
14import { environment } from '../../../../environments/environment' 14import { environment } from '../../../../environments/environment'
15import { RestExtractor, RestService } from '../../../shared/rest' 15import { RestExtractor, RestService } from '../../../shared/rest'
16import { ComponentPagination } from '../../../shared/rest/component-pagination.model' 16import { ComponentPagination } from '../../../shared/rest/component-pagination.model'
17import { SortField } from '../../../shared/video/sort-field.type' 17import { VideoSortField } from '../../../shared/video/sort-field.type'
18import { VideoComment } from './video-comment.model' 18import { VideoComment } from './video-comment.model'
19 19
20@Injectable() 20@Injectable()
@@ -48,7 +48,7 @@ export class VideoCommentService {
48 getVideoCommentThreads ( 48 getVideoCommentThreads (
49 videoId: number | string, 49 videoId: number | string,
50 componentPagination: ComponentPagination, 50 componentPagination: ComponentPagination,
51 sort: SortField 51 sort: VideoSortField
52 ): Observable<{ comments: VideoComment[], totalComments: number}> { 52 ): Observable<{ comments: VideoComment[], totalComments: number}> {
53 const pagination = this.restService.componentPaginationToRestPagination(componentPagination) 53 const pagination = this.restService.componentPaginationToRestPagination(componentPagination)
54 54
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
index 711a01ba0..a77a6e9f3 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts
@@ -7,7 +7,7 @@ import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/v
7import { AuthService } from '../../../core/auth' 7import { AuthService } from '../../../core/auth'
8import { ComponentPagination } from '../../../shared/rest/component-pagination.model' 8import { ComponentPagination } from '../../../shared/rest/component-pagination.model'
9import { User } from '../../../shared/users' 9import { User } from '../../../shared/users'
10import { SortField } from '../../../shared/video/sort-field.type' 10import { VideoSortField } from '../../../shared/video/sort-field.type'
11import { VideoDetails } from '../../../shared/video/video-details.model' 11import { VideoDetails } from '../../../shared/video/video-details.model'
12import { VideoComment } from './video-comment.model' 12import { VideoComment } from './video-comment.model'
13import { VideoCommentService } from './video-comment.service' 13import { VideoCommentService } from './video-comment.service'
@@ -23,7 +23,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
23 23
24 comments: VideoComment[] = [] 24 comments: VideoComment[] = []
25 highlightedThread: VideoComment 25 highlightedThread: VideoComment
26 sort: SortField = '-createdAt' 26 sort: VideoSortField = '-createdAt'
27 componentPagination: ComponentPagination = { 27 componentPagination: ComponentPagination = {
28 currentPage: 1, 28 currentPage: 1,
29 itemsPerPage: 10, 29 itemsPerPage: 10,
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts
index 90eb96afe..de6552875 100644
--- a/client/src/app/videos/video-list/video-local.component.ts
+++ b/client/src/app/videos/video-list/video-local.component.ts
@@ -3,12 +3,10 @@ import { ActivatedRoute, Router } from '@angular/router'
3import { immutableAssign } from '@app/shared/misc/utils' 3import { immutableAssign } from '@app/shared/misc/utils'
4import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth' 5import { AuthService } from '../../core/auth'
6import { PopoverModule } from 'ngx-bootstrap/popover'
7import { AbstractVideoList } from '../../shared/video/abstract-video-list' 6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
8import { SortField } from '../../shared/video/sort-field.type' 7import { VideoSortField } from '../../shared/video/sort-field.type'
9import { VideoService } from '../../shared/video/video.service' 8import { VideoService } from '../../shared/video/video.service'
10import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum' 9import { VideoFilter } from '../../../../../shared/models/videos/video-query.type'
11import * as url from 'url'
12 10
13@Component({ 11@Component({
14 selector: 'my-videos-local', 12 selector: 'my-videos-local',
@@ -18,7 +16,8 @@ import * as url from 'url'
18export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy { 16export class VideoLocalComponent extends AbstractVideoList implements OnInit, OnDestroy {
19 titlePage = 'Local videos' 17 titlePage = 'Local videos'
20 currentRoute = '/videos/local' 18 currentRoute = '/videos/local'
21 sort = '-createdAt' as SortField 19 sort = '-createdAt' as VideoSortField
20 filter: VideoFilter = 'local'
22 21
23 constructor (protected router: Router, 22 constructor (protected router: Router,
24 protected route: ActivatedRoute, 23 protected route: ActivatedRoute,
@@ -41,10 +40,10 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On
41 getVideosObservable (page: number) { 40 getVideosObservable (page: number) {
42 const newPagination = immutableAssign(this.pagination, { currentPage: page }) 41 const newPagination = immutableAssign(this.pagination, { currentPage: page })
43 42
44 return this.videoService.getVideos(newPagination, this.sort, 'local') 43 return this.videoService.getVideos(newPagination, this.sort, this.filter)
45 } 44 }
46 45
47 generateSyndicationList () { 46 generateSyndicationList () {
48 this.syndicationItems = this.videoService.getVideoFeedUrls('local') 47 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, this.filter)
49 } 48 }
50} 49}
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts
index 3b8108b00..cca35d0f5 100644
--- a/client/src/app/videos/video-list/video-recently-added.component.ts
+++ b/client/src/app/videos/video-list/video-recently-added.component.ts
@@ -4,10 +4,8 @@ import { immutableAssign } from '@app/shared/misc/utils'
4import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth' 5import { AuthService } from '../../core/auth'
6import { AbstractVideoList } from '../../shared/video/abstract-video-list' 6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7import { SortField } from '../../shared/video/sort-field.type' 7import { VideoSortField } from '../../shared/video/sort-field.type'
8import { VideoService } from '../../shared/video/video.service' 8import { VideoService } from '../../shared/video/video.service'
9import { FeedFormat } from '../../../../../shared/models/feeds/feed-format.enum'
10import * as url from 'url'
11 9
12@Component({ 10@Component({
13 selector: 'my-videos-recently-added', 11 selector: 'my-videos-recently-added',
@@ -17,7 +15,7 @@ import * as url from 'url'
17export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy { 15export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
18 titlePage = 'Recently added' 16 titlePage = 'Recently added'
19 currentRoute = '/videos/recently-added' 17 currentRoute = '/videos/recently-added'
20 sort: SortField = '-createdAt' 18 sort: VideoSortField = '-createdAt'
21 19
22 constructor (protected router: Router, 20 constructor (protected router: Router,
23 protected route: ActivatedRoute, 21 protected route: ActivatedRoute,
@@ -44,6 +42,6 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On
44 } 42 }
45 43
46 generateSyndicationList () { 44 generateSyndicationList () {
47 this.syndicationItems = this.videoService.getVideoFeedUrls() 45 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort)
48 } 46 }
49} 47}
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts
index 6358ef91f..0c9e28216 100644
--- a/client/src/app/videos/video-list/video-trending.component.ts
+++ b/client/src/app/videos/video-list/video-trending.component.ts
@@ -4,7 +4,7 @@ import { immutableAssign } from '@app/shared/misc/utils'
4import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
5import { AuthService } from '../../core/auth' 5import { AuthService } from '../../core/auth'
6import { AbstractVideoList } from '../../shared/video/abstract-video-list' 6import { AbstractVideoList } from '../../shared/video/abstract-video-list'
7import { SortField } from '../../shared/video/sort-field.type' 7import { VideoSortField } from '../../shared/video/sort-field.type'
8import { VideoService } from '../../shared/video/video.service' 8import { VideoService } from '../../shared/video/video.service'
9 9
10@Component({ 10@Component({
@@ -15,7 +15,7 @@ import { VideoService } from '../../shared/video/video.service'
15export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy { 15export class VideoTrendingComponent extends AbstractVideoList implements OnInit, OnDestroy {
16 titlePage = 'Trending' 16 titlePage = 'Trending'
17 currentRoute = '/videos/trending' 17 currentRoute = '/videos/trending'
18 defaultSort: SortField = '-views' 18 defaultSort: VideoSortField = '-views'
19 19
20 constructor (protected router: Router, 20 constructor (protected router: Router,
21 protected route: ActivatedRoute, 21 protected route: ActivatedRoute,
@@ -41,6 +41,6 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,
41 } 41 }
42 42
43 generateSyndicationList () { 43 generateSyndicationList () {
44 this.syndicationItems = this.videoService.getVideoFeedUrls() 44 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort)
45 } 45 }
46} 46}
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts
index abe6b3ff7..56cbf9448 100644
--- a/server/controllers/api/users.ts
+++ b/server/controllers/api/users.ts
@@ -161,7 +161,7 @@ export {
161 161
162async function getUserVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 162async function getUserVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
163 const user = res.locals.oauth.token.User as UserModel 163 const user = res.locals.oauth.token.User as UserModel
164 const resultList = await VideoModel.listUserVideosForApi(user.id ,req.query.start, req.query.count, req.query.sort) 164 const resultList = await VideoModel.listAccountVideosForApi(user.Account.id ,req.query.start, req.query.count, req.query.sort)
165 165
166 return res.json(getFormattedObjects(resultList.data, resultList.total)) 166 return res.json(getFormattedObjects(resultList.data, resultList.total))
167} 167}
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts
index b9d4c5d50..700c50ec8 100644
--- a/server/controllers/feeds.ts
+++ b/server/controllers/feeds.ts
@@ -1,6 +1,12 @@
1import * as express from 'express' 1import * as express from 'express'
2import { CONFIG } from '../initializers' 2import { CONFIG } from '../initializers'
3import { asyncMiddleware, feedsValidator } from '../middlewares' 3import {
4 asyncMiddleware,
5 feedsValidator,
6 setDefaultPagination,
7 setDefaultSort,
8 videosSortValidator
9} from '../middlewares'
4import { VideoModel } from '../models/video/video' 10import { VideoModel } from '../models/video/video'
5import * as Feed from 'pfeed' 11import * as Feed from 'pfeed'
6import { ResultList } from '../../shared/models' 12import { ResultList } from '../../shared/models'
@@ -9,6 +15,8 @@ import { AccountModel } from '../models/account/account'
9const feedsRouter = express.Router() 15const feedsRouter = express.Router()
10 16
11feedsRouter.get('/feeds/videos.:format', 17feedsRouter.get('/feeds/videos.:format',
18 videosSortValidator,
19 setDefaultSort,
12 asyncMiddleware(feedsValidator), 20 asyncMiddleware(feedsValidator),
13 asyncMiddleware(generateFeed) 21 asyncMiddleware(generateFeed)
14) 22)
@@ -23,26 +31,25 @@ export {
23 31
24async function generateFeed (req: express.Request, res: express.Response, next: express.NextFunction) { 32async function generateFeed (req: express.Request, res: express.Response, next: express.NextFunction) {
25 let feed = initFeed() 33 let feed = initFeed()
26 let feedStart = 0 34 const paginationStart = 0
27 let feedCount = 10 35 const paginationCount = 20
28 let feedSort = '-createdAt'
29 36
30 let resultList: ResultList<VideoModel> 37 let resultList: ResultList<VideoModel>
31 const account: AccountModel = res.locals.account 38 const account: AccountModel = res.locals.account
32 39
33 if (account) { 40 if (account) {
34 resultList = await VideoModel.listUserVideosForApi( 41 resultList = await VideoModel.listAccountVideosForApi(
35 account.id, 42 account.id,
36 feedStart, 43 paginationStart,
37 feedCount, 44 paginationCount,
38 feedSort, 45 req.query.sort,
39 true 46 true
40 ) 47 )
41 } else { 48 } else {
42 resultList = await VideoModel.listForApi( 49 resultList = await VideoModel.listForApi(
43 feedStart, 50 paginationStart,
44 feedCount, 51 paginationCount,
45 feedSort, 52 req.query.sort,
46 req.query.filter, 53 req.query.filter,
47 true 54 true
48 ) 55 )
@@ -100,7 +107,7 @@ function initFeed () {
100 rss: `${webserverUrl}/feeds/videos.xml` 107 rss: `${webserverUrl}/feeds/videos.xml`
101 }, 108 },
102 author: { 109 author: {
103 name: 'instance admin of ' + CONFIG.INSTANCE.NAME, 110 name: 'Instance admin of ' + CONFIG.INSTANCE.NAME,
104 email: CONFIG.ADMIN.EMAIL, 111 email: CONFIG.ADMIN.EMAIL,
105 link: `${webserverUrl}/about` 112 link: `${webserverUrl}/about`
106 } 113 }
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 240a2b5a2..ffb9725b4 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -640,7 +640,7 @@ export class VideoModel extends Model<VideoModel> {
640 }) 640 })
641 } 641 }
642 642
643 static listUserVideosForApi (userId: number, start: number, count: number, sort: string, withFiles = false) { 643 static listAccountVideosForApi (accountId: number, start: number, count: number, sort: string, withFiles = false) {
644 const query: IFindOptions<VideoModel> = { 644 const query: IFindOptions<VideoModel> = {
645 offset: start, 645 offset: start,
646 limit: count, 646 limit: count,
@@ -653,7 +653,7 @@ export class VideoModel extends Model<VideoModel> {
653 { 653 {
654 model: AccountModel, 654 model: AccountModel,
655 where: { 655 where: {
656 userId 656 id: accountId
657 }, 657 },
658 required: true 658 required: true
659 } 659 }