Skip to content

Teste desenvolvedor backend JR #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4b22e1b
config: first configs, installing eslint
h3zord Nov 14, 2024
6374708
feat: creating entities
h3zord Nov 14, 2024
1173c3c
feat: adding user contract, in memory repository, use case and unit test
h3zord Nov 14, 2024
e0e1812
feat: adding find user by id use case, and unit tests
h3zord Nov 15, 2024
c8529f8
feat: adding update user use case, and unit tests
h3zord Nov 15, 2024
880dc20
feat: adding delete user use case, and unit tests
h3zord Nov 15, 2024
806b2fc
feat: adding create post use case, and unit tests
h3zord Nov 15, 2024
d2487b2
feat: adding find post by id use case, and unit tests
h3zord Nov 15, 2024
317f412
feat: adding find many posts by user id use case, and unit tests
h3zord Nov 15, 2024
91799d4
feat: adding update post use case, and unit tests
h3zord Nov 15, 2024
7b648b5
feat: adding delete post use case, and unit tests
h3zord Nov 15, 2024
7532c09
feat: adding middlewares, create user controller and e2e tests
h3zord Nov 17, 2024
ddf284e
feat: adding find user by email controller and e2e tests
h3zord Nov 17, 2024
0c3abbe
feat: Finalizing user controller and e2e tests
h3zord Nov 17, 2024
8d53c92
feat: adding create post controller and e2e test
h3zord Nov 17, 2024
72d33ed
feat: adding find post by id controller and e2e tests
h3zord Nov 17, 2024
08f1828
feat: adding find many posts by user id and e2e tests
h3zord Nov 18, 2024
209c45b
feat: adding update and delete posts controller and e2e tests
h3zord Nov 18, 2024
7963062
finishing challange!
h3zord Nov 18, 2024
3ff5f78
finishing challenge!
h3zord Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=password
DB_NAME=test_db
PORT=3000
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@rocketseat/eslint-config/node",
"rules": {
"no-useless-constructor": "off"
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
/dist
.env
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
#TODO Configure o Dockerfile
FROM node:18

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3000

CMD ["npm", "run", "dev"]
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,20 @@ Execute os seguintes comandos para testar a aplicação:
```

Dentro do container, execute o teste:

<strong>Para o teste simples:<strong>
```bash
npm test
```
<strong>Para os testes unitários:<strong>
```bash
npm run test:unit
```

<strong>Para os testes de integração:<strong>
```bash
npm run test:e2e
```

## 6º Passo: Crie um fork desse repositório e submita o código preenchido nele.
Crie um Pull Request para a brach master nos enviando o código
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
- DB_USER=root
- DB_PASSWORD=password
- DB_NAME=test_db
- PORT=3000
depends_on:
- db

Expand Down
19 changes: 17 additions & 2 deletions init.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
USE test_db;

--TODO Crie a tabela de user;
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
firstName VARCHAR(100) NOT NULL,
lastName VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL,
createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

--TODO Crie a tabela de posts;
CREATE TABLE IF NOT EXISTS posts (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
description VARCHAR(100) NOT NULL,
createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
userId INT NOT NULL,
FOREIGN KEY (userId) REFERENCES users(id) ON DELETE CASCADE
);
Loading