https://github.com/hugovarellaa/ignite-template-database-queries
Chapter 3 - Desafio 01 - Database Queries
https://github.com/hugovarellaa/ignite-template-database-queries
jest-tests nodejs postgresql typeorm typescript
Last synced: 25 days ago
JSON representation
Chapter 3 - Desafio 01 - Database Queries
- Host: GitHub
- URL: https://github.com/hugovarellaa/ignite-template-database-queries
- Owner: Hugovarellaa
- Created: 2023-01-26T01:13:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-26T01:55:21.000Z (over 2 years ago)
- Last Synced: 2025-02-15T15:50:27.776Z (3 months ago)
- Topics: jest-tests, nodejs, postgresql, typeorm, typescript
- Language: TypeScript
- Homepage:
- Size: 250 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chapter III - Desafio 01: Database Queries :rocket: :purple_heart:
## :dart: Objetivo
Realizar consultas no banco de dados com o TypeORM de três formas:
- ORM
- Query Builder
- Raw Query## :white_check_mark: Requisitos
### Repositórios da aplicação
#### UsersRepository
- [x] findUserWithGamesById
- [x] findAllUsersOrderedByFirstName
- [x] findUserByFullName#### GamesRepository
- [x] findByTitleContaining
- [x] countAllGames
- [x] findUsersByGameId### Especificação dos testes
#### UsersRepository
- [x] Should be able to find user with games list by user's ID
- [x] Should be able to list users ordered by first name
- [x] Should be able to find user by full name#### GamesRepository
- [x] Should be able find a game by entire or partial given title
- [x] Should be able to get the total count of games
- [x] Should be able to list users who have given game id## :computer: Instalação
```bash
# Clone este repositório
$ git clone https://github.com/Hugovarellaa/ignite-template-database-queries.git# Entre na pasta
$ cd ignite-template-database-queries.git# Instale as dependências
$ yarn
ou
$ npm i# Crie o container de banco de dados
$ docker-compose up# Execute os testes da aplicação
$ yarn test
```## ❗ Deletando o container
Depois que executar os testes é interessante fazer a remoção do container:
```bash
# parar o container
$ docker-compose stop# deletar o container
$ docker-compose rm
```