2016-03-17 13:01:26 -04:00
|
|
|
mongoose = require 'mongoose'
|
|
|
|
Settings = require 'settings-sharelatex'
|
|
|
|
|
2016-07-22 11:08:56 -04:00
|
|
|
|
2016-03-17 13:01:26 -04:00
|
|
|
Schema = mongoose.Schema
|
|
|
|
ObjectId = Schema.ObjectId
|
|
|
|
|
2016-07-21 09:20:09 -04:00
|
|
|
|
2016-07-22 11:08:56 -04:00
|
|
|
THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30
|
2016-07-21 09:20:09 -04:00
|
|
|
|
|
|
|
|
2016-03-17 13:01:26 -04:00
|
|
|
ProjectInviteSchema = new Schema
|
|
|
|
email: String
|
2016-07-21 09:20:09 -04:00
|
|
|
token: String
|
|
|
|
sendingUserId: ObjectId
|
|
|
|
projectId: ObjectId
|
|
|
|
privileges: String
|
2016-07-22 11:08:56 -04:00
|
|
|
createdAt: {type: Date, default: Date.now, index: {expiresAfterSeconds: THIRTY_DAYS_IN_SECONDS}}
|
|
|
|
|
2016-03-17 13:01:26 -04:00
|
|
|
|
|
|
|
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: Settings.mongo.poolSize || 10)
|
|
|
|
|
2016-07-22 11:08:56 -04:00
|
|
|
|
2016-03-17 13:01:26 -04:00
|
|
|
ProjectInvite = conn.model('ProjectInvite', ProjectInviteSchema)
|
|
|
|
|
2016-07-22 11:08:56 -04:00
|
|
|
|
2016-03-17 13:01:26 -04:00
|
|
|
mongoose.model 'ProjectInvite', ProjectInviteSchema
|
|
|
|
exports.ProjectInvite = ProjectInvite
|
2016-07-21 09:20:09 -04:00
|
|
|
exports.ProjectInviteSchema = ProjectInviteSchema
|