Vulcan/packages/vulcan-voting/lib/modules/votes/schema.js

61 lines
893 B
JavaScript
Raw Normal View History

2017-09-25 22:09:09 +02:00
const schema = {
_id: {
type: String,
2018-06-22 20:55:22 +09:00
canRead: ['guests'],
2017-09-25 22:09:09 +02:00
},
/**
The id of the document that was voted on
*/
documentId: {
2018-01-03 08:56:39 +09:00
type: String,
2018-06-22 20:55:22 +09:00
canRead: ['guests'],
2017-09-25 22:09:09 +02:00
},
/**
The name of the collection the document belongs to
2017-09-25 22:09:09 +02:00
*/
collectionName: {
2018-01-03 08:56:39 +09:00
type: String,
2018-06-22 20:55:22 +09:00
canRead: ['guests'],
2017-09-25 22:09:09 +02:00
},
/**
The id of the user that voted
*/
userId: {
2018-01-03 08:56:39 +09:00
type: String,
2018-06-22 20:55:22 +09:00
canRead: ['guests'],
2017-09-25 22:09:09 +02:00
},
/**
An optional vote type (for Facebook-style reactions)
*/
voteType: {
type: String,
2018-01-03 08:56:39 +09:00
optional: true,
2018-06-22 20:55:22 +09:00
canRead: ['guests'],
2017-09-25 22:09:09 +02:00
},
/**
The vote power (e.g. 1 = upvote, -1 = downvote, or any other value)
*/
power: {
type: Number,
2018-01-03 08:56:39 +09:00
optional: true,
2018-06-22 20:55:22 +09:00
canRead: ['guests'],
2017-09-25 22:09:09 +02:00
},
/**
The vote timestamp
*/
votedAt: {
type: Date,
2018-01-03 08:56:39 +09:00
optional: true,
2018-06-22 20:55:22 +09:00
canRead: ['guests'],
2017-09-25 22:09:09 +02:00
}
};
export default schema;