Mod: Set get method for membership

This commit is contained in:
Philipp Lang 2023-10-16 12:52:59 +02:00
parent 1fb2dd19e7
commit 356a69507e
5 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
use Lorisleiva\Actions\Concerns\AsAction;
class ApiIndexAction
class IndexAction
{
use AsAction;

View File

@ -16,7 +16,7 @@ export function useApiIndex(url, siteName) {
page: resetPage ? 1 : inner.meta.value.current_page,
};
var response = (await axios.post(url, params)).data;
var response = (await axios.get(url, params)).data;
inner.data.value = response.data;
inner.meta.value = response.meta;
}

View File

@ -35,7 +35,7 @@ use App\Member\Actions\MemberResyncAction;
use App\Member\Actions\MemberShowAction;
use App\Member\Actions\SearchAction;
use App\Member\MemberController;
use App\Membership\Actions\ApiIndexAction;
use App\Membership\Actions\IndexAction as MembershipIndexAction;
use App\Membership\Actions\ListForGroupAction;
use App\Membership\Actions\MembershipDestroyAction;
use App\Membership\Actions\MembershipStoreAction;
@ -108,10 +108,10 @@ Route::group(['middleware' => 'auth:web'], function (): void {
Route::post('/api/member/{member}/payment', PaymentApiIndexAction::class)->name('member.payment.index');
// --------------------------------- membership --------------------------------
Route::get('/member/{member}/membership', MembershipIndexAction::class)->name('member.membership.index');
Route::post('/member/{member}/membership', MembershipStoreAction::class)->name('member.membership.store');
Route::patch('/membership/{membership}', MembershipUpdateAction::class)->name('membership.update');
Route::delete('/membership/{membership}', MembershipDestroyAction::class)->name('membership.destroy');
Route::post('/api/membership/member-list', ListForGroupAction::class)->name('membership.member-list');
Route::post('/api/membership/sync', StoreForGroupAction::class)->name('membership.sync');
Route::post('/api/member/{member}/membership', ApiIndexAction::class)->name('member.membership.index');
});

View File

@ -36,7 +36,7 @@ class IndexTest extends TestCase
$this->assertInertiaHas('Kölner Str 3, 33333 Hilden', $response, 'data.data.0.full_address');
$this->assertInertiaHas($group->id, $response, 'data.data.0.group_id');
$this->assertInertiaHas(null, $response, 'data.data.0.memberships');
$this->assertInertiaHas(url("/api/member/{$member->id}/membership"), $response, 'data.data.0.links.membership_index');
$this->assertInertiaHas(url("/member/{$member->id}/membership"), $response, 'data.data.0.links.membership_index');
$this->assertInertiaHas(url("/api/member/{$member->id}/payment"), $response, 'data.data.0.links.payment_index');
$this->assertInertiaHas([
'id' => $member->subscription->id,

View File

@ -26,7 +26,7 @@ class IndexTest extends TestCase
->create();
$membership = $member->memberships->first();
$this->postJson("/api/member/{$member->id}/membership")
$this->get("/member/{$member->id}/membership")
->assertJsonPath('data.0.activity_id', $membership->activity_id)
->assertJsonPath('data.0.subactivity_id', $membership->subactivity_id)
->assertJsonPath('data.0.activity_name', '€ Mitglied')
@ -62,7 +62,7 @@ class IndexTest extends TestCase
->has(Membership::factory()->in('€ LeiterIn', 455, 'Pfadfinder', 15)->state(['from' => $from, 'to' => $to]))
->create();
$this->postJson("/api/member/{$member->id}/membership")
$this->get("/member/{$member->id}/membership")
->assertJsonPath('data.0.is_active', $isActive);
}
}