import { Class , FetchUser } from '@foal/core' ; import { getMongoRepository , ObjectID } from 'typeorm' ; export param { ( Class < { id : ObjectID } | { _id : ObjectID } > ) } userEntityClass returns { FetchUser } export function fetchMongoDBUser ( userEntityClass ) { return ( id ) => { if ( typeof id === 'number' ) { throw new Error ( 'Unexpected type for MongoDB user ID: number.' ) ; } return getMongoRepository ( userEntityClass ) . findOne ( id ) ; } ; }