mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 06:09:02 +02:00
1be43911b4
Set Prettier's "trailingComma" setting to "es5" GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
36 lines
852 B
JavaScript
36 lines
852 B
JavaScript
const mongoose = require('../infrastructure/Mongoose')
|
|
|
|
const { Schema } = mongoose
|
|
const { ObjectId } = Schema
|
|
|
|
const EXPIRY_IN_SECONDS = 60 * 60 * 24 * 30
|
|
|
|
const ExpiryDate = function () {
|
|
const timestamp = new Date()
|
|
timestamp.setSeconds(timestamp.getSeconds() + EXPIRY_IN_SECONDS)
|
|
return timestamp
|
|
}
|
|
|
|
const ProjectInviteSchema = new Schema(
|
|
{
|
|
email: String,
|
|
token: String,
|
|
sendingUserId: ObjectId,
|
|
projectId: ObjectId,
|
|
privileges: String,
|
|
createdAt: { type: Date, default: Date.now },
|
|
expires: {
|
|
type: Date,
|
|
default: ExpiryDate,
|
|
index: { expireAfterSeconds: 10 },
|
|
},
|
|
},
|
|
{
|
|
collection: 'projectInvites',
|
|
}
|
|
)
|
|
|
|
exports.ProjectInvite = mongoose.model('ProjectInvite', ProjectInviteSchema)
|
|
exports.ProjectInviteSchema = ProjectInviteSchema
|
|
exports.EXPIRY_IN_SECONDS = EXPIRY_IN_SECONDS
|