import type { UUID } from '#application/types' import { BaseRepository } from '#application/base/baseRepository' import { MapObject } from '#entities/mapObject' class MapObjectRepository extends BaseRepository { async getById(id: UUID): Promise { try { const repository = this.getEntityManager().getRepository(MapObject) const result = await repository.findOne({ id }) if (result) result.setEntityManager(this.getEntityManager()) return result } catch (error: any) { return null } } async getAll(): Promise { try { const repository = this.getEntityManager().getRepository(MapObject) const results = await repository.findAll() for (const result of results) result.setEntityManager(this.getEntityManager()) return results } catch (error: any) { return [] } } } export default MapObjectRepository