2018-09-19 00:18:34 -05:00
|
|
|
import * as mongo from 'mongodb';
|
|
|
|
import db from '../db/mongodb';
|
|
|
|
|
|
|
|
const NoteUnread = db.get<INoteUnread>('noteUnreads');
|
2018-10-29 07:53:40 -05:00
|
|
|
NoteUnread.createIndex('userId');
|
|
|
|
NoteUnread.createIndex('noteId');
|
2018-09-19 00:18:34 -05:00
|
|
|
NoteUnread.createIndex(['userId', 'noteId'], { unique: true });
|
|
|
|
export default NoteUnread;
|
|
|
|
|
|
|
|
export interface INoteUnread {
|
|
|
|
_id: mongo.ObjectID;
|
|
|
|
noteId: mongo.ObjectID;
|
|
|
|
userId: mongo.ObjectID;
|
|
|
|
isSpecified: boolean;
|
|
|
|
|
|
|
|
_note: {
|
|
|
|
userId: mongo.ObjectID;
|
|
|
|
};
|
|
|
|
}
|