Rocket.Chat.ReactNative/app/lib/database/services/Message.ts

17 lines
452 B
TypeScript

import database from '..';
import { TAppDatabase } from '../interfaces';
import { MESSAGES_TABLE } from '../model/Message';
const getCollection = (db: TAppDatabase) => db.get(MESSAGES_TABLE);
export const getMessageById = async (messageId: string) => {
const db = database.active;
const messageCollection = getCollection(db);
try {
const result = await messageCollection.find(messageId);
return result;
} catch (error) {
return null;
}
};