Skip to content

Commit

Permalink
fix: lots and lots of stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
PThorpe92 committed Nov 1, 2023
1 parent c7b3628 commit 73ec0e9
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 549 deletions.
64 changes: 64 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:saRB6NSd4S80J/Uc/gkKeGQpX3iNYw34h664jj6age8=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=middleware
DB_USERNAME=sail
DB_PASSWORD=password

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

SCOUT_DRIVER=meilisearch
MEILISEARCH_HOST=http://meilisearch:7700

MEILISEARCH_NO_ANALYTICS=false
9 changes: 0 additions & 9 deletions app/Enums/ProviderUserResourseStatus.php

This file was deleted.

4 changes: 0 additions & 4 deletions app/Http/Controllers/Api/V1/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
<<<<<<< HEAD:app/Http/Controllers/Api/V1/Controller.php

=======
>>>>>>> 3336b14 (fix: naming issues in CanvasUtil):middleware/app/Http/Controllers/Controller.php

class Controller extends BaseController
{
Expand Down
120 changes: 2 additions & 118 deletions app/Http/Controllers/Api/V1/PlatformConnectionController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

<<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php
<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php
namespace App\Http\Controllers\Api\V1;


Expand All @@ -12,48 +10,22 @@
use App\Models\PlatformConnection;
use App\Http\Resources\PlatformConnectionResource;

=======
========
namespace App\Http\Controllers\api\V1;

>>>>>>>> b6e704f (move to namespace):middleware/app/Http/Controllers/api/V1/PlatformConnectionController.php
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\PlatformConnection;
>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php

class PlatformConnectionController extends Controller
{

/* Get all platform connections */
//*************************************************************
<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php
// GET: /api/platform_connection/
// GET: /api/v1/platform_connection/
// Request $req example:
// { "consumer_id": 1 }
// *************************************************************
public function index(): \Illuminate\Http\Resources\Json\AnonymousResourceCollection
{
return PlatformConnectionResource::collection(PlatformConnection::all());
=======
//GET: /api/platform_connection/
// Request $req example:
// { "consumer_id": 1 }
// *************************************************************
public function index(): \Illuminate\Http\JsonResponse
{
try {
$platform_connections = PlatformConnection::all(['*'])->toArray();
return response()->json($platform_connections);
} catch (\Exception) {
return response()->json(['error' => 'Invalid request body'], 401);
}
>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php
}

/* Create a new platform connection */
//*************************************************************
<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php
// POST: /api/v1/platform_connection/
// PlatformConnectionRequest $req example:
// { "consumer_id": 1, "provider_id": 1, "state": "enabled" }
Expand All @@ -70,36 +42,10 @@ public function store(StorePlatformConnectionRequest $req): PlatformConnectionRe
return new PlatformConnectionResource($platform_connection);
} catch (\Exception) {
return response()->json(INVALID_REQUEST_BODY, 401);
=======
//POST: /api/platform_connection/
// Request $req example:
// { "consumer_id": 1, "provider_id": 1, "state": "enabled" }
// *************************************************************
public function store(Request $req): \Illuminate\Http\JsonResponse
{
try {
$consumer_id = $req->input('consumer_id');
$provider_id = $req->input('provider_id');
$state = $req->input('state');
} catch (\Exception) {
return response()->json(['error' => 'Invalid request body'], 401);
}
try {
$platform_connection = PlatformConnection::create([
'consumer_id' => $consumer_id,
'provider_id' => $provider_id,
'state' => $state,
]);
return response()->json($platform_connection);
} catch (\Exception) {
return response()->json(['error' => 'Invalid request body'], 401);
>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php
}
}

// Get a specific platform connection by consumer or provider id
// *************************************************************
<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php
// GET: /api/v1/platform_connection/{id}
// Request $req example:
// "consumer_id": 1 || "provider_id": 1
Expand All @@ -125,56 +71,14 @@ public function update(UpdatePlatformConnectionRequest $req): PlatformConnection
$validated = $req->validated();
$PlatformConnection = PlatformConnection::where($validated)->first();
$PlatformConnection->state = $validated['state'];
return new PlatformConnectionResource($PlatformConnection->save());
if (!$PlatformConnection) {
return response()->json(['error' => 'No matching platform connection found'], 401);
=======
// GET: /api/platform_connection/{id}
// Request $req example:
// "consumer_id": 1 || "provider_id": 1
// *************************************************************
public function show(Request $req): \Illuminate\Http\JsonResponse
{
if ($req->input('provider_id') != null) {
$platform_connection = PlatformConnection::where('platform_id', $req->input('platform_id'))->first();
} else {
$platform_connection = PlatformConnection::where('consumer_id', $req->input('consumer_id'))->first();
}
if (!$platform_connection) {
return response()->json(['error' => 'Invalid request body'], 401);
}
return response()->json_encode($platform_connection, JSON_PRETTY_PRINT);
}

// Update a platform connection
// *************************************************************
// PUT: /api/platform_connection/{request_body}
// Request $req example:
// { "consumer_id": 1, "provider_id": 1, "state": "enabled" }
// *************************************************************
public function update(Request $req): \Illuminate\Http\JsonResponse
{
try {
$consumer_id = $req->input('consumer_id');
$provider_id = $req->input('provider_id');
$state = $req->input('state');
} catch (\Exception) {
return response()->json(['error' => 'Invalid request body'], 401);
}
try {
$platform_connection = PlatformConnection::where('consumer_id', $consumer_id)->where('provider_id', $provider_id)->first();
$platform_connection->state = $state;
$platform_connection->save();
return response()->json($platform_connection);
} catch (\Exception) {
return response()->json(['error' => 'Invalid request body'], 401);
>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php
}
return new PlatformConnectionResource($PlatformConnection->save());
}

// Delete a platform connection
// *************************************************************
<<<<<<< HEAD:app/Http/Controllers/Api/V1/PlatformConnectionController.php
// DELETE: /api/v1/platform_connection/{request_body}
// Request $req example:
// { "consumer_id": 1, "provider_id": 1 }
Expand All @@ -186,26 +90,6 @@ public function delete(ShowPlatformConnectionRequest $req): \Illuminate\Http\Jso
return response()->json(['success' => 'Platform connection deleted successfully'], 200);
} catch (\Exception) {
return response()->json(INVALID_REQUEST_BODY, 401);
=======
// DELETE: /api/platform_connection/{request_body}
// Request $req example:
// { "consumer_id": 1, "provider_id": 1 }
// *************************************************************
public function delete(Request $req): \Illuminate\Http\JsonResponse
{
try {
$consumer_id = $req->input('consumer_id');
$provider_id = $req->input('provider_id');
} catch (\Exception) {
return response()->json(['error' => 'Invalid request body'], 401);
}
try {
$platform_connection = PlatformConnection::where('consumer_id', $consumer_id)->where('provider_id', $provider_id)->first();
$platform_connection->delete();
return response()->json(['status' => 'success']);
} catch (\Exception) {
return response()->json(['error' => 'Invalid request body'], 401);
>>>>>>> 0feb532 (fix items in review with nokie. PR closes UN-102):middleware/app/Http/Controllers/PlatformConnectionController.php
}
}
}
24 changes: 7 additions & 17 deletions app/Http/Controllers/Api/V1/ProviderPlatformController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

<<<<<<< HEAD:app/Http/Controllers/Api/V1/ProviderPlatformController.php
namespace App\Http\Controllers\Api\V1;

use App\Models\ProviderPlatform;
Expand All @@ -17,20 +16,20 @@ class ProviderPlatformController extends Controller
// ****************************************************
// GET: /api/provider_platforms/
// ****************************************************
public function index()
public function index(): \Illuminate\Http\Resources\Json\AnonymousResourceCollection
{
return ProviderPlatformResource::collection(ProviderPlatform::all(['*']));
}
//
// List information on a specific provider platform
// ****************************************************
// GET: /api/provider_platforms/{request_body}
// GET: /api/v1/provider_platforms/{request_body}
// @param Request $request
// @return JsonResponse
// ****************************************************
public function show(ShowProviderPlatformRequest $request, $id): ProviderPlatformResource|\Illuminate\Http\JsonResponse
public function show(ShowProviderPlatformRequest $request): ProviderPlatformResource|\Illuminate\Http\JsonResponse
{
$providerPlatform = ProviderPlatform::where('id', $id)->first();
$providerPlatform = ProviderPlatform::where('id', $request->id)->first();
if ($providerPlatform) {
return new ProviderPlatformResource($providerPlatform);
} else {
Expand Down Expand Up @@ -61,7 +60,7 @@ public function store(StoreProviderPlatformRequest $req): ProviderPlatformResour
// @return JsonResponse
// Request $request
// ****************************************************
public function update(StoreProviderPlatformRequest $request)
public function update(StoreProviderPlatformRequest $request): ProviderPlatformResource|\Illuminate\Http\JsonResponse
{
$validated = $request->validated();
$providerPlatform = ProviderPlatform::where($validated)->first();
Expand All @@ -79,23 +78,14 @@ public function update(StoreProviderPlatformRequest $request)
// Request $req example:
// { "provider_id": 1 }
// ****************************************************
public function destroy(Request $request, $providerId): \Illuminate\Http\JsonResponse
public function destroy(Request $request): \Illuminate\Http\JsonResponse
{
$providerPlatform = ProviderPlatform::where('id', $providerId)->first();
$providerPlatform = ProviderPlatform::where('id', $request->input('id'))->first();
if (!$providerPlatform) {
return response()->json(['error' => 'Invalid provider ID'], 401);
} else {
$providerPlatform->delete();
return response()->json(json_encode($providerPlatform));
}
}
=======
namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ProviderPlatformController extends Controller
{
//
>>>>>>> 8b2e792 (fix: upgraded to meet schema):middleware/app/Http/Controllers/ProviderPlatformController.php
}
Loading

0 comments on commit 73ec0e9

Please sign in to comment.