https://github.com/developer239/pokemon-gql
https://github.com/developer239/pokemon-gql
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/developer239/pokemon-gql
- Owner: developer239
- Created: 2024-01-23T01:40:59.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-28T16:07:09.000Z (almost 2 years ago)
- Last Synced: 2025-01-04T21:33:07.898Z (about 1 year ago)
- Language: TypeScript
- Size: 2.13 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pokemon API


## Table of Contents
- [Setup](#setup)
- [Development](#development)
- [Database](#database)
- [Testing](#testing)
## Run with Docker
```bash
docker-compose up
```
**Note:** By default it uses `.env.template`.
## Setup
1. Install dependencies: `make install` (the project uses [yarn](https://github.com/yarnpkg))
2. Create local environment file: `cp .env.template .env`
3. Run infrastructure `make infra` (`.db/init/init.sql` should automatically create `api_db` database)
4. Run development server: `make develop`
## Development
- `make infra` - start postgres docker container
- `make develop` - start development server
- `make type-check` - run type checking
- `make lint-fix` - run linter
- `make format` - run prettier
## Database
- `make seed-database` - truncate all tables and seed database with initial data
- `make migration-create name=` - create new empty migration file
- `make migration-generate name=` - generate migration file based on the current schema diff
- `make migration-run` - run all pending migrations
- `make migration-revert` - revert last migration
- `make schema-drop` - drop all tables
```mermaid
classDiagram
direction BT
class attack {
varchar name
varchar type
attack_category_enum category
integer damage
integer id
}
class evolution_requirement {
integer amount
varchar name
integer pokemonId
integer id
}
class pokemon {
integer number
varchar name
varchar classification
text types
text resistant
text weaknesses
numrange weightRange
numrange heightRange
double precision fleeRate
integer maxCP
integer maxHP
integer id
}
class pokemon_attacks_attack {
integer pokemonId
integer attackId
}
class pokemon_evolutions_pokemon {
integer pokemonId_1
integer pokemonId_2
}
class user {
varchar email
varchar password
integer id
}
class user_favorite_pokemons_pokemon {
integer userId
integer pokemonId
}
evolution_requirement --> pokemon : pokemonId_id
pokemon_attacks_attack --> attack : attackId_id
pokemon_attacks_attack --> pokemon : pokemonId_id
pokemon_evolutions_pokemon --> pokemon : pokemonId_2_id
pokemon_evolutions_pokemon --> pokemon : pokemonId_1_id
user_favorite_pokemons_pokemon --> pokemon : pokemonId_id
user_favorite_pokemons_pokemon --> user : userId_id
```
## Testing
Most of the tests are E2E tests and require connection to the database.
- `make test` - run all tests
- `make coverage` - run test coverage