Browse Source

refactored down to base (these are coming right back)

develop
Rob Colbert 2 years ago
parent
commit
c9607eaf3b
  1. 4
      app/controllers/home.js
  2. 11
      app/services/hive.js

4
app/controllers/home.js

@ -65,16 +65,12 @@ class HomeController extends SiteController {
async getHome (req, res, next) {
const {
announcement: announcementService,
hive: hiveService,
oauth2: oauth2Service,
} = this.dtp.services;
try {
res.locals.announcements = await announcementService.getLatest(req.user);
res.locals.featuredDestinations = await oauth2Service.getRandomClients(3);
res.locals.pagination = this.getPaginationParameters(req, 20);
res.locals.constellationTimeline = await hiveService.getConstellationTimeline(res.locals.pagination);
res.render('index');
} catch (error) {
this.log.error('failed to render home view', { error });

11
app/services/hive.js

@ -251,17 +251,6 @@ class HiveService extends SiteService {
return event.toObject();
}
async getConstellationTimeline (pagination) {
const totalEventCount = await KaleidoscopeEvent.estimatedDocumentCount();
const events = await KaleidoscopeEvent
.find()
.sort({ created: -1 })
.skip(pagination.skip)
.limit(pagination.cpp)
.lean();
return { events, totalEventCount };
}
}
module.exports = {

Loading…
Cancel
Save