Open
Conversation
…the correct method information.
…c and moved and renamed the indexPugInteractions.js file to the new folder, and deleted a dependency that was accidentally installed.
…ed the script lint problem.
…ha, chai, sinon, and sinon-chai. Installed the dependencies: sequelize and mysql2.
…and populate the pokemons and pokemonTypes table with the first 2 generations of pokemon.
…o remove the setup.sql from commit history and put the file in the .gitignore file.
…sibility of a form that is an alternate form and didn't want possible future confusion.
…. Changed the password and username for the datbse no one could ue the info from previous commits of the setup.sql file.
…d, in ./models/index.js
…tter named, and added in more get path documentation.
…monForms to have an id column to allow for duplicate entries (because pokemon need to be overly complicated). Also fixed an error where a column was set to auto increment but wasn't supposed to have that.
jlcarmic
approved these changes
Jun 3, 2020
Collaborator
jlcarmic
left a comment
There was a problem hiding this comment.
Really good work overall. Just some struggled with the POST route and issues matching up docs with expectations.
Score: 86%
Comment on lines
72
to
85
| div(class="method hidden" id="postPokemon") | ||
| h2 Method | ||
| h3(class="spacing post") POST | ||
| h2 Route | ||
| h3(class="spacing") http://localhost:1337/pokemon | ||
| h2 Headers | ||
| h3(class="spacing") Content-Type: application/json | ||
| h2 Body | ||
| h3(class="spacing") { "gen": "1", "name": "Bulbasaur", "Types": "['grass', 'poison']", "fromId": "null" } | ||
| h2 Decription | ||
| h3(class="spacing") | ||
| | Saves a new pokemon to the database. (Note: the fromId is if the pokemon is an evolution of | ||
| | another pokemon Bulbasuar has 'fromId: null' as its a base evolution where as Ivysaur has | ||
| | 'fromId: 1' as it evolves from Bulbasaur) |
Comment on lines
22
to
30
| div(class="method hidden" id="getGeneration") | ||
| h2 Method | ||
| h3(class="spacing get") GET | ||
| h2 Route | ||
| h3(class="spacing") http://localhost:1337/pokemon/generation/{genId} | ||
| h2 Headers | ||
| h3(class="spacing") None needed | ||
| h2 Decription | ||
| h3(class="spacing") Returns the list of pokemon from gemeration passed with {genId}. |
| h2 Method | ||
| h3(class="spacing get") GET | ||
| h2 Route | ||
| h3(class="spacing") http://localhost:1337/pokemon/generation/{genId} |
Collaborator
There was a problem hiding this comment.
The error is because your example is wrong, works when you use the expected URL
Comment on lines
47
to
52
| const { | ||
| name, | ||
| generationNumber, | ||
| fromId, | ||
| types | ||
| } = request.body |
Collaborator
controllers/Pokemons.js
Outdated
| fromId, | ||
| types | ||
| } = request.body | ||
| const isProtected = request.body.isPortected || 0 |
Collaborator
There was a problem hiding this comment.
That typo will cause issues
| defaults: { generationNumber, fromId, isProtected } | ||
| }) | ||
|
|
||
| Promise.resolve(savedPokemon) |
Collaborator
There was a problem hiding this comment.
This is unnecessary, you awaited the database call, savedPokemon is already resolved.
|
|
||
| const [savedPokemon, created] = await models.Pokemons.findOrCreate({ | ||
| where: { name }, | ||
| defaults: { generationNumber, fromId, isProtected } |
Collaborator
| }) | ||
|
|
||
|
|
||
| const typesId = await Promise.all(promisedTypesId) |
Collaborator
There was a problem hiding this comment.
You don't need a separate variable here. Promises resolve in place.
const typesId = types.map(async typeName => {
const [type] = await models.Types.findOrCreate({ where: { name: typeName } })
return type.id
})
await Promise.all(typesId)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




No description provided.