Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f2ce52b
initial commit
Feb 7, 2023
dca967a
add nodemon, ts-node, typescript, express, mongoose and their types a…
Feb 7, 2023
ebbc5a8
add prettier and eslint setup
Feb 7, 2023
0268fa2
add docker-compose with mongo
caiooliveirah09 Feb 7, 2023
85d22be
add npm run dev script with nodemon and tsconfig.json
caiooliveirah09 Feb 7, 2023
d4f32c7
add .env
caiooliveirah09 Feb 7, 2023
7d64d88
created index.ts and make initial setup
caiooliveirah09 Feb 7, 2023
7ec40e1
remove password and user from mongo
caiooliveirah09 Feb 10, 2023
837f0c5
created /beers route
caiooliveirah09 Feb 10, 2023
02eee9c
created index with api and mongo
caiooliveirah09 Feb 10, 2023
7819cec
created BeerODM and read method
caiooliveirah09 Feb 10, 2023
287a11b
create Beer domain and IBeer interface
caiooliveirah09 Feb 10, 2023
f4c5548
created IController interface to the controller
caiooliveirah09 Feb 10, 2023
e7d3f73
created enum with status http response
caiooliveirah09 Feb 10, 2023
c99d9e7
created beers.route.ts and make .get with read method
caiooliveirah09 Feb 10, 2023
74271e2
created beers.service.ts with method read
caiooliveirah09 Feb 10, 2023
a7b4374
created connection to the mongodb
caiooliveirah09 Feb 10, 2023
4068e40
created beer.scontroller.ts with read method
caiooliveirah09 Feb 10, 2023
9aa4afb
changed the database name to MyEnterprise
caiooliveirah09 Feb 10, 2023
d9eef0b
created migration with all database data
caiooliveirah09 Feb 10, 2023
13f5f19
add more status in StatusHttp
caiooliveirah09 Feb 13, 2023
15ff388
added validations for a new beer with joi
caiooliveirah09 Feb 13, 2023
623104e
include pastes in ts
caiooliveirah09 Feb 13, 2023
1605245
add .gitignore, .env.example and dotenv, joi, @types/joi for validations
caiooliveirah09 Feb 13, 2023
4626f7c
created the database folder to gather the connection files and the mo…
caiooliveirah09 Feb 13, 2023
258e89d
created all the missing crud routes, post, patch and delete, and did …
caiooliveirah09 Feb 13, 2023
aa33979
deleted the node_modules and the .env file to send to the repository
caiooliveirah09 Feb 13, 2023
68ebaff
put my github as the author of the project
caiooliveirah09 Feb 13, 2023
cb3c3ba
changed mongo db url
caiooliveirah09 Feb 13, 2023
c38f547
used the beer domain in the service rule
caiooliveirah09 Feb 13, 2023
c79d5df
add integration test dependencies
caiooliveirah09 Feb 13, 2023
2f53f31
add tests in tsconfig
caiooliveirah09 Feb 13, 2023
60af877
created a test script created tests for all crud routes and their mocks
caiooliveirah09 Feb 14, 2023
d6d30c5
I fixed a service logic
caiooliveirah09 Feb 14, 2023
a42c746
turned my app into a class, because my tests were giving an error
caiooliveirah09 Feb 14, 2023
3df9d43
add postman_collection
caiooliveirah09 Feb 14, 2023
05c88b6
add APP_PORT to .env.example
caiooliveirah09 Feb 14, 2023
79e3402
updated readme
caiooliveirah09 Mar 2, 2023
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
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MONGO_DB_URL= mongo_db_url
APP_PORT = 8000
16 changes: 16 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"rules": {}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.env
39 changes: 4 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,30 @@
# **TESTE DE BACKEND**
# **BACKEND OF A BREWERY COMPANY**

## SITUAÇÃO-PROBLEMA

Você acabou de ser contratado para uma vaga de desenvolvedor backend de uma empresa que revende cervejas do mundo inteiro. O desenvolvedor anterior corrompeu completamente o banco de dados e a API anterior e sobrou apenas um arquivo .JSON com todas as informações do banco. Seu líder confiou a tarefa de recriar a API e o banco de dados a você.

Neste teste, você deverá criar uma API com endpoints a serem consumidos via REST e um banco de dados, utilizando os dados fornecidos no arquivo. ````db.json````.

---------------------------------------------------------------------

## REQUISITOS OBRIGATÓRIOS:

- Seja original, projetos suspeitos de serem copiados serão descartados.
- Queremos ver o seu código, e não o de outros.
- Criar coleção no Postman (seu teste será testado por aqui).

