@samitouri / QOSami-HFS / commits / 15a3a4db

fix: del_account api was supposed to not return "errors" key in case of no error on array input (not used by UI at the moment)

Massimo Melina committed Oct 28, 2025 at 00:44 UTC 15a3a4db0f9defb74c33ccd07e69dc521069ff1a
2 files changed +2 -1
src/api.accounts.ts
+1 -1
@@ -83,7 +83,7 @@ export default {
83 del_account({ username }) {
84 apiAssertTypes({ string_array: { username } })
85 if (Array.isArray(username)) {
86 - const errors = objFromKeys(username, u => delAccount(u) ? undefined : HTTP_NOT_FOUND)
86 + const errors = _.pickBy(objFromKeys(username, u => delAccount(u) ? undefined : HTTP_NOT_FOUND))
87 return _.isEmpty(errors) ? {} : { errors }
88 }
89 return delAccount(username) ? {} : new ApiError(HTTP_NOT_FOUND)
tests/test.ts
+1
@@ -178,6 +178,7 @@ describe('accounts', () => {
178 const add = 'test-Add'
179 test('accounts.add', reqApi('add_account', { username: add, overwrite: true }, res => res?.username === add.toLowerCase()))
180 test('accounts.remove', reqApi('del_account', { username: add }, 200))
181 + test('accounts.remove array', reqApi('del_account', { username: [add] }, x => x.errors[add] === 404))
182 })
183
184 describe('after-login', () => {