Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
4fce5b4
Build: server folder
kennedybm Apr 12, 2023
ff2b2ee
Feat: created gitignore with some files
kennedybm Apr 12, 2023
164e305
Fix: remoced and changed to app.ts
kennedybm Apr 13, 2023
1a7985e
Fix: react-app ports changed to 3000:3000
kennedybm Apr 13, 2023
5e85e93
Feat: added initial project config
kennedybm Apr 13, 2023
1b313b6
Feat: created src with main project structure
kennedybm Apr 13, 2023
4229a68
Feat: created src with project main folders structure
kennedybm Apr 13, 2023
99fa87d
Feat: added project dependencies
kennedybm Apr 13, 2023
471fcc3
Feat: created and set some files to ignore
kennedybm Apr 13, 2023
541630e
Feat: created and added types of pokemons post route
kennedybm Apr 13, 2023
2595d71
Feat:created to be main exports controllers file, added listPokemons…
kennedybm Apr 13, 2023
172ec96
Feat: added route to get and create an pokemon
kennedybm Apr 13, 2023
8cc87d0
Feat: created to be servies main files exports, added create and list…
kennedybm Apr 13, 2023
13fdd92
Feat: added healthcheck
kennedybm Apr 13, 2023
2632cdf
Feat: created controller to list all pokemons
kennedybm Apr 13, 2023
bec0a36
Feat: created to list all pokemons in database
kennedybm Apr 13, 2023
55b0127
Feat: created to handle request and response
kennedybm Apr 13, 2023
d1221f8
Feat: created to handle errors and set data in the database
kennedybm Apr 13, 2023
d2f0fd3
Fix: fixed type1 scope closure
kennedybm Apr 13, 2023
1e34af6
Fix: removing console.logs
kennedybm Apr 13, 2023
b05040c
Feat: added pg and reflect-metadata to dependencies
kennedybm Apr 13, 2023
e98e96d
Feat: added updatePokemonController in exports
kennedybm Apr 14, 2023
26ad053
Feat: added name nad pokedexNumber in update interface
kennedybm Apr 14, 2023
93f5216
Feat: added schema validation middleware in update route
kennedybm Apr 14, 2023
fcc8f37
Feat: update controller added to main exports
kennedybm Apr 14, 2023
983aa07
Feat: schema created to validate fields on update route
kennedybm Apr 14, 2023
c5d3c1a
Feat: schema created to validate fields on update route
kennedybm Apr 14, 2023
88aba1f
Fix: removing response message test, returning retrived pokemon
kennedybm Apr 14, 2023
4fa8ca4
Feat: created to retrieve an pokemon by id
kennedybm Apr 14, 2023
244aa5b
Feat: created controller to update an pokemon
kennedybm Apr 14, 2023
0cf4c38
Feat: route with schema validation, fields cannot be updated woth the…
kennedybm Apr 14, 2023
1ac329c
Feat: yup added in project dependencies
kennedybm Apr 14, 2023
97bd76c
Fix: func to handle fields to update with same value refactored, chan…
kennedybm Apr 14, 2023
05e9d22
Fix: foundPokemon and toFoundErrors types, name and pokedexNumber can…
kennedybm Apr 14, 2023
9e37a9f
Fix: added id in IUpdate interface to handle error if user try to update
kennedybm Apr 14, 2023
8a4dbea
Fix: added error if any user try to update pokemon id
kennedybm Apr 14, 2023
2f94490
Feat: delete pokemon controller added to main exports
kennedybm Apr 14, 2023
3f77458
Feat: delete pokemon service added to main services exports
kennedybm Apr 14, 2023
14c5cbb
Feat: route to delete an pokemon by id created
kennedybm Apr 14, 2023
8a734b4
Feat: route to delete an pokemon by id created
kennedybm Apr 14, 2023
3f75c9e
Feat: server file created to be handle unique with mongoose connection
kennedybm Apr 14, 2023
fdd794a
Fix: removed db connection and moved to server.ts
kennedybm Apr 14, 2023
64a957f
Fix: changed scripts to run db from server.ts file
kennedybm Apr 14, 2023
3fab930
Fix: status code error changed to 404
kennedybm Apr 14, 2023
cf2940c
Fix: status code error to not found changed to 404
kennedybm Apr 14, 2023
be64d4f
Feat: created with two files, array of predefined pokemons to be use…
kennedybm Apr 14, 2023
b316753
Feat: added dataBaseSeeder func who will be called when project is st…
kennedybm Apr 14, 2023
1d47295
Fix: import name
kennedybm Apr 14, 2023
a9f8290
Feat: created to show how set variavles in .env
kennedybm Apr 14, 2023
2f4a29c
Feat: initial documentation
kennedybm Apr 14, 2023
bc07e4a
Feat: config example img's added
kennedybm Apr 14, 2023
7b7a060
Fix: uncomented dataBaseSeeder func to be used in the front-end
kennedybm Apr 15, 2023
466163b
Fix: changed type2 and weather2 fields values
kennedybm Apr 15, 2023
e929711
Feat: styled components global style created with and added color var…
kennedybm Apr 15, 2023
8c0d756
Feat: created client dockerignore file
kennedybm Apr 15, 2023
c01ed51
Feat: created routes to manage pages with react-router-dom
kennedybm Apr 15, 2023
c06fe23
Feat: providers created
kennedybm Apr 15, 2023
6293bf2
Feat: api provider created to handle integration with back-end and ma…
kennedybm Apr 15, 2023
f46c1e8
Feat:added header and cards components
kennedybm Apr 15, 2023
6f506fa
Feat: component card created with styles and interfaces
kennedybm Apr 15, 2023
c5867af
Feat: component header created with styles and interfaces
kennedybm Apr 15, 2023
fa74d80
Feat: added Providers and BrowserRouter
kennedybm Apr 15, 2023
473f1c1
Feat: Routes, GlobalStyle, and bootstrap css
kennedybm Apr 15, 2023
4e6a212
Feat: react-bootstrap bootstrap and styled components added in projec…
kennedybm Apr 15, 2023
807d488
Feat: react-bootstrap bootstrap and styled components added in projec…
kennedybm Apr 15, 2023
b7a24c3
Fix: deleted files
kennedybm Apr 15, 2023
67d9b45
Feat: added more colors
kennedybm Apr 15, 2023
0b38c3a
Fix: exports sintax changed
kennedybm Apr 15, 2023
c03f401
Feat: added pokemons component
kennedybm Apr 15, 2023
3cbc93e
Feat: set all fields to be optional
kennedybm Apr 15, 2023
0992a01
Feat: added pokemons to the main components exports
kennedybm Apr 15, 2023
040a87e
Fix: export sintax
kennedybm Apr 15, 2023
e4f1574
Fix: export sintax
kennedybm Apr 15, 2023
ccd95b7
Fix: removing borders
kennedybm Apr 15, 2023
0659307
Fix: removing non used bootstrap components
kennedybm Apr 15, 2023
dd4b93b
Fix: deleted files
kennedybm Apr 15, 2023
6ab1e09
Feat: created and added insomnia routes collection
kennedybm Apr 15, 2023
c3d35af
Create LICENSE
kennedybm Apr 15, 2023
e7e1873
Update README.md
kennedybm Apr 15, 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 .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
node_modules
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Kennedy Barreto

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
73 changes: 42 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,69 @@
# Teste de Desenvolvimento Web
# Pokedex

