mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Update ProjectInvite model
This commit is contained in:
parent
4db9d5a466
commit
e0562a2301
1 changed files with 14 additions and 8 deletions
|
@ -4,15 +4,21 @@ Settings = require 'settings-sharelatex'
|
||||||
Schema = mongoose.Schema
|
Schema = mongoose.Schema
|
||||||
ObjectId = Schema.ObjectId
|
ObjectId = Schema.ObjectId
|
||||||
|
|
||||||
|
THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30
|
||||||
|
|
||||||
|
makeExpirationDate = () ->
|
||||||
|
nowInMillis = Date.now()
|
||||||
|
new Date(nowInMillis + (1000 * THIRTY_DAYS_IN_SECONDS))
|
||||||
|
|
||||||
|
|
||||||
ProjectInviteSchema = new Schema
|
ProjectInviteSchema = new Schema
|
||||||
project_id: ObjectId
|
|
||||||
from_user_id: ObjectId
|
|
||||||
privilegeLevel: String
|
|
||||||
# For existing users
|
|
||||||
to_user_id: ObjectId
|
|
||||||
# For non-existant users
|
|
||||||
hashed_token: String
|
|
||||||
email: String
|
email: String
|
||||||
|
token: String
|
||||||
|
sendingUserId: ObjectId
|
||||||
|
projectId: ObjectId
|
||||||
|
privileges: String
|
||||||
|
createdAt: {type: Date, default: Date.now}
|
||||||
|
expiresAt: {type: Date, default: makeExpirationDate}
|
||||||
|
|
||||||
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: Settings.mongo.poolSize || 10)
|
conn = mongoose.createConnection(Settings.mongo.url, server: poolSize: Settings.mongo.poolSize || 10)
|
||||||
|
|
||||||
|
@ -20,4 +26,4 @@ ProjectInvite = conn.model('ProjectInvite', ProjectInviteSchema)
|
||||||
|
|
||||||
mongoose.model 'ProjectInvite', ProjectInviteSchema
|
mongoose.model 'ProjectInvite', ProjectInviteSchema
|
||||||
exports.ProjectInvite = ProjectInvite
|
exports.ProjectInvite = ProjectInvite
|
||||||
exports.ProjectInviteSchema = ProjectInviteSchema
|
exports.ProjectInviteSchema = ProjectInviteSchema
|
||||||
|
|
Loading…
Reference in a new issue