Skip to content

Instantly share code, notes, and snippets.

@db0company
Created May 29, 2013 20:31
Show Gist options
  • Save db0company/5673580 to your computer and use it in GitHub Desktop.
Save db0company/5673580 to your computer and use it in GitHub Desktop.
db0@sd-22913:~/www/poney/eipapi/API$ git diff models/User.js
diff --git a/models/User.js b/models/User.js
index 7b8eb47..917b340 100644
--- a/models/User.js
+++ b/models/User.js
@@ -40,6 +40,10 @@ UserSchema.options.toJSON = {
virtuals: true
});
+ obj.birthday = "2006-01-02"; // tmp fix
+ obj.avatar = null; // tmp fix
+ obj.creation = "2018-05-29T15:25:14Z"; // tmp fix
+
delete obj.password;
if (typeof doc._req !== "object" || !doc._req.token || !doc._req.token.user) {
db0@sd-22913:~/www/poney/eipapi/API$ git diff models/OAuthToken.js
diff --git a/models/OAuthToken.js b/models/OAuthToken.js
index cccb861..20b6be6 100755
--- a/models/OAuthToken.js
+++ b/models/OAuthToken.js
@@ -9,6 +9,19 @@ var OAuthTokenSchema = new mongoose.Schema({
OAuthTokenSchema.plugin(element);
+OAuthTokenSchema.options.toJSON = {^M
+ getters: true,^M
+ virtuals: true,^M
+ transform: function(doc, ret, options) {^M
+ obj = doc.toObject({^M
+ virtuals: true^M
+ });^M
+ obj.id = obj._id;^M
+^M
+ return obj;^M
+ }^M
+};^M
+^M
OAuthTokenSchema.statics.queryDefaults = function() {
return {
'populate': 'user',
db0@sd-22913:~/www/poney/eipapi/API$ git stash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment