2019-11-18 09:03:20 -05:00
|
|
|
const mongoose = require('../infrastructure/Mongoose')
|
2019-09-09 07:51:34 -04:00
|
|
|
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()
|
2021-04-27 03:52:58 -04:00
|
|
|
},
|
|
|
|
},
|
2019-09-09 07:51:34 -04:00
|
|
|
},
|
|
|
|
{ _id: false }
|
|
|
|
)
|
|
|
|
|
|
|
|
const DeletedSubscriptionSchema = new Schema(
|
|
|
|
{
|
|
|
|
deleterData: DeleterDataSchema,
|
2021-04-27 03:52:58 -04:00
|
|
|
subscription: SubscriptionSchema,
|
2019-09-09 07:51:34 -04:00
|
|
|
},
|
|
|
|
{ collection: 'deletedSubscriptions' }
|
|
|
|
)
|
|
|
|
|
2019-11-18 09:03:20 -05:00
|
|
|
exports.DeletedSubscription = mongoose.model(
|
2019-09-09 07:51:34 -04:00
|
|
|
'DeletedSubscription',
|
|
|
|
DeletedSubscriptionSchema
|
|
|
|
)
|
|
|
|
|
|
|
|
exports.DeletedSubscriptionSchema = DeletedSubscriptionSchema
|