Migrate all the things
* Migrates from Mongo to Postgres. * Migrates from JSPM to Webpack. * Migrates from React to Vuejs. * Migrates from Bootstrap to Bulma. Also: * Fixes rendering of meta data in the document head tag.
This commit is contained in:
parent
09706778d9
commit
7bb0497ff4
76 changed files with 6741 additions and 1760 deletions
23
routes/recent.js
Normal file
23
routes/recent.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import models from '../models';
|
||||
|
||||
const recentQuery = {
|
||||
include: [
|
||||
{ model: models.artist },
|
||||
{ model: models.match },
|
||||
],
|
||||
limit: 6,
|
||||
order: [
|
||||
['updatedAt', 'DESC'],
|
||||
],
|
||||
};
|
||||
|
||||
export default function* () {
|
||||
const recentAlbums = yield models.album.findAll(recentQuery);
|
||||
const recentTracks = yield models.track.findAll(recentQuery);
|
||||
|
||||
this.body = {
|
||||
recents: recentAlbums.map(album => album.toJSON())
|
||||
.concat(recentTracks.map(track => track.toJSON()))
|
||||
.sort((a, b) => a.createdAt < b.createdAt).slice(0, 6),
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue