Rename Group actions

This commit is contained in:
Philipp Lang 2023-10-16 12:36:56 +02:00
parent 767239fb62
commit 1fb2dd19e7
4 changed files with 11 additions and 11 deletions

View File

@ -7,7 +7,7 @@ use Illuminate\Http\JsonResponse;
use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction; use Lorisleiva\Actions\Concerns\AsAction;
class ApiListAction class ListForGroupAction
{ {
use AsAction; use AsAction;

View File

@ -15,7 +15,7 @@ use Illuminate\Support\Facades\DB;
use Lorisleiva\Actions\ActionRequest; use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction; use Lorisleiva\Actions\Concerns\AsAction;
class SyncAction class StoreForGroupAction
{ {
use AsAction; use AsAction;
use TracksJob; use TracksJob;

View File

@ -36,11 +36,11 @@ use App\Member\Actions\MemberShowAction;
use App\Member\Actions\SearchAction; use App\Member\Actions\SearchAction;
use App\Member\MemberController; use App\Member\MemberController;
use App\Membership\Actions\ApiIndexAction; use App\Membership\Actions\ApiIndexAction;
use App\Membership\Actions\ApiListAction; use App\Membership\Actions\ListForGroupAction;
use App\Membership\Actions\MembershipDestroyAction; use App\Membership\Actions\MembershipDestroyAction;
use App\Membership\Actions\MembershipStoreAction; use App\Membership\Actions\MembershipStoreAction;
use App\Membership\Actions\MembershipUpdateAction; use App\Membership\Actions\MembershipUpdateAction;
use App\Membership\Actions\SyncAction; use App\Membership\Actions\StoreForGroupAction;
use App\Payment\Actions\AllpaymentPageAction; use App\Payment\Actions\AllpaymentPageAction;
use App\Payment\Actions\AllpaymentStoreAction; use App\Payment\Actions\AllpaymentStoreAction;
use App\Payment\Actions\ApiIndexAction as PaymentApiIndexAction; use App\Payment\Actions\ApiIndexAction as PaymentApiIndexAction;
@ -111,7 +111,7 @@ Route::group(['middleware' => 'auth:web'], function (): void {
Route::post('/member/{member}/membership', MembershipStoreAction::class)->name('member.membership.store'); Route::post('/member/{member}/membership', MembershipStoreAction::class)->name('member.membership.store');
Route::patch('/membership/{membership}', MembershipUpdateAction::class)->name('membership.update'); Route::patch('/membership/{membership}', MembershipUpdateAction::class)->name('membership.update');
Route::delete('/membership/{membership}', MembershipDestroyAction::class)->name('membership.destroy'); Route::delete('/membership/{membership}', MembershipDestroyAction::class)->name('membership.destroy');
Route::post('/api/membership/member-list', ApiListAction::class)->name('membership.member-list'); Route::post('/api/membership/member-list', ListForGroupAction::class)->name('membership.member-list');
Route::post('/api/membership/sync', SyncAction::class)->name('membership.sync'); Route::post('/api/membership/sync', StoreForGroupAction::class)->name('membership.sync');
Route::post('/api/member/{member}/membership', ApiIndexAction::class)->name('member.membership.index'); Route::post('/api/member/{member}/membership', ApiIndexAction::class)->name('member.membership.index');
}); });

View File

@ -9,7 +9,7 @@ use App\Member\Member;
use App\Member\Membership; use App\Member\Membership;
use App\Membership\Actions\MembershipDestroyAction; use App\Membership\Actions\MembershipDestroyAction;
use App\Membership\Actions\MembershipStoreAction; use App\Membership\Actions\MembershipStoreAction;
use App\Membership\Actions\SyncAction; use App\Membership\Actions\StoreForGroupAction;
use App\Subactivity; use App\Subactivity;
use Illuminate\Foundation\Testing\DatabaseMigrations; use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Support\Facades\Queue; use Illuminate\Support\Facades\Queue;
@ -37,7 +37,7 @@ class SyncActionTest extends TestCase
'subactivity_id' => $subactivity->id, 'subactivity_id' => $subactivity->id,
'group_id' => $group->id, 'group_id' => $group->id,
]); ]);
SyncAction::assertPushed(fn ($action, $params) => $params[0]->is($group) && $params[1]->is($activity) && $params[2]->is($subactivity) && $params[3][0] === $member->id); StoreForGroupAction::assertPushed(fn ($action, $params) => $params[0]->is($group) && $params[1]->is($activity) && $params[2]->is($subactivity) && $params[3][0] === $member->id);
} }
public function testItCreatesAMembership(): void public function testItCreatesAMembership(): void
@ -49,7 +49,7 @@ class SyncActionTest extends TestCase
$subactivity = Subactivity::factory()->create(); $subactivity = Subactivity::factory()->create();
$group = Group::factory()->create(); $group = Group::factory()->create();
SyncAction::run($group, $activity, $subactivity, [$member->id]); StoreForGroupAction::run($group, $activity, $subactivity, [$member->id]);
} }
public function testItDeletesAMembership(): void public function testItDeletesAMembership(): void
@ -60,7 +60,7 @@ class SyncActionTest extends TestCase
$member = Member::factory()->defaults()->has(Membership::factory()->inLocal('Leiter*in', 'Rover'))->create(); $member = Member::factory()->defaults()->has(Membership::factory()->inLocal('Leiter*in', 'Rover'))->create();
SyncAction::run($member->memberships->first()->group, $member->memberships->first()->activity, $member->memberships->first()->subactivity, []); StoreForGroupAction::run($member->memberships->first()->group, $member->memberships->first()->activity, $member->memberships->first()->subactivity, []);
} }
public function testItRollsbackWhenDeletionFails(): void public function testItRollsbackWhenDeletionFails(): void
@ -78,7 +78,7 @@ class SyncActionTest extends TestCase
->create(); ->create();
try { try {
SyncAction::run($member->memberships->first()->group, $member->memberships->first()->activity, $member->memberships->first()->subactivity, []); StoreForGroupAction::run($member->memberships->first()->group, $member->memberships->first()->activity, $member->memberships->first()->subactivity, []);
} catch (Throwable $e) { } catch (Throwable $e) {
} }
$this->assertDatabaseCount('memberships', 2); $this->assertDatabaseCount('memberships', 2);