This commit is contained in:
syuilo
2018-03-28 13:13:10 +09:00
parent e802198b27
commit 73bb57480b
3 changed files with 39 additions and 6 deletions

View File

@@ -1,3 +1,13 @@
import * as mongo from 'mongodb';
import db from '../../db/mongodb';
export default db.get('messaging_histories') as any; // fuck type definition
const MessagingHistory = db.get<IMessagingHistory>('messagingHistories');
export default MessagingHistory;
export type IMessagingHistory = {
_id: mongo.ObjectID;
updatedAt: Date;
userId: mongo.ObjectID;
partnerId: mongo.ObjectID;
messageId: mongo.ObjectID;
};

View File

@@ -5,16 +5,17 @@ import { pack as packFile } from './drive-file';
import db from '../../db/mongodb';
import parse from '../common/text';
const MessagingMessage = db.get<IMessagingMessage>('messaging_messages');
const MessagingMessage = db.get<IMessagingMessage>('messagingMessages');
export default MessagingMessage;
export interface IMessagingMessage {
_id: mongo.ObjectID;
created_at: Date;
createdAt: Date;
text: string;
user_id: mongo.ObjectID;
recipient_id: mongo.ObjectID;
is_read: boolean;
userId: mongo.ObjectID;
recipientId: mongo.ObjectID;
isRead: boolean;
fileId: mongo.ObjectID;
}
export function isValidText(text: string): boolean {