verdnatura-chat/app/lib/database/services/Subscription.ts

17 lines
456 B
TypeScript
Raw Normal View History

2022-02-28 18:00:47 +00:00
import database from '..';
import { TAppDatabase } from '../interfaces';
import { SUBSCRIPTIONS_TABLE } from '../model/Subscription';
const getCollection = (db: TAppDatabase) => db.get(SUBSCRIPTIONS_TABLE);
export const getSubscriptionByRoomId = async (rid: string) => {
const db = database.active;
const subCollection = getCollection(db);
try {
const result = await subCollection.find(rid);
return result;
} catch (error) {
return null;
}
};