add return values to backend docstring,

fix return values of all backends
This commit is contained in:
2024-06-04 23:09:55 +00:00
parent b12f38e608
commit 01f55aa0cb
6 changed files with 64 additions and 83 deletions

View File

@@ -37,9 +37,19 @@ export default class LocalDB extends DB_BACKEND {
addUser (user, attributes, params = null) {
const username = `${user.id}@${user.realm}`;
attributes = attributes || this.#defaultuser;
this.#data.users[username] = attributes;
this.#save();
if (this.#data.users[username]) { // user already exists
return {
ok: false,
status: 1,
message: "User already exists"
};
}
else {
attributes = attributes || this.#defaultuser;
this.#data.users[username] = attributes;
this.#save();
return null;
}
}
getUser (user, params = null) {