aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/sql/abstract-videos-query-builder.ts
blob: 597a02af75c25d85914c59e6ffcdc51c44701210 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 })
  }
}