Renamed get to getById, map improvement

This commit is contained in:
2025-02-09 17:33:10 +01:00
parent 49dcd92a9e
commit a9cedba4e0
13 changed files with 44 additions and 26 deletions

View File

@ -14,7 +14,7 @@ export class BaseStorage<T extends { id: string }> {
async add(item: T, overwrite = false) {
try {
const existing = await this.get(item.id)
const existing = await this.getById(item.id)
if (existing && !overwrite) return
await this.dexie.table(this.tableName).put({ ...item })
@ -39,7 +39,7 @@ export class BaseStorage<T extends { id: string }> {
}
}
async get(id: string): Promise<T | null> {
async getById(id: string): Promise<T | null> {
try {
const item = await this.dexie.table(this.tableName).get(id)
return item || null

View File

@ -31,7 +31,7 @@ export class CharacterTypeStorage extends BaseStorage<any> {
}
async getSpriteId(characterTypeId: string) {
const characterType = await this.get(characterTypeId)
const characterType = await this.getById(characterTypeId)
return characterType?.sprite
}
}
@ -42,7 +42,7 @@ export class CharacterHairStorage extends BaseStorage<any> {
}
async getSpriteId(characterTypeId: string) {
const characterType = await this.get(characterTypeId)
const characterType = await this.getById(characterTypeId)
return characterType?.sprite
}
}