misskey/src/models/poll-vote.ts
2019-01-21 21:45:11 +09:00

17 lines
406 B
TypeScript

import * as mongo from 'mongodb';
import db from '../db/mongodb';
const PollVote = db.get<IPollVote>('pollVotes');
PollVote.createIndex('userId');
PollVote.createIndex('noteId');
PollVote.createIndex(['userId', 'noteId'], { unique: true });
export default PollVote;
export interface IPollVote {
_id: mongo.ObjectID;
createdAt: Date;
userId: mongo.ObjectID;
noteId: mongo.ObjectID;
choice: number;
}