Cambios generales, a ver si volvemos al desarrollo

This commit is contained in:
2021-06-09 16:24:18 -04:00
parent 1632a2e51f
commit dbb80a9d4e
17 changed files with 314 additions and 520 deletions

View File

@@ -3,25 +3,27 @@ APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=es
APP_TIMEZONE=America/Santiago
LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=
DB_CONNECTION=postgresql
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=restaurant
DB_USERNAME=user
DB_PASSWORD=password
CACHE_DRIVER=file
CACHE_DRIVER=redis
REDIS_CLIENT=predis
QUEUE_CONNECTION=sync
AUTH0_DOMAIN=https://super-domain.auth0.com/
AUTH0_AUD=https://audience
AUTH0_API_AUD=https://super-domain.auth0.com/api/v2/
AUTH0_CLIENT_ID=secret
AUTH0_CLIENT_SECRET=secret

View File

@@ -5,25 +5,8 @@ namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
class Kernel extends ConsoleKernel {
protected $commands = [];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
//
}
protected function schedule(Schedule $schedule) {}
}

View File

@@ -4,7 +4,6 @@ namespace App\Events;
use Illuminate\Queue\SerializesModels;
abstract class Event
{
abstract class Event {
use SerializesModels;
}

View File

@@ -2,15 +2,6 @@
namespace App\Events;
class ExampleEvent extends Event
{
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
class ExampleEvent extends Event {
public function __construct() {}
}

View File

@@ -9,13 +9,7 @@ use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
class Handler extends ExceptionHandler {
protected $dontReport = [
AuthorizationException::class,
HttpException::class,
@@ -23,32 +17,11 @@ class Handler extends ExceptionHandler
ValidationException::class,
];
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
public function report(Throwable $exception) {
parent::report($exception);
}
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
* @throws \Throwable
*/
public function render($request, Throwable $exception)
{
public function render($request, Throwable $exception) {
return parent::render($request, $exception);
}
}

View File

@@ -5,8 +5,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Laravel\Lumen\Routing\Controller as BaseController;
class Controller extends BaseController
{
class Controller extends BaseController {
protected function buildFailedValidationResponse(Request $request, array $errors) {
return ["error" => "validation_error", "message" => $errors];
}

View File

@@ -5,36 +5,14 @@ namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Factory as Auth;
class Authenticate
{
/**
* The authentication guard factory instance.
*
* @var \Illuminate\Contracts\Auth\Factory
*/
class Authenticate {
protected $auth;
/**
* Create a new middleware instance.
*
* @param \Illuminate\Contracts\Auth\Factory $auth
* @return void
*/
public function __construct(Auth $auth)
{
public function __construct(Auth $auth) {
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
public function handle($request, Closure $next, $guard = null) {
if ($this->auth->guard($guard)->guest()) {
return response('Unauthorized.', 401);
}

View File

@@ -1,20 +0,0 @@
<?php
namespace App\Http\Middleware;
use Closure;
class ExampleMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
return $next($request);
}
}

View File

@@ -2,25 +2,8 @@
namespace App\Jobs;
class ExampleJob extends Job
{
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
class ExampleJob extends Job {
public function __construct() {}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
}
public function handle() {}
}

View File

@@ -7,18 +7,6 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
abstract class Job implements ShouldQueue
{
/*
|--------------------------------------------------------------------------
| Queueable Jobs
|--------------------------------------------------------------------------
|
| This job base class provides a central location to place any logic that
| is shared across all of your jobs. The trait included with the class
| provides access to the "queueOn" and "delay" queue helper methods.
|
*/
abstract class Job implements ShouldQueue {
use InteractsWithQueue, Queueable, SerializesModels;
}

View File

@@ -6,26 +6,8 @@ use App\Events\ExampleEvent;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class ExampleListener
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
class ExampleListener {
public function __construct() {}
/**
* Handle the event.
*
* @param \App\Events\ExampleEvent $event
* @return void
*/
public function handle(ExampleEvent $event)
{
//
}
public function handle(ExampleEvent $event) {}
}

View File

@@ -6,15 +6,8 @@ use App\Services\Auth0Service;
use App\Services\PaginatorService;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
class AppServiceProvider extends ServiceProvider {
public function register() {
$this->app->singleton(Auth0Service::class, function($app) {
return new Auth0Service($app);
});

View File

@@ -1,39 +0,0 @@
<?php
namespace App\Providers;
use App\Models\User;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Boot the authentication services for the application.
*
* @return void
*/
public function boot()
{
// Here you may define how you wish users to be authenticated for your Lumen
// application. The callback which receives the incoming request instance
// should return either a User instance or null. You're free to obtain
// the User instance via an API token or any other method necessary.
$this->app['auth']->viaRequest('api', function ($request) {
if ($request->input('api_token')) {
return User::where('api_token', $request->input('api_token'))->first();
}
});
}
}

View File

@@ -4,13 +4,7 @@ namespace App\Providers;
use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
class EventServiceProvider extends ServiceProvider {
protected $listen = [
\App\Events\ExampleEvent::class => [
\App\Listeners\ExampleListener::class,

View File

@@ -3,14 +3,6 @@
namespace App\Traits;
trait UuidPrimaryKey {
public function getKeyType()
{
return 'string';
}
public function getIncrementing()
{
return false;
}
public function getKeyType() { return 'string'; }
public function getIncrementing() { return false; }
}

559
backend/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,15 +2,8 @@
use Laravel\Lumen\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
/**
* Creates the application.
*
* @return \Laravel\Lumen\Application
*/
public function createApplication()
{
abstract class TestCase extends BaseTestCase {
public function createApplication() {
return require __DIR__.'/../bootstrap/app.php';
}
}