Renames to userProfile, change name to displayname. Changes objectid for uuid.

This commit is contained in:
gaba
2016-11-02 13:44:16 -07:00
parent 0b4dcbdffb
commit 94ade6f6fe
2 changed files with 51 additions and 23 deletions
+35
View File
@@ -0,0 +1,35 @@
'use strict';
const mongoose = require('../mongoose');
const uuid = require('uuid');
const Schema = mongoose.Schema;
const ActionSchema = new Schema({
id: {
type: String,
default: uuid.v4,
unique: true
},
action_type: String,
item_type: String,
item_id: String,
user_id: String
},{
_id: false,
timestamps: {
createdAt: 'created_at',
updatedAt: 'updated_at'
}
});
/**
* Finds an action by the id.
* @param {String} id identifier of the action (uuid)
*/
ActionSchema.methods.findById = function(id) {
return Action.findOne({id});
};
const Action = mongoose.model('Action', ActionSchema);
module.exports = Action;