Olá Dev! Tudo bem?
This is a technical test involving front-end and back-end development. The mission is to create a system to replace an Excel file, adding new functionalities while maintaining the core features. The goal is to create a practical and enjoyable way to search for data, including listing, filtering, pagination, and displaying details about each Pokémon.

A RedFox está sempre em busca de profissionais interessantes e interessados, com boa capacidade de aprendizado, adaptação e principalmente motivação!
## Technologies Used

Este teste tem como objetivo avaliar e desafiar você. Não é obrigatório realizá-lo completamente, queremos apenas conhecer você, seu esforço e potencial para aprender, se adaptar e tomar decisões.
- [React](https://react.dev/): Front-end library for building user interfaces.
- [Node.js](https://nodejs.org/en): JavaScript runtime environment for server-side development.
- [Express.js](https://expressjs.com/): Web application framework for Node.js.
- [MongoDB](https://www.mongodb.com/): NoSQL database for storing data.
- [Mongoose](https://mongoosejs.com/): MongoDB object modeling tool for Node.js.
- [Docker](https://www.docker.com/): Containerization platform for packaging applications into containers.

Agora vamos ao teste!
## Getting Started

This project is developed to run the front-end and back-end with Docker, with easy-to-follow configuration steps, anyone should be able to run it locally. Follow the steps below to get the project up and running on your local machine:

## Desafio Pokémon
Prerequisites

Nós temos um problema, atualmente nosso sistema é só um excel, cheio de informações sobre Pokémon. Nós usamos ele como banco de dados e ao mesmo tempo interface de gerenciamento, inserindo, editando, deletando e filtrando os dados.
- [Node.js](https://nodejs.org/en) and [Yarn](https://yarnpkg.com/) (Node Package Manager) installed on your machine.
- [Docker](https://www.docker.com/) installed on your machine.

A missão é criar um sistema para substituir este excel, pois queremos expandir e acrescentar funcionalidades. Queremos manter o básico, mas principalmente queremos uma forma prática e agradável de buscar os dados, com listagem, filtros, paginação e detalhes sobre cada Pokémon.
### Installation

Fique à vontade com o layout, precisamos de uma interface que consiga entregar as funcionalidades principais e substituir o excel, só isso.
1 - Clone the repository to your local machine:

```clipboard
[email protected]:kennedybm/teste-desenvolvimento-web.git
```

## Consigo fazer tudo isso?
2 - At the root of the project, you will find a **`docker-compose.yml`** file. Open the docker-compose.yml file and modify the environment (username, password, database) as shown in the following image:

Consegue sim!
![environment example](https://user-images.githubusercontent.com/91641613/232124340-37917f83-2b2f-4436-88ac-c23b8aad869f.png)

O teste é flexível, você pode escolher alguma parte específica dele para fazer, em que se sinta mais confortável e confiante, por exemplo: a interface, as funcionalidades, o banco de dados, etc...O importante é tentar atingir o objetivo de alguma forma.

Aqui na RedFox queremos aproveitar ao máximo suas habilidades e aptidões, mas também desafiar você a adquirir novas, então nossa equipe tem a liberdade de trasitar entre frontend, backend, infraestrutura, etc...Sem se restringir, tudo depende do esforço e vontade de cada um.
Make the necessary changes according to the image to configure the docker-compose file.

3 - Navigate to the **`server`** folder, and then open the **`src`** directory. Create a new **`.env`** file and copy and paste the variables from the
**`.env.example`**, which is in the same directory. Replace the **`user`** and **`password`** fields in the **`.env`** file with the same variables that you set in the previous step. Your **`.env`** file should look like this:

## Por onde começo?
![pokedex-env](https://user-images.githubusercontent.com/91641613/232124922-3de71272-66b8-4b56-bfc3-5a7e3866ab98.png)

Primeiramente, você pode fazer um fork desse repositório aqui, para sua conta do Github, depois disso crie uma branch nova com o seu nome, para podermos indentificá-lo.
4 - Open the project terminal and run this command:

Após terminar o desafio, você pode solicitar um pull request para a branch master do nosso repositório. Vamos receber e fazer a avaliação de todos.
```clipboard
docker compose up
```

5 - After completing all the necessary setup, you can access the front-end at:

## E o Layout??
```clipboard
http://localhost:3000/
```

Fique a vontade quanto a isso, não vamos avaliar o design da sua interface. Se quiser desenhar algo bacana, diferente, pensar até em UI/UX, etc...é claro que vamos valorizar o seu esforço e considerar como um diferencial, mas não se preocupe.

and the back-end at:

## Regras
```clipboard
http://localhost:5500/pokemons
```
When the 'Running on port 5500' message appears in the terminal, simply refresh the front-end page.

Para o desafio ficar mais interessante, decidimos criar algumas regras:
- No layout, deve utilizar algum framework CSS (ex: Bootstrap, MaterializeCSS, Bulma...)
- No frontend, deve utilizar algum framework JS (ex: VueJS, ReactJS, Angular...tente não usar jQuery)
- No backend, deve utilizar NodeJS
- Documentar um pouco o projeto, o que você fez e de que forma devemos executar-lo
## Usage

This project is developed with a script that populates the back-end with a collection of Pokémon data to be displayed in the front-end for initial use. The script sets up the necessary data in the back-end database, allowing the application to showcase a list of Pokémon with their details on the front-end. This feature provides a ready-to-use dataset for users to explore and interact with the application without the need for manual data entry.

## Só isso?
## License

Só!...mas se quiser ir além, tente preparar o projeto para ser executado de maneira simples e prática, se coloque no lugar de alguém com menos conhecimentos, que precisa ver o que você desenvolveu.

ps: Se fizer deploy em algum servidor ou utilizar alguma ferramenta que facilite a execução (ex: docker), será um diferencial.


Boa sorte! (^_^)
[MIT](https://github.com/kennedybm/teste-desenvolvimento-web/blob/kennedy-barreto/LICENSE)
5 changes: 5 additions & 0 deletions client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
dist
24 changes: 24 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
14 changes: 14 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:16.15.1

WORKDIR /app

COPY ./package*.json ./
COPY ./yarn.lock ./

RUN yarn install

COPY . .

EXPOSE 3000

CMD ["yarn", "dev"]
13 changes: 13 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "client",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.3.5",
"bootstrap": "^5.2.3",
"react": "^18.2.0",
"react-bootstrap": "^2.7.3",
"react-dom": "^18.2.0",
"react-icons": "^4.8.0",
"react-paginate": "^8.2.0",
"react-router-dom": "5",
"styled-components": "^5.3.9"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react-paginate": "^7.1.1",
"@types/react-router-dom": "^5.3.3",
"@types/styled-components": "^5.1.26",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "^4.9.3",
"vite": "^4.2.0"
}
}
1 change: 1 addition & 0 deletions client/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Routes from "./routes";
import GlobalStyle from "./style/global";
import "bootstrap/dist/css/bootstrap.min.css";

const App = () => {
return (
<>
<GlobalStyle />
<Routes />
</>
);
};

export default App;
Empty file added client/src/assets/index.ts
Empty file.
25 changes: 25 additions & 0 deletions client/src/components/header/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Container from "react-bootstrap/Container";
import Navbar from "react-bootstrap/Navbar";
import Form from "react-bootstrap/Form";
import Button from "react-bootstrap/Button";

export const Header = () => {
return (
<>
<Navbar bg="light" variant="light" sticky="top" expand="md">
<Container>
<Navbar.Brand href="header">Pokedex</Navbar.Brand>
<Form className="d-flex">
<Form.Control
type="search"
placeholder="Search"
className="me-2"
aria-label="Search"
/>
<Button variant="outline-success">Search</Button>
</Form>
</Container>
</Navbar>
</>
);
};
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions client/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Header } from "./header";
import { Pokemons } from "./pokemons";
import { Pagination } from "./pagination";

export { Header, Pokemons, Pagination };
19 changes: 19 additions & 0 deletions client/src/components/pagination/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import ReactPaginate from "react-paginate";
import { IPagination } from "./interfaces";

export const Pagination = ({ switchPage, pageCount }: IPagination) => {
return (
<ReactPaginate
previousLabel={"<"}
nextLabel={">"}
pageCount={pageCount}
onPageChange={switchPage}
containerClassName={"paginationUl"}
previousLinkClassName={"previousBttn"}
nextLinkClassName={"nextBttn"}
disabledClassName={"paginationDisabled"}
activeClassName={"paginationActive"}
pageClassName={"paginationPages"}
/>
);
};
4 changes: 4 additions & 0 deletions client/src/components/pagination/interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface IPagination {
switchPage: ({ selected }: { selected: number }) => void;
pageCount: number;
}
44 changes: 44 additions & 0 deletions client/src/components/pokemons/cards/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { useApi } from "../../../providers/api";
import { IPokemonsProps } from "./interfaces";
import * as Styled from "./styles";
import * as BsIcons from "react-icons/bs";

export const Cards = ({
id,
name,
pokedexNumber,
type1,
type2,
weather1,
atk,
def,
sta,
statTotal,
}: IPokemonsProps) => {
const { pokemonsData } = useApi();

return (
<>
<Styled.CardSection>
<Styled.TitleSection>
<Styled.NameBox>{name}</Styled.NameBox>
<Styled.ExcludeBox>
<BsIcons.BsTrash3Fill />
</Styled.ExcludeBox>
</Styled.TitleSection>
<Styled.ContentSection>
<ul>
<li>Number: {pokedexNumber}</li>
<li>Type1: {type1}</li>
<li>Type2: {type2}</li>
<li>Weather1: {weather1}</li>
<li>ATK: {atk}</li>
<li>DEF: {def}</li>
<li>STA: {sta}</li>
<li>Stat Total: {statTotal}</li>
</ul>
</Styled.ContentSection>
</Styled.CardSection>
</>
);
};
32 changes: 32 additions & 0 deletions client/src/components/pokemons/cards/interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export interface IPokemonsProps {
id?: string;
name?: string;
pokedexNumber?: number;
imgName?: string;
generation?: number;
evolutionStage?: string;
evolved?: number;
familyID?: number;
crossGen?: number;
type1?: string;
type2?: string;
weather1?: string;
weather2?: string;
statTotal?: number;
atk?: number;
def?: number;
sta?: number;
legendary?: number;
aquireable?: number;
spawns?: number;
regional?: number;
raidable?: number;
hatchable?: number;
shiny?: number;
nest?: number;
new?: number;
notGettable?: number;
futureEvolve?: number;
cp40?: number;
cp39?: number;
}
Loading