Firebase stub: added support for filtering of resumes by user

This commit is contained in:
gianantoniopini
2021-01-06 17:03:46 +01:00
parent c667c31737
commit 176ba0de7a
3 changed files with 36 additions and 6 deletions

View File

@ -241,11 +241,23 @@ class Reference {
return databaseData;
}
let data = null;
if (
this.#path === Reference.resumesPath ||
this.#path === Reference.usersPath
) {
return this.#path in databaseData ? databaseData[this.#path] : null;
data = this.#path in databaseData ? databaseData[this.#path] : null;
if (data && this.#orderByChildPath && this.#equalToValue) {
return Object.fromEntries(
Object.entries(data).filter(
([key, value]) =>
value[this.#orderByChildPath] === this.#equalToValue,
),
);
}
return data;
}
if (