Converted more events
This commit is contained in:
@ -3,7 +3,7 @@ import { UUID } from '#application/types'
|
||||
import { Item } from '#entities/item'
|
||||
|
||||
class ItemRepository extends BaseRepository {
|
||||
async getById(id: UUID): Promise<any> {
|
||||
async getById(id: UUID): Promise<Item | null> {
|
||||
try {
|
||||
const repository = this.getEntityManager().getRepository(Item)
|
||||
return await repository.findOne({ id })
|
||||
@ -13,25 +13,23 @@ class ItemRepository extends BaseRepository {
|
||||
}
|
||||
}
|
||||
|
||||
async getByIds(ids: UUID[]): Promise<any> {
|
||||
async getByIds(ids: UUID[]): Promise<Item[]> {
|
||||
try {
|
||||
const repository = this.getEntityManager().getRepository(Item)
|
||||
return await repository.find({
|
||||
id: ids
|
||||
})
|
||||
return await repository.find({ id: ids })
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Failed to get items by IDs: ${error instanceof Error ? error.message : String(error)}`)
|
||||
return null
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
async getAll(): Promise<any> {
|
||||
async getAll(): Promise<Item[]> {
|
||||
try {
|
||||
const repository = this.getEntityManager().getRepository(Item)
|
||||
return await repository.findAll()
|
||||
} catch (error: any) {
|
||||
this.logger.error(`Failed to get all items: ${error instanceof Error ? error.message : String(error)}`)
|
||||
return null
|
||||
return []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user