Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: send challeng with documentation #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions challenge/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
58 changes: 58 additions & 0 deletions challenge/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=example_app
DB_USERNAME=root
DB_PASSWORD=

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

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
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_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}"
11 changes: 11 additions & 0 deletions challenge/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
16 changes: 16 additions & 0 deletions challenge/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.idea
/.vscode
15 changes: 15 additions & 0 deletions challenge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Sobre api
- O teste lógico está documentado com a tag `Challeng logical`
- A parte de integração com a API qualifica está com a tag `User`

## Instruções de instalação
- Copiar as váriaveis de ambiente `cp .env.example .env`
- Rodar `composer install` no terminal para instalar as dependências do Laravel.
- Para rodar o projeto usar o [laravel sail](https://laravel.com/docs/9.x/sail) `./vendor/bin/sail up`
- Caso APP_KEY no .env não esteja cadastrada rodar `./vendor/bin/sail artisan key:generate`
- Rodar as migration `./vendor/bin/sail artisan migrate`
- Gerar a documentação da api e fazer testes com [swagger](https://swagger.io/) `./vendor/bin/sail artisan l5-swagger:generate`

## Acessos
- PhpMyAdmin: http://localhost:8002/ | Username: `sail` Password: `password`
- Documentação swagger: http://0.0.0.0/api/documentation#/
32 changes: 32 additions & 0 deletions challenge/app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
11 changes: 11 additions & 0 deletions challenge/app/Contract/DowngradeUserAPIInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Contract;

use App\DTO\DowngradeUserDTO;

interface DowngradeUserAPIInterface
{

public function handle(DowngradeUserDTO $dataDTO);
}
11 changes: 11 additions & 0 deletions challenge/app/Contract/FindByExternalIdInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Contract;

use App\DTO\FindByExternalIdUserDTO;

interface FindByExternalIdInterface
{

public function handle(FindByExternalIdUserDTO $dataDTO);
}
11 changes: 11 additions & 0 deletions challenge/app/Contract/ListAllUsersInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Contract;

use App\DTO\StoreUserAPIDTO;

interface ListAllUsersInterface
{

public function handle();
}
11 changes: 11 additions & 0 deletions challenge/app/Contract/StoreUserAPIInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Contract;

use App\DTO\StoreUserAPIDTO;

interface StoreUserAPIInterface
{

public function handle(StoreUserAPIDTO $dataDTO);
}
11 changes: 11 additions & 0 deletions challenge/app/Contract/StoreUserInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Contract;

use App\DTO\StoreUserDTO;

interface StoreUserInterface
{

public function handle(StoreUserDTO $dataDTO);
}
11 changes: 11 additions & 0 deletions challenge/app/Contract/UpdateUserInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Contract;

use App\DTO\UpdateUserDTO;

interface UpdateUserInterface
{

public function handle(UpdateUserDTO $dataDTO);
}
12 changes: 12 additions & 0 deletions challenge/app/Contract/UpgradeUserAPIInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Contract;

use App\DTO\StoreUserAPIDTO;
use App\DTO\UpgradeUserDTO;

interface UpgradeUserAPIInterface
{

public function handle(UpgradeUserDTO $dataDTO);
}
19 changes: 19 additions & 0 deletions challenge/app/DTO/DowngradeUserDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\DTO;

use Spatie\DataTransferObject\Attributes\MapFrom;
use Spatie\DataTransferObject\DataTransferObject;

class DowngradeUserDTO extends DataTransferObject
{

/**
*
* @var string
*/
public string $id;



}
20 changes: 20 additions & 0 deletions challenge/app/DTO/FindByExternalIdUserDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\DTO;

use App\Models\User;
use Spatie\DataTransferObject\Attributes\MapFrom;
use Spatie\DataTransferObject\DataTransferObject;

class FindByExternalIdUserDTO extends DataTransferObject
{

/**
*
* @var string
*/
public string $id;



}
40 changes: 40 additions & 0 deletions challenge/app/DTO/StoreUserAPIDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\DTO;

use Spatie\DataTransferObject\Attributes\MapFrom;
use Spatie\DataTransferObject\DataTransferObject;

class StoreUserAPIDTO extends DataTransferObject
{

/**
*
* @var string
*/
public string $msisdn;

/**
*
* @var string
*/
public string $name;

/**
*
* @var string
*/
public string $access_level;

/**
*
* @var string|null
*/
public ?string $password = null;

/**
*
* @var integer
*/
public int $external_id;
}
36 changes: 36 additions & 0 deletions challenge/app/DTO/StoreUserDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\DTO;

use Spatie\DataTransferObject\Attributes\MapFrom;
use Spatie\DataTransferObject\DataTransferObject;

class StoreUserDTO extends DataTransferObject
{

/**
*
* @var string
*/
public string $msisdn;

/**
*
* @var string
*/
public string $name;

/**
*
* @var string
*/
public string $access_level;

/**
*
* @var string|null
*/
public ?string $password = null;


}
26 changes: 26 additions & 0 deletions challenge/app/DTO/UpdateUserDTO.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\DTO;

use App\Models\User;
use Spatie\DataTransferObject\Attributes\MapFrom;
use Spatie\DataTransferObject\DataTransferObject;

class UpdateUserDTO extends DataTransferObject
{

/**
*
* @var User
*/
public User $user;

/**
*
* @var array
*/
public array $data;



}
Loading