mirror of
https://koodu.h-i.works/projects/thebadspace
synced 2025-06-25 16:04:37 -05:00
Added public search API
Finally moved over the public search API from the old version and updated the about page to show the new data structure Also tweaked the location update script to change 'defederate' to 'suspend' for the sake of consistency
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Resources\LocationCollection;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -17,3 +19,13 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
|
||||
// public search API
|
||||
Route::post("/v1/search", function (Request $request) {
|
||||
$data = json_decode($request->getContent());
|
||||
$search = $data->url;
|
||||
$search = str_replace(",", "", $search);
|
||||
$search = str_replace(" ", "|", $search);
|
||||
$results = DB::select("SELECT * FROM searchlocations('$search')");
|
||||
return new LocationCollection($results);
|
||||
});
|
||||
|
Reference in New Issue
Block a user