import DBSchemas from './schemas';
import {getDatabase} from './getDB';
import {databaseConf, databaseNames, possibleDBKeys} from './types';

export const getEntry = async (dbName: databaseNames, key: possibleDBKeys) => {
  const realm = await getDatabase(dbName);
  console.log(realm.path);

  const schema = DBSchemas[dbName].details.properties;

  const val = realm.objectForPrimaryKey<typeof schema>('users', key);
  return val;
};
