1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Refactor video query builder

This commit is contained in:
Chocobozzz 2021-06-10 08:53:32 +02:00
parent ff0ea0cd8e
commit e5dbd5084e
No known key found for this signature in database
GPG key ID: 583A612D890159BE
8 changed files with 1050 additions and 778 deletions

View file

@ -0,0 +1,15 @@
import { logger } from '@server/helpers/logger'
import { Sequelize, QueryTypes } from 'sequelize'
export class AbstractVideosQueryBuilder {
protected sequelize: Sequelize
protected query: string
protected replacements: any = {}
protected runQuery (nest?: boolean) {
logger.info('Running video query.', { query: this.query, replacements: this.replacements })
return this.sequelize.query<any>(this.query, { replacements: this.replacements, type: QueryTypes.SELECT, nest })
}
}