1 import { QueryTypes, Sequelize, Transaction } from 'sequelize'
5 * Abstact builder to run video SQL queries
9 export class AbstractRunQuery {
10 protected query: string
11 protected replacements: any = {}
13 constructor (protected readonly sequelize: Sequelize) {
17 protected runQuery (options: { nest?: boolean, transaction?: Transaction, logging?: boolean } = {}) {
18 const queryOptions = {
19 transaction: options.transaction,
20 logging: options.logging,
21 replacements: this.replacements,
22 type: QueryTypes.SELECT as QueryTypes.SELECT,
23 nest: options.nest ?? false
26 return this.sequelize.query<any>(this.query, queryOptions)