Skip to content

Commit

Permalink
Merge pull request #113 from BinaryStudioAcademy/dev
Browse files Browse the repository at this point in the history
Release 1.1.0
  • Loading branch information
aLLeXUs authored May 18, 2020
2 parents b10f633 + 5b468a9 commit 72c4b75
Show file tree
Hide file tree
Showing 80 changed files with 6,336 additions and 4,787 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.idea
.vscode

8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
language: php

php:
- 7.2
- 7.3

cache:
directories:
Expand All @@ -15,13 +15,13 @@ cache:
before_install:
- cd $TRAVIS_BUILD_DIR/backend
- composer validate
- mysql -e 'CREATE DATABASE thread'
- mysql -e 'CREATE DATABASE thread'

install:
- composer install --no-interaction --prefer-source

before_script:
- cp .env.travis .env
- cp .env.travis .env
- php artisan migrate --force

script:
Expand All @@ -30,4 +30,4 @@ script:
after_success:
- bash <(curl -s https://codecov.io/bash)


8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"eslint.workingDirectories": [
{
"directory": "./frontend",
"changeProcessCWD": true
}
],
}
2 changes: 1 addition & 1 deletion backend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
Expand Down
8 changes: 4 additions & 4 deletions backend/readme.md → backend/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# BSA 2019 Thread (backend)
# BSA Mini-Project - Thread (backend)

## Technologies

* PHP 7.2 || 7.3
* [Laravel 5.8](https://laravel.com)
* PHP 7.3
* [Laravel 6](https://laravel.com)
* [Docker](https://www.docker.com/)
* [Docker-compose](https://docs.docker.com/compose/)
* [Beanstalkd](https://github.com/beanstalkd/beanstalkd) - message queue (очередь сообщений для обработки тяжелых задач асинхронно)
Expand Down Expand Up @@ -67,4 +67,4 @@ [email protected]
MAIL_FROM_NAME="BSA Thread Admin"
```

You can debug your app with [Telescope](https://laravel.com/docs/5.8/telescope) tool which is installed already :)
You can debug your app with [Telescope](https://laravel.com/docs/6.x/telescope) tool which is installed already :)
4 changes: 2 additions & 2 deletions backend/app/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use Illuminate\Database\Eloquent\Relations\HasMany;
use InvalidArgumentException;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

/**
* Class User
Expand Down Expand Up @@ -88,7 +88,7 @@ public function changeFirstName(string $firstName): void

$this->attributes['first_name'] = $firstName;
}

public function changeLastName(string $lastName): void
{
if (empty($lastName)) {
Expand Down
5 changes: 4 additions & 1 deletion backend/app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Config;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Illuminate\Auth\Access\AuthorizationException;
Expand Down Expand Up @@ -42,6 +42,7 @@ class Handler extends ExceptionHandler
*
* @param Exception $exception
* @return void
*
* @throws Exception
*/
public function report(Exception $exception)
Expand All @@ -63,6 +64,8 @@ public function report(Exception $exception)
* @param Request $request
* @param Exception $exception
* @return Response|JsonResponse
*
* @throws Exception
*/
public function render($request, Exception $exception)
{
Expand Down
40 changes: 40 additions & 0 deletions backend/app/Http/Controllers/Auth/ConfirmPasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords;

class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/

use ConfirmsPasswords;

/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}
10 changes: 0 additions & 10 deletions backend/app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,4 @@ class ForgotPasswordController extends Controller
*/

use SendsPasswordResetEmails;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
3 changes: 2 additions & 1 deletion backend/app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
Expand All @@ -25,7 +26,7 @@ class LoginController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
Expand Down
7 changes: 4 additions & 3 deletions backend/app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace App\Http\Controllers\Auth;

use App\User;
use App\Entity\User;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
Expand All @@ -28,7 +29,7 @@ class RegisterController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';
protected $redirectTo = RouteServiceProvider::HOME;

/**
* Create a new controller instance.
Expand Down Expand Up @@ -59,7 +60,7 @@ protected function validator(array $data)
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
* @return User
*/
protected function create(array $data)
{
Expand Down
13 changes: 2 additions & 11 deletions backend/app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords;

class ResetPasswordController extends Controller
Expand All @@ -25,15 +26,5 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected $redirectTo = '/home';

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
protected $redirectTo = RouteServiceProvider::HOME;
}
4 changes: 2 additions & 2 deletions backend/app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
Expand Down
4 changes: 3 additions & 1 deletion backend/app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Kernel extends HttpKernel
'api' => [
\Barryvdh\Cors\HandleCors::class,
'throttle:60,1',
'bindings',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

Expand All @@ -58,6 +58,7 @@ class Kernel extends HttpKernel
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
Expand All @@ -74,6 +75,7 @@ class Kernel extends HttpKernel
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\Authenticate::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Authenticate extends Middleware
* Get the path the user should be redirected to when they are not authenticated.
*
* @param \Illuminate\Http\Request $request
* @return string
* @return string|null
*/
protected function redirectTo($request)
{
Expand Down
3 changes: 2 additions & 1 deletion backend/app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Middleware;

use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;

Expand All @@ -18,7 +19,7 @@ class RedirectIfAuthenticated
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
return redirect(RouteServiceProvider::HOME);
}

return $next($request);
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;

class TrustProxies extends Middleware
{
Expand Down
2 changes: 2 additions & 0 deletions backend/app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public function register()
$this->app->register(TelescopeServiceProvider::class);
$this->app->register(IdeHelperServiceProvider::class);
}

$this->app->register(FakerServiceProvider::class);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion backend/app/Providers/BroadcastServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;

class BroadcastServiceProvider extends ServiceProvider
{
Expand Down
1 change: 0 additions & 1 deletion backend/app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Providers;

use Illuminate\Support\Facades\Event;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
Expand Down
36 changes: 36 additions & 0 deletions backend/app/Providers/FakerServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Providers;

use Faker\Factory;
use Faker\Generator;
use Illuminate\Support\ServiceProvider;
use Mmo\Faker\PicsumProvider;

class FakerServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->app->singleton(Generator::class, function () {
$faker = Factory::create();
$faker->addProvider(new PicsumProvider($faker));

return $faker;
});
}

/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
//
}
}
Loading

0 comments on commit 72c4b75

Please sign in to comment.