1
0
Fork 0
peertube/server/models/shared/query.ts
2021-07-28 10:32:40 +02:00

17 lines
419 B
TypeScript

import { BindOrReplacements, QueryTypes } from 'sequelize'
import { sequelizeTypescript } from '@server/initializers/database'
function doesExist (query: string, bind?: BindOrReplacements) {
const options = {
type: QueryTypes.SELECT as QueryTypes.SELECT,
bind,
raw: true
}
return sequelizeTypescript.query(query, options)
.then(results => results.length === 1)
}
export {
doesExist
}