diff --git a/app/Api/V1/Requests/RecurrenceStoreRequest.php b/app/Api/V1/Requests/RecurrenceStoreRequest.php index 45c5461944..d6118052e2 100644 --- a/app/Api/V1/Requests/RecurrenceStoreRequest.php +++ b/app/Api/V1/Requests/RecurrenceStoreRequest.php @@ -66,8 +66,6 @@ class RecurrenceStoreRequest extends Request 'active' => [new IsBoolean], 'repeat_until' => sprintf('date|after:%s', $today->format('Y-m-d')), 'nr_of_repetitions' => 'numeric|between:1,31', - 'tags' => 'between:1,64000', - 'piggy_bank_id' => 'numeric', 'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly', 'repetitions.*.moment' => 'between:0,10', 'repetitions.*.skip' => 'required|numeric|between:0,31', @@ -79,12 +77,18 @@ class RecurrenceStoreRequest extends Request 'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code', 'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id', 'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code', - 'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser], - 'transactions.*.category_name' => 'between:1,255|nullable', 'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser], 'transactions.*.source_name' => 'between:1,255|nullable', 'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser], 'transactions.*.destination_name' => 'between:1,255|nullable', + + // new and updated fields: + 'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser], + 'transactions.*.budget_name' => 'between:1,255|nullable', + 'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser], + 'transactions.*.category_name' => 'between:1,255|nullable', + 'transactions.*.tags' => 'between:1,64000', + 'transactions.*.piggy_bank_id' => ['numeric', 'mustExist:piggy_banks,id', new BelongsUser], ]; } diff --git a/app/Api/V1/Requests/RecurrenceUpdateRequest.php b/app/Api/V1/Requests/RecurrenceUpdateRequest.php index 3a5e4f603e..0cc0c3f983 100644 --- a/app/Api/V1/Requests/RecurrenceUpdateRequest.php +++ b/app/Api/V1/Requests/RecurrenceUpdateRequest.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Requests; -use Carbon\Carbon; use FireflyIII\Models\Recurrence; use FireflyIII\Rules\BelongsUser; use FireflyIII\Rules\IsBoolean; @@ -70,8 +69,6 @@ class RecurrenceUpdateRequest extends Request 'active' => [new IsBoolean], 'repeat_until' => sprintf('date|after:%s', $first->format('Y-m-d')), 'nr_of_repetitions' => 'numeric|between:1,31', - 'tags' => 'between:1,64000', - 'piggy_bank_id' => 'numeric', 'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly', 'repetitions.*.moment' => 'between:0,10', 'repetitions.*.skip' => 'required|numeric|between:0,31', @@ -83,12 +80,18 @@ class RecurrenceUpdateRequest extends Request 'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code', 'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id', 'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code', - 'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser], - 'transactions.*.category_name' => 'between:1,255|nullable', 'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser], 'transactions.*.source_name' => 'between:1,255|nullable', 'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser], 'transactions.*.destination_name' => 'between:1,255|nullable', + + // new and updated fields: + 'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser], + 'transactions.*.budget_name' => 'between:1,255|nullable', + 'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser], + 'transactions.*.category_name' => 'between:1,255|nullable', + 'transactions.*.tags' => 'between:1,64000', + 'transactions.*.piggy_bank_id' => ['numeric', 'mustExist:piggy_banks,id', new BelongsUser], ]; }