mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Slint fixes applied
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user