Files
overleaf-cep/services/web/app/src/models/DeletedSubscription.js
T
Eric Mc Sween bdc5360bc0 Merge pull request #2372 from overleaf/em-mongo-connection-pool
Use the default Mongoose connection pool for all models

GitOrigin-RevId: d227b7eb36f130085c9eb1480dc07bd50ba57768
2019-11-18 14:20:43 +00:00

35 lines
754 B
JavaScript

const mongoose = require('../infrastructure/Mongoose')
const { SubscriptionSchema } = require('./Subscription')
const { Schema } = mongoose
const { ObjectId } = Schema
const DeleterDataSchema = new Schema(
{
deleterId: { type: ObjectId, ref: 'User' },
deleterIpAddress: { type: String },
deletedAt: {
type: Date,
default() {
return new Date()
}
}
},
{ _id: false }
)
const DeletedSubscriptionSchema = new Schema(
{
deleterData: DeleterDataSchema,
subscription: SubscriptionSchema
},
{ collection: 'deletedSubscriptions' }
)
exports.DeletedSubscription = mongoose.model(
'DeletedSubscription',
DeletedSubscriptionSchema
)
exports.DeletedSubscriptionSchema = DeletedSubscriptionSchema