operation.js 527 Bytes
/**
 * 用户操作日志
 * @author: jiangfeng<jeff.jiang@yoho.cn>
 * @date: 2016/8/22
 */

import {OperationLogger} from '../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()
        });
    }
};

export default OperationLog;