// report.js // Copyright (C) 2024 DTP Technologies, LLC // All Rights Reserved 'use strict'; import express from 'express'; import { SiteController } from '../../lib/site-lib.js'; export default class ReportController extends SiteController { static get name ( ) { return 'ReportController'; } static get slug ( ) { return 'report'; } constructor (dtp) { super(dtp, ReportController.slug); } async start ( ) { // const { limiter: limiterService } = dtp.services; // const limiterConfig = limiterService.config.report; const router = express.Router(); this.dtp.app.use('/report', router); router.get('/', this.getDashboard.bind(this)); } async getDashboard (req, res, next) { const { report: reportService } = this.dtp.services; try { res.locals.weeklyEarnings = await reportService.getWeeklyEarnings(req.user); res.render('report/dashboard'); } catch (error) { this.log.error('failed to present report dashboard', { error }); return next(error); } } }