Improve getSubscriptions endpoint
This commit is contained in:
parent
06f04a887a
commit
b046f34019
|
@ -689,7 +689,7 @@ class InsuranceSubscriptionController extends Controller
|
||||||
* required=true,
|
* required=true,
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* type="string",
|
* type="string",
|
||||||
* enum={"ALL","EDITABLE"}
|
* enum={"ALL","ACCEPTED"}
|
||||||
* )
|
* )
|
||||||
* ),
|
* ),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
|
@ -716,7 +716,7 @@ class InsuranceSubscriptionController extends Controller
|
||||||
{
|
{
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'user_id' => 'nullable|integer|exists:users,id',
|
'user_id' => 'nullable|integer|exists:users,id',
|
||||||
'type' => 'nullable|in:ALL,EDITABLE'
|
'type' => 'nullable|in:ALL,ACCEPTED'
|
||||||
]);
|
]);
|
||||||
$user = User::findOrFail($request->input('user_id'));
|
$user = User::findOrFail($request->input('user_id'));
|
||||||
$currency_code = $user->network->country->currency_code;
|
$currency_code = $user->network->country->currency_code;
|
||||||
|
@ -728,8 +728,8 @@ class InsuranceSubscriptionController extends Controller
|
||||||
}
|
}
|
||||||
if ($request->has('type')) {
|
if ($request->has('type')) {
|
||||||
$type = $request->input('type');
|
$type = $request->input('type');
|
||||||
if ($type == 'EDITABLE') {
|
if ($type != 'ALL') {
|
||||||
$query = $query->whereIn('state', [InsuranceSubscriptionState::UNDER_VALIDATION, InsuranceSubscriptionState::ACCEPTED]);
|
$query = $query->whereIn('state', $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue