Created
July 25, 2013 18:14
-
-
Save cadecairos/6082315 to your computer and use it in GitHub Desktop.
apiUser model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | |
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
module.exports = function( env, mongoose ) { | |
var validate = require( "mongoose-validator" ).validate; | |
var schema = new mongoose.Schema({ | |
privatekey: { | |
type: String, | |
required: true, | |
unique: true | |
}, | |
publickey: { | |
type: String, | |
required: true, | |
unique: true | |
}, | |
revoked: { | |
type: Boolean, | |
required: true, | |
"default": false | |
}, | |
contact: { | |
type: String, | |
required: true, | |
validate: validate( "isEmail" ) | |
} | |
}); | |
var ApiUser = mongoose.model( "ApiUser" , schema ); | |
return ApiUser; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment