aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins/plugin-helpers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-09 11:00:30 +0200
committerChocobozzz <me@florianbigard.com>2020-04-09 11:00:30 +0200
commit1b05d82d861f42c27766e9f24d8d55e68b0cf098 (patch)
treebbf14abc606dd3f8f0c13625afbdf3b17fea3a23 /server/lib/plugins/plugin-helpers.ts
parentbc0d801bb7a0cc503c1637f4a07bb51d68d85608 (diff)
downloadPeerTube-1b05d82d861f42c27766e9f24d8d55e68b0cf098.tar.gz
PeerTube-1b05d82d861f42c27766e9f24d8d55e68b0cf098.tar.zst
PeerTube-1b05d82d861f42c27766e9f24d8d55e68b0cf098.zip
Add SQL query support in plugins
Diffstat (limited to 'server/lib/plugins/plugin-helpers.ts')
-rw-r--r--server/lib/plugins/plugin-helpers.ts20
1 files changed, 15 insertions, 5 deletions
diff --git a/server/lib/plugins/plugin-helpers.ts b/server/lib/plugins/plugin-helpers.ts
index 36d08d84a..a1493c7df 100644
--- a/server/lib/plugins/plugin-helpers.ts
+++ b/server/lib/plugins/plugin-helpers.ts
@@ -1,11 +1,15 @@
1import { PluginModel } from '@server/models/server/plugin'
2import { PeerTubeHelpers } from '@server/typings/plugins' 1import { PeerTubeHelpers } from '@server/typings/plugins'
2import { sequelizeTypescript } from '@server/initializers/database'
3import { buildLogger } from '@server/helpers/logger'
3 4
4function buildPluginHelpers (npmName: string, plugin: PluginModel): PeerTubeHelpers { 5function buildPluginHelpers (npmName: string): PeerTubeHelpers {
5 const logger = buildLogger(npmName) 6 const logger = buildPluginLogger(npmName)
7
8 const database = buildDatabaseHelpers()
6 9
7 return { 10 return {
8 logger 11 logger,
12 database
9 } 13 }
10} 14}
11 15
@@ -15,6 +19,12 @@ export {
15 19
16// --------------------------------------------------------------------------- 20// ---------------------------------------------------------------------------
17 21
18function buildLogger (npmName: string) { 22function buildPluginLogger (npmName: string) {
19 return buildLogger(npmName) 23 return buildLogger(npmName)
20} 24}
25
26function buildDatabaseHelpers () {
27 return {
28 query: sequelizeTypescript.query.bind(sequelizeTypescript)
29 }
30}