## GIT

- Faça um fork deste repositório.
- Crie uma branch para codar as suas features.
- Faça um pull-request quando o teste for finalizado.

##### **NOTA: Será avaliado também se o nome da branch, títulos de commit, push e comentários possuem boa legibilidade.**

-----------------------------------------------------

## FRAMEWORK -

- Servidor: Express (Javascript/Typescript) *<u>**OU**</u>* Gin (Golang)
- Banco de dados: MongoDB, DynamoDB, MySQL, Postgres...
- Servidor: Express (Typescript)
- Banco de dados: MongoDB

-----------------------------------------------------

## PROJETO

- Api deve conter pelo menos 1 endpoint para cada operação crud (Create, Read, Update, Delete).
- Um endpoint para listagem de conteúdo.
- Banco de dados a escolha do dev.

-------------------------------------------------------

## REQUISITOS DIFERENCIAIS:

- Seguir os princípios de SOLID.
- Fazer o teste em GoLang.
- Fazer o teste da aplicação.
- Codar um código performático.
- Utilizar inglês no projeto todo.
- Utilizar Injeção de dependências.
- Criar um frontend que consuma a API
- Fazer deploy do mesmo (heroku, aws, google cloud ou outro da preferência).



---

## ENTREGA

- Faça um pull request e nomeie-o como no ex.: Teste de (Seu nome aqui).
- Envie um email para schmidt@repenso.eco e kevin@repenso.eco com o link do pull request, do deploy (tanto do front quanto do back se feito), e anexe a coleção do postman.
- Assim que avaliarmos seu teste, enviaremos uma devolutiva de sucesso ou falha, e caso seja aprovado, um link para agendar sua entrevista técnica.

303 changes: 303 additions & 0 deletions backend-test-two.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
{
"info": {
"_postman_id": "1a142623-cd04-4e35-9f4f-76a6e7ef7be3",
"name": "backend-test-two",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "25853525"
},
"item": [
{
"name": "CREATE",
"item": [
{
"name": "CREATE",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"abv\":8.918797384901016,\"address\":\"141 South Main Street\",\"category\":\"British Ale\",\"city\":\"Slippery Rock\",\"coordinates\":[41.0638,-80.0556],\"country\":\"United States\",\"description\":\"This robust, hearty stout is as sturdy as its namesake. Roasted barley is the trademark of stout, a bittersweet separation from its cousin Porter. The deep character of roasted barley is further enhanced by the addition of oatmeal for an incredible silky finish.\",\"ibu\":104,\"name\":\"Stone House Stout\",\"state\":\"Pennsylvania\",\"website\":\"http://www.northcountrybrewing.com\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
},
{
"name": "WITHOUT BODY",
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
},
{
"name": "WITHOUT ADRESS",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"abv\":8.918797384901016,\"category\":\"British Ale\",\"city\":\"Slippery Rock\",\"coordinates\":[41.0638,-80.0556],\"country\":\"United States\",\"description\":\"This robust, hearty stout is as sturdy as its namesake. Roasted barley is the trademark of stout, a bittersweet separation from its cousin Porter. The deep character of roasted barley is further enhanced by the addition of oatmeal for an incredible silky finish.\",\"ibu\":104,\"name\":\"Stone House Stout\",\"state\":\"Pennsylvania\",\"website\":\"http://www.northcountrybrewing.com\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
}
]
},
{
"name": "READ",
"item": [
{
"name": "READ",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
}
]
},
{
"name": "UPDATE",
"item": [
{
"name": "UPDATE",
"request": {
"method": "PATCH",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"id\": \"63ebb8266f93c4f44b62de87\",\"address\":\"141 North Main Street\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
},
{
"name": "WITHOUT ID",
"request": {
"method": "PATCH",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"address\":\"141 North Main Street\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
},
{
"name": "WITHOUT UPDATE",
"request": {
"method": "PATCH",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"id\": \"63ebb8266f93c4f44b62de87\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
}
]
},
{
"name": "DELETE",
"item": [
{
"name": "DELETE",
"request": {
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"id\": \"63ebb8266f93c4f44b62de87\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
},
{
"name": "WITHOUT ID",
"request": {
"method": "DELETE",
"header": [],
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
},
{
"name": "INVALID ID",
"request": {
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": "{\"id\": \"invalidId\"}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8000/beers",
"protocol": "http",
"host": [
"localhost"
],
"port": "8000",
"path": [
"beers"
]
}
},
"response": []
}
]
}
]
}
Loading