mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 06:39:02 +02:00
07c827e9fd
[web] last infrastructure conversions GitOrigin-RevId: ad1aff9b7df0610ed0303157d9e2c8032f32c02b
38 lines
805 B
JavaScript
38 lines
805 B
JavaScript
import mongoose from '../infrastructure/Mongoose.mjs'
|
|
|
|
const { Schema } = mongoose
|
|
const { ObjectId } = Schema
|
|
|
|
export const EXPIRY_IN_SECONDS = 60 * 60 * 24 * 30
|
|
|
|
const ExpiryDate = function () {
|
|
const timestamp = new Date()
|
|
timestamp.setSeconds(timestamp.getSeconds() + EXPIRY_IN_SECONDS)
|
|
return timestamp
|
|
}
|
|
|
|
export const ProjectInviteSchema = new Schema(
|
|
{
|
|
email: String,
|
|
tokenHmac: 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,
|
|
}
|
|
)
|
|
|
|
export const ProjectInvite = mongoose.model(
|
|
'ProjectInvite',
|
|
ProjectInviteSchema
|
|
)
|