Minor fixes

This commit is contained in:
2025-02-07 01:08:40 +01:00
parent 9ea12ee458
commit f2917e67e3
4 changed files with 28 additions and 8 deletions

View File

@ -23,6 +23,18 @@ class SpriteRepository extends BaseRepository {
return []
}
}
async getFirst(populate?: any): Promise<Sprite | null> {
try {
const repository = this.getEntityManager().getRepository(Sprite)
const result = await repository.findOne({ id: { $exists: true } }, { populate })
if (result) result.setEntityManager(this.getEntityManager())
return result
} catch (error: any) {
return null
}
}
}
export default SpriteRepository