Skip to content

Commit

Permalink
include timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
Visnu Pitiyanuvath committed Jul 12, 2011
1 parent 969876a commit d81de42
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion controllers/teams.coffee
Expand Up @@ -48,7 +48,7 @@ app.put '/teams/:id', (req, res, next) ->

Team.findById req.params.id, (err, team) ->
return next '404' unless team
return next '401' unless _.include team.people_ids, req.user.id
return next '401' unless team.includes req.user
_.extend team, req.body
team.save (err) ->
if err
Expand Down
1 change: 1 addition & 0 deletions models/person.coffee
Expand Up @@ -4,6 +4,7 @@ env = require '../config/env'

# auth decoration
PersonSchema = module.exports = new mongoose.Schema
PersonSchema.plugin require('mongoose-types').useTimestamps
PersonSchema.plugin auth,
everymodule:
everyauth: { User: () -> Person }
Expand Down
9 changes: 5 additions & 4 deletions models/team.coffee
Expand Up @@ -6,10 +6,11 @@ Invite = require './invite'
TeamSchema = new mongoose.Schema
name:
type: String
validate: [/./, "Name can't be blank"]
emails: [String]
invites: [Invite]
people_ids: [ObjectId]
validate: [ /./, "Name can't be blank" ]
emails: [ String ]
invites: [ Invite ]
people_ids: [ ObjectId ]
TeamSchema.plugin require('mongoose-types').useTimestamps

TeamSchema.path('emails').validate (v) ->
1 <= v.length
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -28,6 +28,7 @@
"markdown": "0.2.1",
"mongoose": "1.6.0",
"mongoose-auth": "0.0.11",
"mongoose-types": "1.0.3",
"socket.io": "0.6.18",
"stylus": "0.13.0",
"underscore": "1.1.6"
Expand Down

0 comments on commit d81de42

Please sign in to comment.