Add member resync
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2022-04-29 00:57:24 +02:00
parent 8363105dcc
commit 29f4495265
3 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,21 @@
<?php
namespace App\Member\Controllers;
use App\Actions\MemberPullAction;
use App\Http\Controllers\Controller;
use App\Member\Member;
use App\Setting\NamiSettings;
use Illuminate\Http\RedirectResponse;
class MemberResyncController extends Controller
{
public function __invoke(Member $member, NamiSettings $settings): RedirectResponse
{
if ($member->hasNami) {
app(MemberPullAction::class)->api($settings->login())->member($member->group->nami_id, $member->nami_id)->execute();
}
return redirect()->route('member.edit', ['member' => $member])->success('Mitglied aktualisiert');
}
}

View File

@ -267,7 +267,9 @@ export default {
? this.$inertia.post(`/member`, this.inner) ? this.$inertia.post(`/member`, this.inner)
: this.$inertia.patch(`/member/${this.inner.id}`, this.inner); : this.$inertia.patch(`/member/${this.inner.id}`, this.inner);
}, },
resync() {}, resync() {
this.$inertia.get(`/member/${this.inner.id}/resync`);
},
forceWrite() {}, forceWrite() {},
}, },

View File

@ -3,6 +3,7 @@
use App\Course\Controllers\CourseController; use App\Course\Controllers\CourseController;
use App\Http\Controllers\HomeController; use App\Http\Controllers\HomeController;
use App\Initialize\InitializeController; use App\Initialize\InitializeController;
use App\Member\Controllers\MemberResyncController;
use App\Member\MemberConfirmController; use App\Member\MemberConfirmController;
use App\Member\MemberController; use App\Member\MemberController;
use App\Membership\MembershipController; use App\Membership\MembershipController;
@ -34,4 +35,5 @@ Route::group(['middleware' => 'auth:web'], function (): void {
Route::resource('setting', SettingController::class); Route::resource('setting', SettingController::class);
Route::resource('member.course', CourseController::class); Route::resource('member.course', CourseController::class);
Route::get('/member/{member}/efz', MemberEfzController::class)->name('efz'); Route::get('/member/{member}/efz', MemberEfzController::class)->name('efz');
Route::get('/member/{member}/resync', MemberResyncController::class)->name('member.resync');
}); });