mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Add SQL query support in plugins
This commit is contained in:
parent
bc0d801bb7
commit
1b05d82d86
10 changed files with 110 additions and 9 deletions
|
@ -1,11 +1,15 @@
|
|||
import { PluginModel } from '@server/models/server/plugin'
|
||||
import { PeerTubeHelpers } from '@server/typings/plugins'
|
||||
import { sequelizeTypescript } from '@server/initializers/database'
|
||||
import { buildLogger } from '@server/helpers/logger'
|
||||
|
||||
function buildPluginHelpers (npmName: string, plugin: PluginModel): PeerTubeHelpers {
|
||||
const logger = buildLogger(npmName)
|
||||
function buildPluginHelpers (npmName: string): PeerTubeHelpers {
|
||||
const logger = buildPluginLogger(npmName)
|
||||
|
||||
const database = buildDatabaseHelpers()
|
||||
|
||||
return {
|
||||
logger
|
||||
logger,
|
||||
database
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,6 +19,12 @@ export {
|
|||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function buildLogger (npmName: string) {
|
||||
function buildPluginLogger (npmName: string) {
|
||||
return buildLogger(npmName)
|
||||
}
|
||||
|
||||
function buildDatabaseHelpers () {
|
||||
return {
|
||||
query: sequelizeTypescript.query.bind(sequelizeTypescript)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue