mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 04:41:32 +02:00
Upgrade Mongoose and the Mongo driver in web GitOrigin-RevId: 2cad1aabe57eae424a9e4c68b2e0062f0e78ffaf
37 lines
873 B
JavaScript
37 lines
873 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',
|
|
minimize: false,
|
|
}
|
|
)
|
|
|
|
exports.ProjectInvite = mongoose.model('ProjectInvite', ProjectInviteSchema)
|
|
exports.ProjectInviteSchema = ProjectInviteSchema
|
|
exports.EXPIRY_IN_SECONDS = EXPIRY_IN_SECONDS
|