forked from noxious/server
Forgot
This commit is contained in:
24
src/repositories/mapObjectRepository.ts
Normal file
24
src/repositories/mapObjectRepository.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { BaseRepository } from '#application/base/baseRepository'
|
||||
import { UUID } from '#application/types'
|
||||
|
||||
class MapObjectRepository extends BaseRepository {
|
||||
async getById(id: UUID): Promise<any> {
|
||||
try {
|
||||
const repository = this.em.getRepository(Object)
|
||||
return await repository.findOne({ id })
|
||||
} catch (error: any) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
async getAll(): Promise<any> {
|
||||
try {
|
||||
const repository = this.em.getRepository(Object)
|
||||
return await repository.findAll()
|
||||
} catch (error: any) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new MapObjectRepository()
|
Reference in New Issue
Block a user