Skip to content

Commit 4f72929

Browse files
committed
add vote model
1 parent 730f78e commit 4f72929

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/models/Vote.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint no-underscore-dangle: ["error", { "allow": ["_id"] }] */
2+
import mongoose, { Schema } from 'mongoose';
3+
4+
const VoteSchema = new Schema({
5+
procedure: { type: Schema.Types.ObjectId, ref: 'Procedure', required: true },
6+
users: [{ type: Schema.Types.ObjectId, ref: 'User', required: true }],
7+
voteResults: {
8+
yes: { type: Number, default: 0 },
9+
no: { type: Number, default: 0 },
10+
abstination: { type: Number, default: 0 },
11+
},
12+
});
13+
14+
export default mongoose.model('Vote', VoteSchema);

0 commit comments

Comments
 (0)