This repository has been archived on 2025-11-04. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
qoverflow/server/db/models/Vote.js
2022-07-27 16:43:08 -04:00

23 lines
668 B
JavaScript

const mongoose = require('mongoose');
const Vote = mongoose.Schema(
{
parent_id: { type: mongoose.Schema.Types.ObjectId, refPath: 'docModel' },
creator: { type: String, required: true },
status: {
type: String,
enum: ['upvoted', 'downvoted', null],
default: null,
nullable: true
},
docModel: {
type: String,
required: true,
enum: ['Question', 'Answer', 'Comment']
},
expireAt: { type: Date, expire: 1800 },
},
{ timestamps: { createdAt: false, updatedAt: true } }
);
module.exports = mongoose.model('Vote', Vote);