DashboardController.js
Home
/
app /
Controllers /
Http /
DashboardController.js
'use strict'
const Theme = use('App/Models/Theme')
const Element = use('App/Models/Element')
const Submission = use('App/Models/Submission')
const Steward = use('App/Models/Steward')
class DashboardController {
async index({view}) {
const numThemes = await Theme.getCount()
const numElements = await Element.getCount()
const submissions = await Submission.query()
.with('status')
.fetch()
const stewards = await Steward.query()
.with('contact.organization.type')
.fetch()
return view.render('dashboard.index', {
numThemes: numThemes,
numElements: numElements,
submissions: submissions.toJSON(),
stewards: stewards.toJSON()
})
}
}
module.exports = DashboardController