Skip to content

Commit

Permalink
Merge pull request #4 from m-lopez-f/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
m-lopez-f authored Aug 2, 2023
2 parents 3108417 + 5aeb4a2 commit f9ad0f8
Show file tree
Hide file tree
Showing 50 changed files with 4,344 additions and 224 deletions.
133 changes: 13 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# pokelist

Se ha generado un repositorio con diferentes Releases, por lo que se podrá acceder a la fase 1 y la fase 2 con independencia

## Fase 1

- Versión 1
https://github.com/m-lopez-f/pokelist/tree/Fase1

## Fase 2

- Versión 2
- Versión de PHP 8.2
- Versión de Laravel 10

Expand All @@ -11,129 +17,16 @@

una vez descargado será necesario realizar la instalción de los paquetes composer, mediante el comando `composer install`

Una vez instalado los paquetes será necesario levantar la base de datos. Para ello modificaremos los datos de conexión en el fichero `.env`. Una vez modificados ejecutaremos los siguientes comandos.
Una vez instalado los paquetes será necesario levantar la base de datos. Para ello modificaremos los datos de conexión en el fichero `.env`. Una vez modificados ejecutaremos el siguiente comando.

- 1: `php artisan migrate`
- 2: `php artisan db:seed`

Estos comandos nos permitiran crear las tablas y generar datos de ejemplo para está primera fase.
**En caso de usar la misma DB que para la fase 1 será necesario la ejecución del siguiente comando: `php artisan migrate:refresh`**

Estos comandos nos permitiran crear las tablas y generar datos de ejemplo para está segunda fase.

### Ejecución

Se ha preparado tres pokemons característicos del universo Pokemon siendo los siguientes:

```json

[
id: 1,
level: 13,
national_id: "0001",
name: "Bulbasaur",
key: "bulbasaur",
actual_ps: "45.00",
total_ps: "45.00",
base_attack: "49.00",
base_defense: "49.00",
base_special_attack: "65.00",
base_special_defense: "65.00",
base_speed: "45.00",
],
[
id: 2,
level: 13,
national_id: "0004",
name: "Charmander",
key: "charmander",
actual_ps: "39.00",
total_ps: "39.00",
base_attack: "52.00",
base_defense: "43.00",
base_special_attack: "60.00",
base_special_defense: "50.00",
base_speed: "65.00",
],
[
id: 3,
level: 13,
national_id: "0007",
name: "Squirtle",
key: "squirtle",
actual_ps: "44.00",
total_ps: "44.00",
base_attack: "48.00",
base_defense: "65.00",
base_special_attack: "50.00",
base_special_defense: "64.00",
base_speed: "43.00",
]
```
y los siguientes movimientos:

```json
[
[
"id" => 1,
"name" => "Scratch",
"key" => "scratch",
"url" => null,
"power" => "40.00",
"type_id" => 4,
],
[
"id" => 2,
"name" => "Ember",
"key" => "ember",
"url" => null,
"power" => "40.00",
"type_id" => 2,
],
[
"id" => 3,
"name" => "Tackle",
"key" => "tackle",
"url" => null,
"power" => "40.00",
"type_id" => 5,
],
[
"id" => 4,
"name" => "Water Gun",
"key" => "water-gun",
"url" => null,
"power" => "40.00",
"type_id" => 3,
],
[
"id" => 5,
"name" => "Vine Whip",
"key" => "vine-whip",
"url" => null,
"power" => "45.00",
"type_id" => 4,
],
[
"id" => 6,
"name" => "Rapid Spin",
"key" => "rapid-spin",
"url" => null,
"power" => "50.00",
"type_id" => 5,
],
]
```
Para poder probar el método solicitado para la fase 1, con realizar `php artisan serve` nos levantará el servicio de server para poder acceder a la siguiente url:
`http://<your-IP>:<your-Port>/calculatedamage/<attackerPokemon>/<move>/<defenderPokemon>`

Para AttackerPokemon y defenderPokemon filtrará por alguno de los siguientes campos:

- National ID
- Name
- Key

Para Move filtrará por los siguientes:

- Name
- Key

En caso de no encontrar Pokemon y movimiento devolcerá texto de incidencia.
Se ha generado una documentación para la interpretación de la API, se podrá visualizar en: `http://<your-IP>:<your-Port>/api/documentation`. Una vez hayas levantado la aplicación con `php artisan serve` o prepares un entorno con NGINX/APACHE


86 changes: 86 additions & 0 deletions app/Docs/Models/Move.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

namespace App\Docs\Models;

/**
* @OA\Schema(
* title="Move",
* description="Move model",
* @OA\Xml(
* name="Move"
* )
* )
*/
class Move
{

/**
* @OA\Property(
* title="ID",
* description="ID",
* format="int64",
* example=1
* )
*
* @var integer
*/
private $id;

/**
* @OA\Property(
* title="Name",
* description="Name of the new Move",
* example="A nice Move"
* )
*
* @var string
*/
public $name;

/**
* @OA\Property(
* title="Power",
* description="Power of the new Move",
* example="This is new Move's Power"
* )
*
* @var string
*/
public $power;

/**
* @OA\Property(
* title="Created at",
* description="Created at",
* example="2020-01-27 17:50:45",
* format="datetime",
* type="string"
* )
*
* @var \DateTime
*/
private $created_at;

/**
* @OA\Property(
* title="Updated at",
* description="Updated at",
* example="2020-01-27 17:50:45",
* format="datetime",
* type="string"
* )
*
* @var \DateTime
*/
private $updated_at;

/**
* @OA\Property(
* title="type",
* description="Move type's model"
* )
*
* @var \App\Docs\Models\Type
*/
private $type;
}
96 changes: 96 additions & 0 deletions app/Docs/Models/Pokemon.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

namespace App\Docs\Models;

/**
* @OA\Schema(
* title="Pokemon",
* description="Pokemon model",
* @OA\Xml(
* name="Pokemon"
* )
* )
*/
class Pokemon
{

/**
* @OA\Property(
* title="ID",
* description="ID",
* format="int64",
* example=1
* )
*
* @var integer
*/
private $id;

/**
* @OA\Property(
* title="Name",
* description="Name of the new Pokemon",
* example="A nice Pokemon"
* )
*
* @var string
*/
public $name;

/**
* @OA\Property(
* title="Power",
* description="Power of the new Pokemon",
* example="This is new Pokemon's Power"
* )
*
* @var string
*/
public $power;

/**
* @OA\Property(
* title="Created at",
* description="Created at",
* example="2020-01-27 17:50:45",
* format="datetime",
* type="string"
* )
*
* @var \DateTime
*/
private $created_at;

/**
* @OA\Property(
* title="Updated at",
* description="Updated at",
* example="2020-01-27 17:50:45",
* format="datetime",
* type="string"
* )
*
* @var \DateTime
*/
private $updated_at;

/**
* @OA\Property(
* title="moves",
* description="List of moves move's model"
* )
*
* @var \App\Docs\Models\Move[]
*/
private $move;

/**
* @OA\Property(
* title="type",
* description="type type's model"
* )
*
* @var \App\Docs\Models\Type[]
*/
private $type;
}
Loading

0 comments on commit f9ad0f8

Please sign in to comment.