verdnatura-chat/app/lib/methods/getRoom.ts

13 lines
370 B
TypeScript
Raw Normal View History

2022-04-28 18:45:00 +00:00
import { TSubscriptionModel } from '../../definitions';
import database from '../database';
2022-02-28 18:00:47 +00:00
2022-05-30 22:02:08 +00:00
export async function getRoom(rid: string): Promise<TSubscriptionModel> {
2022-02-28 18:00:47 +00:00
try {
const db = database.active;
const room = await db.get('subscriptions').find(rid);
return Promise.resolve(room);
} catch (error) {
return Promise.reject(new Error('Room not found'));
}
}