Skip to content

Commit

Permalink
Merge pull request #5 from domapic/user-model-timestamps
Browse files Browse the repository at this point in the history
Add createdAt and updatedAt fields to User model
  • Loading branch information
javierbrea committed Jul 28, 2018
2 parents f713462 + 3405a98 commit 8ce4335
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/api/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,29 @@
"description": "Role assigned to the user",
"type": "string",
"enum": ["admin", "service", "plugin"]
},
"__v": {
"description": "Version key",
"type": "string"
},
"createdAt": {
"description": "Creation date timestamp",
"type": "string"
},
"updatedAt": {
"description": "Last update date timestamp",
"type": "string"
}
},
"additionalProperties": false,
"example": {
"_id": "1223123",
"name": "Foo user",
"email": "foo-email@foo-domain.com",
"role": "admin"
"role": "admin",
"__v": 0,
"createdAt": "2018-07-28T17:13:08.718Z",
"updatedAt": "2018-07-28T17:13:09.730Z"
}
},
"NewUser": {
Expand Down
3 changes: 3 additions & 0 deletions lib/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const Model = function (service) {
'plugin'
]
}
},
{
timestamps: true
})

models.User = mongoose.model('User', schema)
Expand Down

0 comments on commit 8ce4335

Please sign in to comment.