generated from Valentin-Morette/JS-FullStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b348e2c
commit d928318
Showing
8 changed files
with
135 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
backend/src/controllers/TutorialCommandTrainerController.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
const models = require("../models"); | ||
|
||
class TutorialCommandTrainerController { | ||
static browse = (req, res) => { | ||
models.tutorial_command_trainer | ||
.findAll() | ||
.then(([rows]) => { | ||
res.send(rows); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
res.sendStatus(500); | ||
}); | ||
}; | ||
|
||
static read = (req, res) => { | ||
models.tutorial_command_trainer | ||
.find(req.params.id) | ||
.then(([rows]) => { | ||
if (rows[0] == null) { | ||
res.sendStatus(404); | ||
} else { | ||
res.send(rows[0]); | ||
} | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
res.sendStatus(500); | ||
}); | ||
}; | ||
|
||
static readByTrainer = (req, res) => { | ||
models.tutorial_command_trainer | ||
.findByTrainer(req.params.id) | ||
.then(([rows]) => { | ||
res.send(rows); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
res.sendStatus(500); | ||
}); | ||
}; | ||
|
||
static edit = (req, res) => { | ||
const tutorialCommandTrainer = req.body; | ||
|
||
tutorialCommandTrainer.id = parseInt(req.params.id, 10); | ||
|
||
models.tutorial_command_trainer | ||
.update(tutorialCommandTrainer) | ||
.then(([result]) => { | ||
if (result.affectedRows === 0) { | ||
res.sendStatus(404); | ||
} else { | ||
res.sendStatus(204); | ||
} | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
res.sendStatus(500); | ||
}); | ||
}; | ||
|
||
static add = (req, res) => { | ||
const tutorialCommandTrainer = req.body; | ||
|
||
models.tutorial_command_trainer | ||
.insert(tutorialCommandTrainer) | ||
.then(([result]) => { | ||
res | ||
.status(201) | ||
.send({ ...tutorialCommandTrainer, id: result.insertId }); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
res.sendStatus(500); | ||
}); | ||
}; | ||
|
||
static delete = (req, res) => { | ||
models.tutorial_command_trainer | ||
.delete(req.params.id) | ||
.then(() => { | ||
res.sendStatus(204); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
res.sendStatus(500); | ||
}); | ||
}; | ||
} | ||
|
||
module.exports = TutorialCommandTrainerController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,169 +1,4 @@ | ||
-- Route 1 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '2'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '2'); -- Roucool | ||
|
||
-- Route 2 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '4'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '4'); -- Roucool | ||
|
||
-- Forêt de Jade | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('13', '5'); -- Aspicot | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('10', '5'); -- Chenipan | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('11', '5'); -- Chrysacier (Uniquement dans Pokémon Bleu) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('14', '5'); -- Coconfort (Uniquement dans Pokémon Rouge) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('21', '5'); -- Piafabec (Uniquement dans Pokémon Rouge) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '5'); -- Roucool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('12', '5'); -- Papilusion (Très rare dans Pokémon Bleu) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('15', '5'); -- Dardagnan (Très rare dans Pokémon Rouge) | ||
|
||
-- Route 22 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '6'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('21', '6'); -- Piafabec | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('27', '6'); -- Sabelette (Uniquement dans Pokémon Bleu) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('56', '6'); -- Férosinge (Uniquement dans Pokémon Rouge) | ||
|
||
-- Plateau Indigo | ||
-- Pas de Pokémon sauvages spécifiques à capturer ici (ce sont des combats contre d'autres dresseurs). | ||
|
||
-- Route 3 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '8'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('21', '8'); -- Piafabec | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('23', '8'); -- Abo | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('29', '8'); -- Nidoran♀ | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('32', '8'); -- Nidoran♂ | ||
|
||
-- Mont Sélénite | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('41', '9'); -- Nosferapti | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('74', '9'); -- Racaillou | ||
|
||
-- Azuria | ||
-- Pas de Pokémon sauvages spécifiques à capturer ici. | ||
|
||
-- Route 4 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '11'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('23', '11'); -- Abo | ||
|
||
-- Parmanie | ||
-- Pas de Pokémon sauvages spécifiques à capturer ici. | ||
|
||
-- Route 5 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '13'); -- Roucool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '13'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('39', '13'); -- Mélofée (Très rare) | ||
|
||
-- Lavanville | ||
-- Pas de Pokémon sauvages spécifiques à capturer ici. | ||
|
||
-- Route 8 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '15'); -- Roucool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '15'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('37', '15'); -- Goupix (Uniquement dans Pokémon Bleu) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('58', '15'); -- Caninos (Uniquement dans Pokémon Rouge) | ||
|
||
-- Route 10 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('21', '16'); -- Piafabec | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('81', '16'); -- Magnéti | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('100', '16'); -- Voltorbe | ||
|
||
-- Route 9 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '17'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('21', '17'); -- Piafabec | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('23', '17'); -- Abo | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('27', '17'); -- Sabelette (Uniquement dans Pokémon Bleu) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('56', '17'); -- Férosinge (Uniquement dans Pokémon Rouge) | ||
|
||
-- Route 6 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '18'); -- Roucool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '18'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('43', '18'); -- Mystherbe | ||
|
||
-- Route 11 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '19'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('23', '19'); -- Abo | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('27', '19'); -- Sabelette (Uniquement dans Pokémon Bleu) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('56', '19'); -- Férosinge (Uniquement dans Pokémon Rouge) | ||
|
||
-- Caverne Azurée | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('41', '20'); -- Nosferapti | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('42', '20'); -- Nosferalto | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('74', '20'); -- Racaillou | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('75', '20'); -- Gravalanch | ||
|
||
-- Route 7 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('37', '21'); -- Goupix (Uniquement dans Pokémon Bleu) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('58', '21'); -- Caninos (Uniquement dans Pokémon Rouge) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('43', '21'); -- Mystherbe | ||
|
||
-- Route 16 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '22'); -- Roucool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '22'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('84', '22'); -- Doduo | ||
|
||
-- Route 17 (Piste Cyclable) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '23'); -- Roucool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '23'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('84', '23'); -- Doduo | ||
|
||
-- Route 18 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '24'); -- Roucool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '24'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('84', '24'); -- Doduo | ||
|
||
-- Safrania | ||
-- Pas de Pokémon sauvages spécifiques à capturer ici. | ||
|
||
-- Parc Safari | ||
-- Il y a de nombreux Pokémon dans le Parc Safari, et cela dépend de la zone spécifique à l'intérieur du parc. Si vous voulez une liste complète pour le Parc Safari, faites-le moi savoir. | ||
|
||
-- Cramois'île | ||
-- Pas de Pokémon sauvages spécifiques à capturer ici. | ||
|
||
-- Route 21 | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('16', '28'); -- Roucool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('19', '28'); -- Rattata | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('72', '28'); -- Tentacool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('73', '28'); -- Tentacruel | ||
|
||
-- Route 20 (Surfing) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('72', '29'); -- Tentacool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('73', '29'); -- Tentacruel | ||
|
||
-- Îles Écume | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('54', '30'); -- Psykokwak | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('55', '30'); -- Akwakwak | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('72', '30'); -- Tentacool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('73', '30'); -- Tentacruel | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('79', '30'); -- Ramoloss | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('80', '30'); -- Flagadoss | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('86', '30'); -- Otaria | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('87', '30'); -- Lamantine | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('90', '30'); -- Kokiyas | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('91', '30'); -- Crustabri | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('98', '30'); -- Krabby | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('99', '30'); -- Krabboss | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('120', '30'); -- Stari | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('121', '30'); -- Staross | ||
|
||
-- Route 19 (Surfing) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('72', '31'); -- Tentacool | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('73', '31'); -- Tentacruel | ||
|
||
-- Manoir Pokémon (Cramois'Île) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('37', '32'); -- Goupix (Uniquement dans Pokémon Bleu) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('58', '32'); -- Caninos (Uniquement dans Pokémon Rouge) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('109', '32'); -- Smogo | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('110', '32'); -- Smogogo | ||
|
||
-- Centrale Pokémon (Power Plant) | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('81', '33'); -- Magnéti | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('82', '33'); -- Magnéton | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('100', '33'); -- Voltorbe | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('101', '33'); -- Électrode | ||
INSERT INTO pokemon_zone (idPokemon, idZone) VALUES ('125', '33'); -- Élektek | ||
|
||
-- Grotte Inconnue (Cave de Cerulean) | ||
-- Ici, vous pourrez trouver le Pokémon légendaire Mewtwo, mais c'est après avoir battu la Ligue Pokémon. | ||
|
||
|
||
|
||
|
||
ALTER TABLE tutorial_command_trainer ADD UNIQUE KEY unique_trainer_command (idTrainer, commandName); | ||
ALTER TABLE trainer DROP COLUMN point; | ||
ALTER TABLE trainer DROP COLUMN level; | ||
ALTER TABLE `trainer` ADD `hasFirstCatch` TINYINT NOT NULL AFTER `money`; |
Oops, something went wrong.