Drop a specific preference from the return of Firefly III

This commit is contained in:
James Cole
2024-04-18 05:54:57 +02:00
parent e16645ae87
commit 4a783d3c3c
2 changed files with 14 additions and 0 deletions

View File

@@ -84,6 +84,10 @@ class PreferencesController extends Controller
{
$manager = $this->getManager();
if('currencyPreference' === $preference->name) {
throw new FireflyException('Please use api/v1/currencies/default instead.');
}
/** @var PreferenceTransformer $transformer */
$transformer = app(PreferenceTransformer::class);
$transformer->setParameters($this->parameters);
@@ -103,6 +107,11 @@ class PreferencesController extends Controller
{
$manager = $this->getManager();
$data = $request->getAll();
if('currencyPreference' === $data['name']) {
throw new FireflyException('Please use api/v1/currencies/default instead.');
}
$pref = app('preferences')->set($data['name'], $data['data']);
/** @var PreferenceTransformer $transformer */
@@ -122,6 +131,10 @@ class PreferencesController extends Controller
*/
public function update(PreferenceUpdateRequest $request, Preference $preference): JsonResponse
{
if('currencyPreference' === $preference->name) {
throw new FireflyException('Please use api/v1/currencies/default instead.');
}
$manager = $this->getManager();
$data = $request->getAll();
$pref = app('preferences')->set($preference->name, $data['data']);