mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-11-16 08:36:27 +01:00
16 lines
406 B
TypeScript
16 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;
|
|
}
|