mirror of
https://github.com/hackku21/loc-chain-backend.git
synced 2024-10-27 20:34:03 +00:00
Include firebase ID on resource
This commit is contained in:
parent
e569841356
commit
f797cd0e25
@ -52,9 +52,17 @@ export class FirebaseResource<T extends FirebaseResourceItem> extends Iterable<T
|
||||
})
|
||||
}
|
||||
|
||||
protected resolveObject(snapshot: object | null | undefined) {
|
||||
protected resolveObject(snapshot: any | null | undefined) {
|
||||
if ( !snapshot ) snapshot = {}
|
||||
return Object.values(snapshot)
|
||||
|
||||
const returns: T[] = []
|
||||
for ( const key in snapshot ) {
|
||||
if ( !snapshot.hasOwnProperty(key) ) continue
|
||||
snapshot[key].firebaseID = key
|
||||
returns.push(snapshot[key])
|
||||
}
|
||||
|
||||
return returns
|
||||
}
|
||||
|
||||
clone(): Iterable<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user