- Docker
- Base de dados relacional
- Implementacao de repository
- API
- Configurar hangfire no projeto
Pessoas que treinam pokemons.
Premissas para ter um cadastro de treinadores: - Tabela de treinadores - Definir campos - Criar script sql para criacao de tabela - Endpoint para CRUD de treinadores
Ex:
#1 Joao #2 Guilherme #3 Igor #4 Gustavo #5 Gabriel
Monstrinhos ficticios do jogo pokemon
Premissas para ter um cadastro de pokemons: - Tabela de pokemons - Definir campos - Criar script sql para criacao de tabela - Job com hangfire para popular tabela de pokemons usando a api do Poke-API
Ex:
#1 Bulbasaur #2 Squirtle #3 Charmander
A colecao de pokemons eh o cadastro de todos os pokemons que um determionado treinador possui.
Premissas para ter um cadastro de colecao de pokemons: - Tabela de colecao de pokemons - Definir campos - Criar script sql para criacao de tabela - Endpoint para CRUD de colecao de pokemons
Um conjunto de ate 6 pokemons de um determinado treinador.
Premissas para ter um cadastro de times: - Tabela de times - Definir campos - Criar script sql para criacao de tabela - Endpoint para CRUD de times
- Treinador
- Pokemon
- Level
Ex:
Treinador #1 Pokemons #1, #2, #3
Treinador #2 Pokemons #1, #2
Treinador #1 Pokemons #2, #2, #3
CREATE SCHEMA IF NOT EXISTS api;
CREATE TABLE IF NOT EXISTS api.POKEDEX (
ID SERIAL PRIMARY KEY NOT NULL,
NICKNAME VARCHAR(150),
PRIMARY_TYPE VARCHAR(50) NOT NULL,
SECONDARY_TYPE VARCHAR(50),
HEIGHT FLOAT,
WEIGHT INT,
BASE_EXP INT,
HP INT,
ATTACK INT,
DEFENSE INT,
SPECIAL_ATK INT,
SPECIAL_DEF INT,
SPEED INT,
ARTWORK VARCHAR(512)
);
CREATE TABLE IF NOT EXISTS api.POKEMON (
ID SERIAL PRIMARY KEY,
NICKNAME VARCHAR(150),
PRIMARY_TYPE VARCHAR(50) NOT NULL,
SECONDARY_TYPE VARCHAR(50),
HEIGHT FLOAT,
WEIGHT INT,
BASE_EXP INT,
LEVEL INT NOT NULL,
ARTWORK VARCHAR(512),
ID_POKEDEX INT,
CONSTRAINT FK_POKEDEX FOREIGN KEY(ID_POKEDEX) REFERENCES api.POKEDEX(ID)
);
CREATE TABLE IF NOT EXISTS api.TRAINER (
ID SERIAL PRIMARY KEY,
NAME VARCHAR(150) NOT NULL,
PASSWORD VARCHAR(150) NOT NULL,
EMAIL VARCHAR(150) NOT NULL,
ID_TEAM INT,
ID_COLLECTION INT,
NICKNAME VARCHAR(150) NOT NULL
);
CREATE TABLE IF NOT EXISTS api.COLLECTION (
ID SERIAL PRIMARY KEY,
ID_TRAINER INT NOT NULL,
ID_POKEMON INT NOT NULL,
IS_FAVORITE BOOLEAN,
AQUISITION_DATE DATE NOT NULL
);
CREATE TABLE IF NOT EXISTS api.TEAM (
ID SERIAL PRIMARY KEY,
NAME VARCHAR(150) NOT NULL,
ID_POKEMON_SLOT_1 INT,
ID_POKEMON_SLOT_2 INT,
ID_POKEMON_SLOT_3 INT,
ID_POKEMON_SLOT_4 INT,
ID_POKEMON_SLOT_5 INT,
ID_POKEMON_SLOT_6 INT
);
ALTER TABLE api.POKEMON
ADD FOREIGN KEY(ID_POKEDEX) REFERENCES api.POKEDEX (ID);
ALTER TABLE api.TRAINER
ADD FOREIGN KEY(ID_TEAM) REFERENCES api.TEAM (ID);
ALTER TABLE api.TRAINER
ADD FOREIGN KEY(ID_COLLECTION) REFERENCES api.COLLECTION (ID);
ALTER TABLE api.COLLECTION
ADD FOREIGN KEY(ID_TRAINER) REFERENCES api.TRAINER (ID);
ALTER TABLE api.COLLECTION
ADD FOREIGN KEY(ID_POKEMON) REFERENCES api.POKEMON (ID);
ALTER TABLE api.TEAM
ADD FOREIGN KEY(ID_POKEMON_SLOT_1) REFERENCES api.POKEMON (ID);
ALTER TABLE api.TEAM
ADD FOREIGN KEY(ID_POKEMON_SLOT_2) REFERENCES api.POKEMON (ID);
ALTER TABLE api.TEAM
ADD FOREIGN KEY(ID_POKEMON_SLOT_3) REFERENCES api.POKEMON (ID);
ALTER TABLE api.TEAM
ADD FOREIGN KEY(ID_POKEMON_SLOT_4) REFERENCES api.POKEMON (ID);
ALTER TABLE api.TEAM
ADD FOREIGN KEY(ID_POKEMON_SLOT_5) REFERENCES api.POKEMON (ID);
ALTER TABLE api.TEAM
ADD FOREIGN KEY(ID_POKEMON_SLOT_6) REFERENCES api.POKEMON (ID);
INSERT INTO api.POKEDEX (
ID,
NICKNAME,
PRIMARY_TYPE,
SECONDARY_TYPE,
HEIGHT,
WEIGHT,
BASE_EXP,
HP,
ATTACK,
DEFENSE,
SPECIAL_ATK,
SPECIAL_DEF,
SPEED,
ARTWORK
)
VALUES (
1,
'bulbasaur',
'grass',
'poison',
7,
69,
64,
45,
49,
49,
65,
65,
45,
'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/1.png'
),
(
4,
'charmander',
'fire',
'',
6,
85,
62,
39,
52,
43,
60,
50,
65,
'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/4.png'
),
(
7,
'squirtle',
'water',
'',
5,
90,
63,
44,
48,
65,
50,
64,
43,
'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/7.png'
);
INSERT INTO api.POKEMON (
NICKNAME,
PRIMARY_TYPE,
SECONDARY_TYPE,
HEIGHT,
WEIGHT,
BASE_EXP,
LEVEL,
ARTWORK,
ID_POKEDEX
)
VALUES (
'bulbasaur',
'grass',
'poison',
7,
69,
64,
1,
'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/1.png',
1
),
(
'charmander',
'fire',
'',
6,
85,
62,
1,
'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/4.png',
4
),
(
'squirtle',
'water',
'',
5,
90,
63,
1,
'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/7.png',
7
);
INSERT INTO api.TRAINER(NAME, PASSWORD, EMAIL, NICKNAME)
VALUES (
'Fulano Silva',
'********',
'[email protected]',
'Fulano'
),
(
'Beltrano Santos',
'********',
'[email protected]',
'Beltrano'
),
(
'Ciclano Silva Santos',
'********',
'[email protected]',
'Ciclano'
);
INSERT INTO api.collection(
ID_TRAINER,
ID_POKEMON,
IS_FAVORITE,
AQUISITION_DATE
)
VALUES
(1, 1, FALSE, '2022-07-13 00:00:00'),
(2, 2, FALSE, '2022-07-13 00:00:00'),
(3, 3, FALSE, '2022-07-13 00:00:00'),
(1, 2, FALSE, '2022-07-13 00:00:00');
-- TO_BE_IMPLEMENTED
-- TO_BE_IMPLEMENTED