Rollback initializer
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
3f3d500c82
commit
fc5a74ac6e
|
@ -60,6 +60,6 @@ class InitializeAction
|
||||||
(int) $request->input('group_id', 0)
|
(int) $request->input('group_id', 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
return redirect()->route('home');
|
return redirect()->route('home')->success('Initialisierung beauftragt. Wir benachrichtigen dich per Mail wenn alles fertig ist.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeActivities
|
class InitializeActivities
|
||||||
|
@ -18,4 +19,11 @@ class InitializeActivities
|
||||||
$groupId = $this->api->groups()->first()->id;
|
$groupId = $this->api->groups()->first()->id;
|
||||||
app(ActivityCreator::class)->createFor($this->api, $groupId);
|
app(ActivityCreator::class)->createFor($this->api, $groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('activity_subactivity')->delete();
|
||||||
|
DB::table('activities')->delete();
|
||||||
|
DB::table('subactivities')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
use App\Confession;
|
use App\Confession;
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeConfessions
|
class InitializeConfessions
|
||||||
|
@ -21,4 +22,9 @@ class InitializeConfessions
|
||||||
Confession::create(['nami_id' => $confession->id, 'name' => $confession->name, 'is_null' => $this->nullName === $confession->name]);
|
Confession::create(['nami_id' => $confession->id, 'name' => $confession->name, 'is_null' => $this->nullName === $confession->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('confessions')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeCountries
|
class InitializeCountries
|
||||||
|
@ -19,4 +20,9 @@ class InitializeCountries
|
||||||
\App\Country::create(['nami_id' => $country->id, 'name' => $country->name]);
|
\App\Country::create(['nami_id' => $country->id, 'name' => $country->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('countries')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
use App\Course\Models\Course;
|
use App\Course\Models\Course;
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeCourses
|
class InitializeCourses
|
||||||
|
@ -20,4 +21,9 @@ class InitializeCourses
|
||||||
Course::create(['nami_id' => $course->id, 'name' => $course->name]);
|
Course::create(['nami_id' => $course->id, 'name' => $course->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('courses')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
use App\Fee;
|
use App\Fee;
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeFees
|
class InitializeFees
|
||||||
|
@ -25,4 +26,10 @@ class InitializeFees
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('subscriptions')->delete();
|
||||||
|
DB::table('fees')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeGenders
|
class InitializeGenders
|
||||||
|
@ -19,4 +20,9 @@ class InitializeGenders
|
||||||
\App\Gender::create(['nami_id' => $gender->id, 'name' => $gender->name]);
|
\App\Gender::create(['nami_id' => $gender->id, 'name' => $gender->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('genders')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
use App\Group;
|
use App\Group;
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeGroups
|
class InitializeGroups
|
||||||
|
@ -30,4 +31,9 @@ class InitializeGroups
|
||||||
$this->syncChildren($subgroup->id, $newParent);
|
$this->syncChildren($subgroup->id, $newParent);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('groups')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
@ -24,4 +25,9 @@ class InitializeJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
app(Initializer::class)->run();
|
app(Initializer::class)->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function failed(Exception $e): void
|
||||||
|
{
|
||||||
|
app(Initializer::class)->restore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
use App\Actions\MemberPullAction;
|
use App\Actions\MemberPullAction;
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
use Zoomyboy\LaravelNami\Member as NamiMember;
|
use Zoomyboy\LaravelNami\Member as NamiMember;
|
||||||
|
|
||||||
|
@ -23,4 +24,12 @@ class InitializeMembers
|
||||||
fn (NamiMember $member) => app(MemberPullAction::class)->api($this->api)->member($member->group_id, $member->id)->execute()
|
fn (NamiMember $member) => app(MemberPullAction::class)->api($this->api)->member($member->group_id, $member->id)->execute()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('payments')->delete();
|
||||||
|
DB::table('course_members')->delete();
|
||||||
|
DB::table('memberships')->delete();
|
||||||
|
DB::table('members')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
use App\Nationality;
|
use App\Nationality;
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeNationalities
|
class InitializeNationalities
|
||||||
|
@ -20,4 +21,9 @@ class InitializeNationalities
|
||||||
Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->name]);
|
Nationality::create(['nami_id' => $nationality->id, 'name' => $nationality->name]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('nationalities')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Initialize;
|
namespace App\Initialize;
|
||||||
|
|
||||||
|
use DB;
|
||||||
use Zoomyboy\LaravelNami\Api;
|
use Zoomyboy\LaravelNami\Api;
|
||||||
|
|
||||||
class InitializeRegions
|
class InitializeRegions
|
||||||
|
@ -20,4 +21,9 @@ class InitializeRegions
|
||||||
\App\Region::create(['nami_id' => $region->id, 'name' => $region->name, 'is_null' => $region->name == $this->nullName]);
|
\App\Region::create(['nami_id' => $region->id, 'name' => $region->name, 'is_null' => $region->name == $this->nullName]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
DB::table('regions')->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,9 @@ class Initializer
|
||||||
{
|
{
|
||||||
public NamiSettings $settings;
|
public NamiSettings $settings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<int, class-string>
|
||||||
|
*/
|
||||||
public array $initializers = [
|
public array $initializers = [
|
||||||
InitializeGroups::class,
|
InitializeGroups::class,
|
||||||
InitializeNationalities::class,
|
InitializeNationalities::class,
|
||||||
|
@ -32,4 +35,17 @@ class Initializer
|
||||||
app($initializer)->handle($this->settings->login());
|
app($initializer)->handle($this->settings->login());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function restore(): void
|
||||||
|
{
|
||||||
|
foreach (array_reverse($this->initializers) as $initializer) {
|
||||||
|
app($initializer)->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings = app(NamiSettings::class);
|
||||||
|
$settings->mglnr = 0;
|
||||||
|
$settings->password = '';
|
||||||
|
$settings->default_group_id = 0;
|
||||||
|
$settings->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue