operation.js 547 Bytes
/**
 * 用户操作日志
 * @author: jiangfeng<jeff.jiang@yoho.cn>
 * @date: 2016/8/22
 */
'use strict';
const {OperationLogger} = require('../models');

const OperationLog = {

    async action(user, action, description, meta) {
        await OperationLogger.insert({
            user: {
                id: user._id,
                username: user.username
            },
            action: action,
            description: description,
            meta: meta,
            time: new Date()
        });
    }
};

module.exports = OperationLog;