mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
All API routes seem to work.
This commit is contained in:
parent
2ab44fb33a
commit
7171e69715
@ -169,6 +169,8 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Update account.
|
||||
*
|
||||
* @param AccountRequest $request
|
||||
* @param Account $account
|
||||
*
|
||||
|
@ -80,7 +80,7 @@ class TransactionController extends Controller
|
||||
public function delete(Transaction $transaction)
|
||||
{
|
||||
$journal = $transaction->transactionJournal;
|
||||
$this->repository->delete($journal);
|
||||
$this->repository->destroy($journal);
|
||||
|
||||
return response()->json([], 204);
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ class AccountRequest extends Request
|
||||
'name' => $this->string('name'),
|
||||
'active' => $this->boolean('active'),
|
||||
'accountType' => $this->string('type'),
|
||||
'account_type_id' => null,
|
||||
'currency_id' => $this->integer('currency_id'),
|
||||
'currency_code' => $this->string('currency_code'),
|
||||
'virtualBalance' => $this->string('virtual_balance'),
|
||||
@ -97,6 +98,7 @@ class AccountRequest extends Request
|
||||
$account = $this->route()->parameter('account');
|
||||
$rules['name'] .= ':' . $account->id;
|
||||
$rules['account_number'] .= ':' . $account->id;
|
||||
$rules['type'] = 'in:' . $types;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -108,8 +108,8 @@ class BillRequest extends Request
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
$data = $validator->getData();
|
||||
$min = floatval($data['amount_min']);
|
||||
$max = floatval($data['amount_max']);
|
||||
$min = floatval($data['amount_min'] ?? 0);
|
||||
$max = floatval($data['amount_max'] ?? 0);
|
||||
if ($min > $max) {
|
||||
$validator->errors()->add('amount_min', trans('validation.amount_min_over_max'));
|
||||
}
|
||||
|
@ -77,8 +77,9 @@ class Handler extends ExceptionHandler
|
||||
return response()->json(['message' => 'Unauthenticated', 'exception' => 'AuthenticationException'], 401);
|
||||
}
|
||||
|
||||
|
||||
if ($request->expectsJson()) {
|
||||
$isDebug = env('APP_DEBUG', false);
|
||||
$isDebug = config('app.debug', false);
|
||||
if ($isDebug) {
|
||||
return response()->json(
|
||||
[
|
||||
|
@ -216,6 +216,7 @@ trait TransactionServiceTrait
|
||||
protected function setBudget(Transaction $transaction, ?Budget $budget): void
|
||||
{
|
||||
if (is_null($budget)) {
|
||||
$transaction->budgets()->sync([]);
|
||||
return;
|
||||
}
|
||||
$transaction->budgets()->sync([$budget->id]);
|
||||
@ -231,6 +232,7 @@ trait TransactionServiceTrait
|
||||
protected function setCategory(Transaction $transaction, ?Category $category): void
|
||||
{
|
||||
if (is_null($category)) {
|
||||
$transaction->categories()->sync([]);
|
||||
return;
|
||||
}
|
||||
$transaction->categories()->sync([$category->id]);
|
||||
|
@ -64,7 +64,7 @@ class TransactionControllerTest extends TestCase
|
||||
|
||||
// mock calls:
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
$repository->shouldReceive('delete')->once()->andReturn(true);
|
||||
$repository->shouldReceive('destroy')->once()->andReturn(true);
|
||||
|
||||
// get account:
|
||||
$transaction = $this->user()->transactions()->first();
|
||||
|
Loading…
Reference in New Issue
Block a user