- const { start, count, sort, isLocal, search, searchAccount, searchVideo } = parameters
-
- const where: WhereOptions = {
- deletedAt: null
- }
-
- const whereAccount: WhereOptions = {}
- const whereActor: WhereOptions = {}
- const whereVideo: WhereOptions = {}
-
- if (isLocal === true) {
- Object.assign(whereActor, {
- serverId: null
- })
- } else if (isLocal === false) {
- Object.assign(whereActor, {
- serverId: {
- [Op.ne]: null
- }
- })
- }
-
- if (search) {
- Object.assign(where, {
- [Op.or]: [
- searchAttribute(search, 'text'),
- searchAttribute(search, '$Account.Actor.preferredUsername$'),
- searchAttribute(search, '$Account.name$'),
- searchAttribute(search, '$Video.name$')
- ]
- })
- }
-
- if (searchAccount) {
- Object.assign(whereActor, {
- [Op.or]: [
- searchAttribute(searchAccount, '$Account.Actor.preferredUsername$'),
- searchAttribute(searchAccount, '$Account.name$')
- ]
- })
- }
+ const queryOptions: ListVideoCommentsOptions = {
+ ...pick(parameters, [ 'start', 'count', 'sort', 'isLocal', 'search', 'searchVideo', 'searchAccount', 'onLocalVideo' ]),