mirror of
https://gitlab.linphone.org/BC/public/flexisip-account-manager.git
synced 2026-01-17 01:58:07 +00:00
Fix FLEXIAPI-431 Complete missing admin account dictionnary documentation
This commit is contained in:
parent
f883c3cee7
commit
85c939b4da
4 changed files with 54 additions and 4 deletions
|
|
@ -58,4 +58,10 @@ class DictionaryController extends Controller
|
|||
return $request->space->accounts()
|
||||
->findOrFail($accountId)->dictionaryEntries()->where('key', $key)->delete();
|
||||
}
|
||||
|
||||
public function clear(Request $request, int $accountId)
|
||||
{
|
||||
return $request->space->accounts()
|
||||
->findOrFail($accountId)->dictionaryEntries()->delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,16 @@
|
|||
|
||||
Get all the account dictionary entries.
|
||||
|
||||
### `DELETE /accounts/{id}/dictionary/clear`
|
||||
<span class="badge badge-warning">Admin</span>
|
||||
|
||||
Clear all the account dictionary entries.
|
||||
|
||||
### `GET /accounts/{id}/dictionary/{key}`
|
||||
<span class="badge badge-warning">Admin</span>
|
||||
|
||||
Get an account dictionary entry.
|
||||
|
||||
### `POST /accounts/{id}/dictionary/{key}`
|
||||
<span class="badge badge-warning">Admin</span>
|
||||
|
||||
|
|
@ -13,3 +23,8 @@ Add or update a new entry to the dictionary
|
|||
JSON parameters:
|
||||
|
||||
* `value` **required**, the entry value
|
||||
|
||||
### `DELETE /accounts/{id}/dictionary/{key}`
|
||||
<span class="badge badge-warning">Admin</span>
|
||||
|
||||
Delete an account dictionary entry.
|
||||
|
|
@ -190,6 +190,7 @@ Route::group(['middleware' => ['auth.jwt', 'auth.digest_or_key', 'auth.check_blo
|
|||
|
||||
Route::prefix('accounts/{id}/dictionary')->controller(DictionaryController::class)->group(function () {
|
||||
Route::get('/', 'index');
|
||||
Route::delete('/', 'clear');
|
||||
Route::get('{key}', 'show');
|
||||
Route::post('{key}', 'set');
|
||||
Route::delete('{key}', 'destroy');
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class ApiAccountDictionaryTest extends TestCase
|
|||
$this->keyAuthenticated($admin)
|
||||
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
->assertExactJson([
|
||||
$key => $newValue
|
||||
]);
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ class ApiAccountDictionaryTest extends TestCase
|
|||
$this->keyAuthenticated($admin)
|
||||
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
->assertExactJson([
|
||||
$key => $newValue,
|
||||
$secondKey => $newValue
|
||||
]);
|
||||
|
|
@ -106,8 +106,36 @@ class ApiAccountDictionaryTest extends TestCase
|
|||
$this->keyAuthenticated($admin)
|
||||
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||
->assertStatus(200)
|
||||
->assertJson([
|
||||
->assertExactJson([
|
||||
$secondKey => $newValue
|
||||
]);
|
||||
|
||||
// Clear
|
||||
$this->keyAuthenticated($admin)
|
||||
->json($this->method, $this->route . '/' . $account->id . '/dictionary/' . $key, [
|
||||
'value' => $value
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->keyAuthenticated($admin)
|
||||
->json($this->method, $this->route . '/' . $account->id . '/dictionary/' . $secondKey, [
|
||||
'value' => $newValue
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->keyAuthenticated($admin)
|
||||
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||
->assertStatus(200)
|
||||
->assertExactJson([
|
||||
$key => $value,
|
||||
$secondKey => $newValue
|
||||
]);
|
||||
|
||||
$this->keyAuthenticated($admin)
|
||||
->delete($this->route . '/' . $account->id . '/dictionary/')
|
||||
->assertStatus(200);
|
||||
|
||||
$this->keyAuthenticated($admin)
|
||||
->get($this->route . '/' . $account->id . '/dictionary/')
|
||||
->assertStatus(200)
|
||||
->assertExactJson([]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue