POC
This commit is contained in:
@ -3,35 +3,23 @@ import { UUID } from '#application/types'
|
||||
import { Sprite } from '#entities/sprite'
|
||||
|
||||
class SpriteRepository extends BaseRepository {
|
||||
async getById(id: UUID) {
|
||||
async getById(id: UUID, populate?: any) {
|
||||
try {
|
||||
const repository = this.em.getRepository(Sprite)
|
||||
return await repository.findOne({ id })
|
||||
return await repository.findOne({ id }, { populate })
|
||||
} catch (error: any) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
async getAll(): Promise<any> {
|
||||
async getAll(populate?: any): Promise<Sprite[]> {
|
||||
try {
|
||||
const repository = this.em.getRepository(Sprite)
|
||||
return await repository.findAll()
|
||||
return await repository.findAll({ populate })
|
||||
} catch (error: any) {
|
||||
return null
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
// @TODO: THIS BROKEY
|
||||
// async getSpriteActions(spriteId: string): Promise<any> {
|
||||
// try {
|
||||
// const repository = this.em.getRepository(SpriteAction)
|
||||
// return await repository.find({
|
||||
// sprite: spriteId
|
||||
// })
|
||||
// } catch (error: any) {
|
||||
// return null
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
export default new SpriteRepository()
|
||||
|
Reference in New Issue
Block a user