Slint fixes applied

This commit is contained in:
Rafael Garcia
2023-05-15 09:41:33 -05:00
parent 464ffd23b4
commit 3ac29e131d
7 changed files with 327 additions and 338 deletions

View File

@@ -1,31 +1,32 @@
export class ObjectRepository<T extends object> {
readonly entityMap: Map<string, T>
readonly entityMap: Map<string, T>
constructor(entities: Record<string, T> = {}) {
this.entityMap = new Map(Object.entries(entities))
}
constructor(entities: Record<string, T> = {}) {
this.entityMap = new Map(Object.entries(entities))
}
findById(id: string) {
return this.entityMap.get(id)
}
findById(id: string) {
return this.entityMap.get(id)
}
findAll() {
return Array.from(this.entityMap.values())
}
findAll() {
return Array.from(this.entityMap.values())
}
upsertById(id: string, entity: T) {
return this.entityMap.set(id, { ...entity })
}
upsertById(id: string, entity: T) {
return this.entityMap.set(id, { ...entity })
}
deleteById(id: string) {
return this.entityMap.delete(id)
}
deleteById(id: string) {
return this.entityMap.delete(id)
}
count() {
return this.entityMap.size
}
count() {
return this.entityMap.size
}
toJSON() {
return this.findAll()
}
toJSON() {
return this.findAll()
}
}