25 lines
600 B
TypeScript
25 lines
600 B
TypeScript
import { BaseRepository } from '#application/base/baseRepository'
|
|
import { UUID } from '#application/types'
|
|
|
|
class ObjectRepository 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 ObjectRepository()
|