Many many more improvements

This commit is contained in:
2024-12-28 19:21:15 +01:00
parent bd3bf6f580
commit 918f5141fc
27 changed files with 178 additions and 191 deletions

View File

@ -1,5 +1,4 @@
import { BaseRepository } from '#application/base/baseRepository'
import { appLogger } from '#application/logger'
import { Item } from '#entities/item'
class ItemRepository extends BaseRepository {
@ -8,7 +7,7 @@ class ItemRepository extends BaseRepository {
const repository = this.em.getRepository(Item)
return await repository.findOne({ id })
} catch (error: any) {
appLogger.error(`Failed to get item by ID: ${error instanceof Error ? error.message : String(error)}`)
this.logger.error(`Failed to get item by ID: ${error instanceof Error ? error.message : String(error)}`)
return null
}
}
@ -20,7 +19,7 @@ class ItemRepository extends BaseRepository {
id: ids
})
} catch (error: any) {
appLogger.error(`Failed to get items by IDs: ${error instanceof Error ? error.message : String(error)}`)
this.logger.error(`Failed to get items by IDs: ${error instanceof Error ? error.message : String(error)}`)
return null
}
}
@ -30,7 +29,7 @@ class ItemRepository extends BaseRepository {
const repository = this.em.getRepository(Item)
return await repository.findAll()
} catch (error: any) {
appLogger.error(`Failed to get all items: ${error instanceof Error ? error.message : String(error)}`)
this.logger.error(`Failed to get all items: ${error instanceof Error ? error.message : String(error)}`)
return null
}
}