2024-04-16 23:36:57 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use Illuminate\Http\Request;
|
2024-08-31 00:14:15 +02:00
|
|
|
use App\Services\Upkeep\InitService;
|
|
|
|
use App\Services\Upkeep\ResetService;
|
2024-04-16 23:36:57 +02:00
|
|
|
|
|
|
|
class InitAPIController extends Controller
|
|
|
|
{
|
|
|
|
protected $init;
|
2024-07-03 01:09:27 +02:00
|
|
|
protected $reset;
|
2024-04-16 23:36:57 +02:00
|
|
|
|
2024-07-03 01:09:27 +02:00
|
|
|
public function __construct(InitService $initService, ResetService $resetService)
|
2024-04-16 23:36:57 +02:00
|
|
|
{
|
2024-07-03 01:09:27 +02:00
|
|
|
$this->init = $initService;
|
|
|
|
$this->reset = $resetService;
|
2024-04-16 23:36:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//init stuff
|
|
|
|
public function setupFresh(Request $request)
|
|
|
|
{
|
|
|
|
$result = $this->init->fresh(json_decode($request->getContent()));
|
|
|
|
return response()->json($result)->header('Content-Type', 'application/json');
|
|
|
|
}
|
2024-04-18 22:36:05 +02:00
|
|
|
|
|
|
|
public function setupRestore(Request $request)
|
|
|
|
{
|
|
|
|
$result = $this->init->restore($request);
|
|
|
|
return response()->json($result)->header('Content-Type', 'application/json');
|
|
|
|
}
|
2024-07-03 01:09:27 +02:00
|
|
|
|
|
|
|
public function setupReset(Request $request)
|
|
|
|
{
|
|
|
|
$result = $this->reset->site($request);
|
|
|
|
return response()->json($result)->header('Content-Type', 'application/json');
|
|
|
|
}
|
2024-04-16 23:36:57 +02:00
|
|
|
}
|