Add API Docs
This commit is contained in:
parent
c40b027f4c
commit
a09294018a
|
@ -14,6 +14,9 @@ use App\Models\Option;
|
|||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
/**
|
||||
* Retrieve the info for the admin panel
|
||||
*/
|
||||
public function getInfo() {
|
||||
if(!request()->user()->hasPermission("admin-info-read")) abort(401);
|
||||
|
||||
|
@ -24,6 +27,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve DB info and stats
|
||||
*/
|
||||
public function getDBData() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-read")) abort(401);
|
||||
|
||||
|
@ -77,6 +83,9 @@ class AdminController extends Controller
|
|||
return response()->json($parsedOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run DB migrations
|
||||
*/
|
||||
public function runMigrations() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -86,6 +95,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run DB seeders (except for dummy data seeder)
|
||||
*/
|
||||
public function runSeeding() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -95,6 +107,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of jobs available in the app
|
||||
*/
|
||||
public function getJobsList() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-read")) abort(401);
|
||||
|
||||
|
@ -111,6 +126,9 @@ class AdminController extends Controller
|
|||
return response()->json($jobs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a specific job
|
||||
*/
|
||||
public function runJob(Request $request) {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -132,6 +150,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maintenance mode status
|
||||
*/
|
||||
public function getMaintenanceMode() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-read")) abort(401);
|
||||
|
||||
|
@ -142,6 +163,9 @@ class AdminController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable the maintenance mode
|
||||
*/
|
||||
public function updateMaintenanceMode(Request $request) {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -169,6 +193,9 @@ class AdminController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the optimization commands: cache config, events, routes
|
||||
*/
|
||||
public function runOptimization() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -187,6 +214,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the optimization cache
|
||||
*/
|
||||
public function clearOptimization() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -204,6 +234,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the application cache
|
||||
*/
|
||||
public function clearCache() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -214,6 +247,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypt the application .env file
|
||||
*/
|
||||
public function encryptEnvironment(Request $request) {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
$request->validate([
|
||||
|
@ -236,6 +272,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypt the application .env file
|
||||
*/
|
||||
public function decryptEnvironment(Request $request) {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
$request->validate([
|
||||
|
@ -261,6 +300,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the application .env file
|
||||
*/
|
||||
public function deleteEnvironment() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -274,6 +316,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Telegram bot debug info
|
||||
*/
|
||||
public function getTelegramBotDebugInfo() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -297,6 +342,9 @@ class AdminController extends Controller
|
|||
return response()->json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Telegram bot webhook, using the current app public URL
|
||||
*/
|
||||
public function setTelegramWebhook() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -307,6 +355,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the Telegram bot webhook
|
||||
*/
|
||||
public function unsetTelegramWebhook() {
|
||||
if(!request()->user()->hasPermission("admin-maintenance-update")) abort(401);
|
||||
|
||||
|
@ -317,12 +368,18 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of options, with their type, last update etc.
|
||||
*/
|
||||
public function getOptions() {
|
||||
if(!request()->user()->hasPermission("admin-options-read")) abort(401);
|
||||
|
||||
return response()->json(Option::all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an option value
|
||||
*/
|
||||
public function updateOption(Request $request, Option $option) {
|
||||
if(!request()->user()->hasPermission("admin-options-update")) abort(401);
|
||||
|
||||
|
@ -358,6 +415,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of permissions and roles
|
||||
*/
|
||||
public function getPermissionsAndRoles() {
|
||||
if(!request()->user()->hasPermission("admin-roles-read")) abort(401);
|
||||
return response()->json([
|
||||
|
@ -366,6 +426,9 @@ class AdminController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update role permissions
|
||||
*/
|
||||
public function updateRoles(Request $request) {
|
||||
if(!request()->user()->hasPermission("admin-roles-update")) abort(401);
|
||||
|
||||
|
|
|
@ -13,11 +13,14 @@ use Illuminate\Http\Request;
|
|||
class AlertController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* Display a list of all the alerts.
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
if(!request()->user()->hasPermission("alerts-read")) abort(401);
|
||||
$request->validate([
|
||||
'full' => 'boolean'
|
||||
]);
|
||||
return response()->json(
|
||||
request()->query('full', false) ?
|
||||
Alert::with(['crew.user' => function($query) {
|
||||
|
@ -36,15 +39,7 @@ class AlertController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* Add new Alert
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
@ -62,7 +57,7 @@ class AlertController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Get single Alert
|
||||
* Get single alert info by id
|
||||
*/
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
|
@ -79,15 +74,7 @@ class AlertController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Alert $Alert)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* Update alert data. You can update notes and closed status.
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,9 @@ use App\Utils\Logger;
|
|||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
/**
|
||||
* Register a new user
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
if(!$request->user()->hasPermission("users-create")) abort(401);
|
||||
|
@ -39,6 +42,10 @@ class AuthController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Login
|
||||
* @unauthenticated
|
||||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
|
@ -73,6 +80,9 @@ class AuthController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout
|
||||
*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
Logger::log("Logout");
|
||||
|
@ -91,6 +101,9 @@ class AuthController extends Controller
|
|||
return response()->json(null, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current user info and global options (so they can be loaded on frontend without additional requests)
|
||||
*/
|
||||
public function me(Request $request)
|
||||
{
|
||||
$impersonateManager = app('impersonate');
|
||||
|
@ -117,6 +130,9 @@ class AuthController extends Controller
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Impersonate another user
|
||||
*/
|
||||
public function impersonate(Request $request, User $user)
|
||||
{
|
||||
$authUser = User::find($request->user()->id);
|
||||
|
@ -162,6 +178,9 @@ class AuthController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop impersonating other user
|
||||
*/
|
||||
public function stopImpersonating(Request $request)
|
||||
{
|
||||
$manager = app('impersonate');
|
||||
|
@ -196,6 +215,9 @@ class AuthController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh token, if using sessions it will return a new session token
|
||||
*/
|
||||
public function refreshToken(Request $request)
|
||||
{
|
||||
if(
|
||||
|
|
|
@ -8,6 +8,9 @@ use App\Utils\Availability;
|
|||
|
||||
class AvailabilityController extends Controller
|
||||
{
|
||||
/**
|
||||
* Get the availability status of the user
|
||||
*/
|
||||
public function get(Request $request)
|
||||
{
|
||||
return [
|
||||
|
@ -16,6 +19,9 @@ class AvailabilityController extends Controller
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the availability status of an user (or the current user)
|
||||
*/
|
||||
public function updateAvailability(Request $request)
|
||||
{
|
||||
if($request->input("id") && $request->user()->id != $request->input("id")) {
|
||||
|
@ -28,6 +34,9 @@ class AvailabilityController extends Controller
|
|||
return Availability::updateAvailability($user, $request->input("available", false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the availability manual mode status of the current user
|
||||
*/
|
||||
public function updateAvailabilityManualMode(Request $request)
|
||||
{
|
||||
return Availability::updateAvailabilityManualMode($request->user(), $request->input("manual_mode", false));
|
||||
|
|
|
@ -11,6 +11,9 @@ use App\Utils\Logger;
|
|||
|
||||
class DocumentsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Upload driving license scan
|
||||
*/
|
||||
public function uploadDrivingLicenseScan(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
|
@ -40,6 +43,9 @@ class DocumentsController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serve driving license scan
|
||||
*/
|
||||
public function serveDrivingLicenseScan($uuid)
|
||||
{
|
||||
$document = DocumentFile::where('uuid', $uuid)->firstOrFail();
|
||||
|
@ -47,6 +53,9 @@ class DocumentsController extends Controller
|
|||
return response()->file(storage_path('app/public/' . $document->file_path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add training course data to user
|
||||
*/
|
||||
function addTrainingCourse(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
|
@ -92,6 +101,9 @@ class DocumentsController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serve training course document
|
||||
*/
|
||||
function serveTrainingCourse($uuid)
|
||||
{
|
||||
$document = DocumentFile::where('uuid', $uuid)->firstOrFail();
|
||||
|
@ -99,6 +111,9 @@ class DocumentsController extends Controller
|
|||
return response()->file(storage_path('app/public/' . $document->file_path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add medical examination data to user
|
||||
*/
|
||||
function addMedicalExamination(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
|
@ -144,6 +159,9 @@ class DocumentsController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serve medical examination document
|
||||
*/
|
||||
function serveMedicalExamination($uuid)
|
||||
{
|
||||
$document = DocumentFile::where('uuid', $uuid)->firstOrFail();
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class GenericController extends Controller
|
||||
{
|
||||
/**
|
||||
* Returns the owner image
|
||||
* @unauthenticated
|
||||
*/
|
||||
public function ownerImage(Request $request)
|
||||
{
|
||||
return response()
|
||||
->file(
|
||||
resource_path('images') . DIRECTORY_SEPARATOR . config("features.owner_image"),
|
||||
['Cache-control' => 'max-age=2678400']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pong message
|
||||
*/
|
||||
public function ping(Request $request)
|
||||
{
|
||||
return response()->json([
|
||||
'message' => 'pong'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute scheduled tasks
|
||||
*/
|
||||
public function executeCron(Request $request)
|
||||
{
|
||||
//Go to app/Console/Kernel.php to view schedules
|
||||
if(config('cron.external_cron_enabled') && $request->header('Cron') == config('cron.execution_code')) {
|
||||
Artisan::call('schedule:run');
|
||||
return response()->json([
|
||||
'message' => 'Cron executed'
|
||||
]);
|
||||
} else {
|
||||
return response('Access Denied', 403);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,12 +11,17 @@ use Carbon\Carbon;
|
|||
class LogsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* List all logs
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
User::where('id', $request->user()->id)->update(['last_access' => now()]);
|
||||
|
||||
$request->validate([
|
||||
'from' => 'date',
|
||||
'to' => 'date'
|
||||
]);
|
||||
|
||||
$query = Log::join('users as changed_user', 'changed_user.id', '=', 'logs.changed_id')
|
||||
->join('users as editor_user', 'editor_user.id', '=', 'logs.editor_id')
|
||||
->orderBy('created_at', 'desc');
|
||||
|
|
|
@ -30,6 +30,9 @@ class PlacesController extends Controller
|
|||
return response()->json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the regions of Italy.
|
||||
*/
|
||||
public function italyListRegions()
|
||||
{
|
||||
$seconds = 60 * 60 * 24 * 365 * 10; // 10 years
|
||||
|
@ -39,6 +42,9 @@ class PlacesController extends Controller
|
|||
return response()->json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the provinces of a region of Italy.
|
||||
*/
|
||||
public function italyListProvincesByRegion(Request $request, string $region_name)
|
||||
{
|
||||
$region_name = strtolower($region_name);
|
||||
|
@ -49,6 +55,9 @@ class PlacesController extends Controller
|
|||
return response()->json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the municipalities of a province of Italy.
|
||||
*/
|
||||
public function italyListMunicipalitiesByProvince(Request $request, string $province_name)
|
||||
{
|
||||
$province_name = strtolower($province_name);
|
||||
|
@ -59,6 +68,9 @@ class PlacesController extends Controller
|
|||
return response()->json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the place saved in DB with the given id.
|
||||
*/
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
User::where('id', $request->user()->id)->update(['last_access' => now()]);
|
||||
|
|
|
@ -10,7 +10,7 @@ use App\Utils\Logger;
|
|||
class ScheduleSlotsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* Return the schedule slots of the user
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ class ScheduleSlotsController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* Update the schedule slots of the user
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ use App\Utils\Helpers;
|
|||
class ServiceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* Show all Services
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
@ -255,7 +255,7 @@ class ServiceController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* Delete Service
|
||||
*/
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ use App\Utils\Logger;
|
|||
class ServiceTypeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* List all ServiceTypes.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ use Illuminate\Support\Carbon;
|
|||
class StatsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Get all services with all data
|
||||
* Get all services with all data, for usage in statistics page
|
||||
*/
|
||||
public function services(Request $request)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,9 @@ use App\Utils\Logger;
|
|||
|
||||
class TelegramController extends Controller
|
||||
{
|
||||
/**
|
||||
* Returns a link that the user can use to start the login process
|
||||
*/
|
||||
public function loginToken(Request $request)
|
||||
{
|
||||
//Get telegramBotUsername from the name of the first bot (first row)
|
||||
|
|
|
@ -12,7 +12,7 @@ use App\Utils\DBTricks;
|
|||
class TrainingController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* List all Trainings.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ class TrainingController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* Delete Training
|
||||
*/
|
||||
public function destroy(Request $request, $id)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,7 @@ use App\Utils\Logger;
|
|||
class TrainingCourseTypeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* List all TrainingCourseTypes.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ use Illuminate\Support\Facades\URL;
|
|||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* Return the list of users, used in main list.
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
@ -46,15 +46,7 @@ class UserController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
* Return a single user with all the details.
|
||||
*/
|
||||
public function show(Request $request, User $user)
|
||||
{
|
||||
|
@ -123,7 +115,7 @@ class UserController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* Update user data
|
||||
*/
|
||||
public function update(Request $request, User $user)
|
||||
{
|
||||
|
@ -235,6 +227,9 @@ class UserController extends Controller
|
|||
return response()->json($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update user password
|
||||
*/
|
||||
public function updatePassword(Request $request, User $user)
|
||||
{
|
||||
if($request->user()->id != $user->id && !$request->user()->hasPermission("users-update-auth")) abort(401);
|
||||
|
|
|
@ -2,8 +2,14 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
use Dedoc\Scramble\Scramble;
|
||||
use Dedoc\Scramble\Support\Generator\OpenApi;
|
||||
use Dedoc\Scramble\Support\Generator\SecurityScheme;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
|
@ -19,6 +25,13 @@ class AppServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
Scramble::routes(function (Route $route) {
|
||||
return Str::startsWith($route->uri, 'api/');
|
||||
});
|
||||
Scramble::extendOpenApi(function (OpenApi $openApi) {
|
||||
$openApi->secure(
|
||||
SecurityScheme::http('bearer', 'access_token')
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"dedoc/scramble": "^0.8.5",
|
||||
"defstudio/telegraph": "^1.38",
|
||||
"doctrine/dbal": "3.5.1",
|
||||
"guzzlehttp/guzzle": "^7.8",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "4e592547c61aba30bf5bc478eb258d8d",
|
||||
"content-hash": "b9015c5da9ec6e9aca174af8b270b779",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
|
@ -130,6 +130,81 @@
|
|||
],
|
||||
"time": "2023-10-01T12:35:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dedoc/scramble",
|
||||
"version": "v0.8.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dedoc/scramble.git",
|
||||
"reference": "cc61cc79843c6e2206dc5d0f15ae705494de8249"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/dedoc/scramble/zipball/cc61cc79843c6e2206dc5d0f15ae705494de8249",
|
||||
"reference": "cc61cc79843c6e2206dc5d0f15ae705494de8249",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^8.0.0|^9.0.0|^10.0.0",
|
||||
"nikic/php-parser": "^4.0",
|
||||
"php": "^8.1",
|
||||
"phpstan/phpdoc-parser": "^1.0",
|
||||
"spatie/laravel-package-tools": "^1.9.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/dbal": "^3.4",
|
||||
"laravel/pint": "^v1.1.0",
|
||||
"nunomaduro/collision": "^5.0|^v6.0",
|
||||
"orchestra/testbench": "^6.0|^7.0|^8.0",
|
||||
"pestphp/pest": "^1.21",
|
||||
"pestphp/pest-plugin-laravel": "^1.2",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"spatie/pest-plugin-snapshots": "^1.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Dedoc\\Scramble\\ScrambleServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Dedoc\\Scramble\\": "src",
|
||||
"Dedoc\\Scramble\\Database\\Factories\\": "database/factories"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Roman Lytvynenko",
|
||||
"email": "litvinenko95@gmail.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Automatic generation of API documentation for Laravel applications.",
|
||||
"homepage": "https://github.com/dedoc/scramble",
|
||||
"keywords": [
|
||||
"documentation",
|
||||
"laravel",
|
||||
"openapi"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/dedoc/scramble/issues",
|
||||
"source": "https://github.com/dedoc/scramble/tree/v0.8.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/romalytvynenko",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-02T09:58:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "defstudio/telegraph",
|
||||
"version": "v1.38.7",
|
||||
|
@ -3214,6 +3289,53 @@
|
|||
],
|
||||
"time": "2023-11-12T21:59:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "1.26.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "231e3186624c03d7e7c890ec662b81e6b0405227"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227",
|
||||
"reference": "231e3186624c03d7e7c890ec662b81e6b0405227",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/annotations": "^2.0",
|
||||
"nikic/php-parser": "^4.15",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/extension-installer": "^1.0",
|
||||
"phpstan/phpstan": "^1.5",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpstan/phpstan-strict-rules": "^1.0",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"symfony/process": "^5.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\PhpDocParser\\": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0"
|
||||
},
|
||||
"time": "2024-02-23T16:05:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/cache",
|
||||
"version": "3.0.0",
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
use Dedoc\Scramble\Http\Middleware\RestrictedDocsAccess;
|
||||
|
||||
return [
|
||||
/*
|
||||
* Your API path. By default, all routes starting with this path will be added to the docs.
|
||||
* If you need to change this behavior, you can add your custom routes resolver using `Scramble::routes()`.
|
||||
*/
|
||||
'api_path' => 'api',
|
||||
|
||||
/*
|
||||
* Your API domain. By default, app domain is used. This is also a part of the default API routes
|
||||
* matcher, so when implementing your own, make sure you use this config if needed.
|
||||
*/
|
||||
'api_domain' => null,
|
||||
|
||||
'info' => [
|
||||
/*
|
||||
* API version.
|
||||
*/
|
||||
'version' => env('API_VERSION', '0.0.1'),
|
||||
|
||||
/*
|
||||
* Description rendered on the home page of the API documentation (`/docs/api`).
|
||||
*/
|
||||
'description' => '',
|
||||
],
|
||||
|
||||
/*
|
||||
* Customize Stoplight Elements UI
|
||||
*/
|
||||
'ui' => [
|
||||
/*
|
||||
* Hide the `Try It` feature. Enabled by default.
|
||||
*/
|
||||
'hide_try_it' => false,
|
||||
|
||||
/*
|
||||
* URL to an image that displays as a small square logo next to the title, above the table of contents.
|
||||
*/
|
||||
'logo' => '',
|
||||
|
||||
/*
|
||||
* Use to fetch the credential policy for the Try It feature. Options are: omit, include (default), and same-origin
|
||||
*/
|
||||
'try_it_credentials_policy' => 'include',
|
||||
],
|
||||
|
||||
/*
|
||||
* The list of servers of the API. By default, when `null`, server URL will be created from
|
||||
* `scramble.api_path` and `scramble.api_domain` config variables. When providing an array, you
|
||||
* will need to specify the local server URL manually (if needed).
|
||||
*
|
||||
* Example of non-default config (final URLs are generated using Laravel `url` helper):
|
||||
*
|
||||
* ```php
|
||||
* 'servers' => [
|
||||
* 'Live' => 'api',
|
||||
* 'Prod' => 'https://scramble.dedoc.co/api',
|
||||
* ],
|
||||
* ```
|
||||
*/
|
||||
'servers' => null,
|
||||
|
||||
'middleware' => [
|
||||
'web',
|
||||
RestrictedDocsAccess::class,
|
||||
],
|
||||
|
||||
'extensions' => [],
|
||||
];
|
|
@ -16,6 +16,7 @@ use App\Http\Controllers\ServiceTypeController;
|
|||
use App\Http\Controllers\TrainingCourseTypeController;
|
||||
use App\Http\Controllers\TrainingController;
|
||||
use App\Http\Controllers\AdminController;
|
||||
use App\Http\Controllers\GenericController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use \Matthewbdaly\ETagMiddleware\ETag;
|
||||
|
@ -135,25 +136,8 @@ Route::middleware('signed')->group( function () {
|
|||
Route::get('/documents/medical_examination/{uuid}', [DocumentsController::class, 'serveMedicalExamination'])->name('medical_examination_serve');
|
||||
});
|
||||
|
||||
Route::get('/owner_image', function() {
|
||||
return response()
|
||||
->file(
|
||||
resource_path('images') . DIRECTORY_SEPARATOR . config("features.owner_image"),
|
||||
['Cache-control' => 'max-age=2678400']
|
||||
);
|
||||
});
|
||||
Route::get('/owner_image', [GenericController::class, 'ownerImage']);
|
||||
|
||||
Route::get('/ping', function() {
|
||||
return response()->json([
|
||||
'message' => 'pong'
|
||||
]);
|
||||
});
|
||||
Route::get('/ping', [GenericController::class, 'ping']);
|
||||
|
||||
Route::post('/cron/execute', function(Request $request) {
|
||||
//Go to app/Console/Kernel.php to view schedules
|
||||
if(config('cron.external_cron_enabled') && $request->header('Cron') == config('cron.execution_code')) {
|
||||
Artisan::call('schedule:run');
|
||||
} else {
|
||||
return response('Access Denied', 403);
|
||||
}
|
||||
});
|
||||
Route::post('/cron/execute', [GenericController::class, 'executeCron']);
|
||||
|
|
Loading…
Reference in New Issue