+ static listByAccountForApi (options: {
+ start: number,
+ count: number,
+ sort: string,
+ type?: string,
+ accountId: number
+ }) {
+ const query: IFindOptions<AccountVideoRateModel> = {
+ offset: options.start,
+ limit: options.count,
+ order: getSort(options.sort),
+ where: {
+ accountId: options.accountId
+ },
+ include: [
+ {
+ model: VideoModel,
+ required: true,
+ include: [
+ {
+ model: VideoChannelModel.scope({ method: [VideoChannelScopeNames.SUMMARY, true] }),
+ required: true
+ }
+ ]
+ }
+ ]
+ }
+ if (options.type) query.where['type'] = options.type
+
+ return AccountVideoRateModel.findAndCountAll(query)
+ }
+