'use strict';
const db = require('../schemes');

class Activity {
    static add (projectId, sender, content) {
        return db.Activity.create({projectId, sender, content})
            .then(x => x ? x.toJSON() : null);
    }

    static findActivities (projectId, limit = 200) {
        return db.Activity.findAll({where: {projectId}, limit, order: [['createdAt', 'asc']]})
            .then(xs => xs ? xs.map(x => x.toJSON()) : xs);
    }
}

module.exports = Activity;

@@ -7,16 +7,45 @@
 trict';%0A
+const _ = require('lodash');%0A
 const db
@@ -395,17 +395,18 @@
 ', '
-a
+de
 sc'%5D%5D%7D)%0A
     
@@ -401,16 +401,55 @@
 sc'%5D%5D%7D)%0A
+            .then(xs =%3E _.reverse(xs))%0A
         

fix activity log