mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Server: Use slave database for reports
This commit is contained in:
parent
e9e6d8a69c
commit
cd0ff94c0c
@ -33,7 +33,7 @@ router.get('admin/reports/:id', async (path: SubPath, ctx: AppContext) => {
|
||||
if (reportType === ReportType.UserActivity) {
|
||||
const query = parseQuery(ctx.query as Record<string, string>);
|
||||
|
||||
const changes = await userActivity(ctx.joplin.db, { interval: query.intervalHours * Hour });
|
||||
const changes = await userActivity(ctx.joplin.dbSlave, { interval: query.intervalHours * Hour });
|
||||
|
||||
const models = ctx.joplin.models;
|
||||
const users = await models.user().loadByIds(changes.map(c => c.user_id), { fields: ['id', 'email'] });
|
||||
|
@ -25,6 +25,7 @@ export interface NotificationView {
|
||||
interface AppContextJoplin {
|
||||
env: Env;
|
||||
db: DbConnection;
|
||||
dbSlave: DbConnection;
|
||||
models: Models;
|
||||
appLogger(): LoggerWrapper;
|
||||
notifications: NotificationView[];
|
||||
|
Loading…
Reference in New Issue
Block a user