Map event tile improvements
This commit is contained in:
@ -6,7 +6,10 @@ class ItemRepository extends BaseRepository {
|
||||
async getById(id: UUID): Promise<Item | null> {
|
||||
try {
|
||||
const repository = this.getEntityManager().getRepository(Item)
|
||||
return await repository.findOne({ id })
|
||||
const result = await repository.findOne({ id })
|
||||
if (result) result.setEntityManager(this.getEntityManager())
|
||||
|
||||
return result
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Failed to get item by ID: ${error instanceof Error ? error.message : String(error)}`)
|
||||
return null
|
||||
@ -16,7 +19,10 @@ class ItemRepository extends BaseRepository {
|
||||
async getByIds(ids: UUID[]): Promise<Item[]> {
|
||||
try {
|
||||
const repository = this.getEntityManager().getRepository(Item)
|
||||
return await repository.find({ id: ids })
|
||||
const results = await repository.find({ id: ids })
|
||||
for (const result of results) result.setEntityManager(this.getEntityManager())
|
||||
|
||||
return results
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Failed to get items by IDs: ${error instanceof Error ? error.message : String(error)}`)
|
||||
return []
|
||||
@ -26,7 +32,10 @@ class ItemRepository extends BaseRepository {
|
||||
async getAll(): Promise<Item[]> {
|
||||
try {
|
||||
const repository = this.getEntityManager().getRepository(Item)
|
||||
return await repository.findAll()
|
||||
const results = await repository.findAll()
|
||||
for (const result of results) result.setEntityManager(this.getEntityManager())
|
||||
|
||||
return results
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Failed to get all items: ${error instanceof Error ? error.message : String(error)}`)
|
||||
return []
|
||||
|
Reference in New Issue
Block a user