Skip to content
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

Argent-bank #49

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
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
74f3842
💄 Add react components
Gizmoux May 16, 2024
bb75997
💄 Add user token
Gizmoux May 24, 2024
2e823d0
✅ Add edit name
Gizmoux Jun 7, 2024
098fdd6
✅ Add authSlice
Gizmoux Jun 7, 2024
f2368c6
✅ Add SignIn
Gizmoux Jun 7, 2024
fdf6a9c
✅ Add editName
Gizmoux Jun 10, 2024
c693a08
📝 Update readme
Gizmoux Jun 11, 2024
e85bac3
✅ Add authenticated state
Gizmoux Jun 11, 2024
e1e2c56
update readme
Gizmoux Jun 12, 2024
6bc72a2
Update User
Gizmoux Jun 27, 2024
84fe066
Add documentation in README
Gizmoux Jun 28, 2024
c2f054a
update navbar
Gizmoux Jun 28, 2024
94c7628
update authSlice
Gizmoux Jun 28, 2024
0d5b1de
add useEffect Signin
Gizmoux Jun 28, 2024
9a6bebf
add useEffect User
Gizmoux Jun 28, 2024
918fb25
userController
Gizmoux Jun 28, 2024
f0845e7
Add hooks.ts for useAppDispatch
Gizmoux Jun 28, 2024
ad0b6d9
Modify User with useAppdispatch
Gizmoux Jun 28, 2024
5bc3081
Add documentation
Gizmoux Jun 28, 2024
92e0b7f
Documentation in english
Gizmoux Jun 28, 2024
b321c50
update User
Gizmoux Jun 28, 2024
078cd9d
update signin
Gizmoux Jul 1, 2024
ed75aaa
Add endpoints in swagger.yaml
Gizmoux Jul 1, 2024
a730cef
Update yaml
Gizmoux Jul 1, 2024
f63fa81
modify Readme
Gizmoux Jul 11, 2024
b734f37
update swagger
Gizmoux Jul 11, 2024
7a5a21b
update readme
Gizmoux Jul 31, 2024
b13c6f6
cleaning signin
Gizmoux Jul 31, 2024
c9a7347
cleaning user
Gizmoux Jul 31, 2024
e1d53ff
update readme
Gizmoux Jul 31, 2024
c03fd9f
navigate /login if there is no token
Gizmoux Sep 23, 2024
13814bc
♻️ Update Navbar
Gizmoux Sep 23, 2024
040af45
♻️ update signin
Gizmoux Sep 23, 2024
94c244e
♻️ update User
Gizmoux Sep 23, 2024
e7a6fe4
cleaning authSlice
Gizmoux Sep 23, 2024
55fcf15
update routes
Gizmoux Sep 23, 2024
6e3f0e3
add post in transactions in swagger
Gizmoux Sep 25, 2024
207b7b9
add an alert if user is not registered
Gizmoux Sep 25, 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
97 changes: 67 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Project #10 - Argent Bank API
# Project #13 - Argent Bank API

This codebase contains the code needed to run the backend for Argent Bank.

Expand All @@ -10,47 +10,80 @@ Argent Bank uses the following tech stack:

- [Node.js v12](https://nodejs.org/en/)
- [MongoDB Community Server](https://www.mongodb.com/try/download/community)
- [Git](https://git-scm.com)
- [Node.js v12](https://nodejs.org/en/)
- [MongoDB Community Server](https://www.mongodb.com/try/download/community)
Please make sure you have the right versions and download both packages. You can verify this by using the following commands in your terminal:

Please make sure you have the right versions and download both packages. You can verify this by using the following commands in your terminal:
### Dépendances :

```bash
# Check Node.js version
node --version
- [React](https://reactjs.org)
- [React-router-dom](https://reactrouter.com/): ^6.23.1
- [React-redux](https://react-redux.js.org/): ^9.1.2
- [@reduxjs/toolkit](https://redux-toolkit.js.org/): ^2.2.5

# Check Mongo version
mongo --version
```
Your server should now be running at http://locahost:3001 and you will now have two users in your MongoDB database!

### Instructions
## Populated Database Data

1. Fork this repo
1. Clone the repo onto your computer
1. Open a terminal window in the cloned project
1. Run the following commands:
Once you run the `populate-db` script, you should have two users in your database:

```bash
# Install dependencies
npm install
## API Documentation

# Start local dev server
npm run dev:server
To learn more about how the API works, once you have started your local environment, you can visit: http://localhost:3001/api-docs

# Populate database with two users
npm run populate-db
```
## Design Assets

Your server should now be running at http://locahost:3001 and you will now have two users in your MongoDB database!
Static HTML and CSS has been created for most of the site and is located in: `/designs`.

## Populated Database Data
For some of the dynamic features, like toggling user editing, there is a mock-up for it in `/designs/wireframes/edit-user-name.png`.

Once you run the `populate-db` script, you should have two users in your database:
And for the API model that you will be proposing for transactitons, the wireframe can be found in `/designs/wireframes/transactions.png`.

## Installation :

### Installation Procedure:

Clone the repository:

- git clone https://github.com/Gizmoux/Project-10-Bank-API.git

### Installation and launching of the Back-end:

1. Go to the Argent-bank folder

- cd Argent-bank

2. Check Node version:

- `node --version`

3. Check MongoDB version:

- `mongo --version`

4. Install all dependencies for the back-end:

- `npm install` or `yarn`

5. Launch the back-end with Node 16 (nvm) and create 2 users in the database:

```bash
nvm use 16
npm run dev:server
npm run populate-db
```

## Users in database:

### Tony Stark

- First Name: `Tony`
- Last Name: `Stark`
- Email: `[email protected]`
- Password: `password123`
- token : eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2OGZlMWI5NWU2YWE5MmEzYzExNzliMCIsImlhdCI6MTcyNzA4MzUwMCwiZXhwIjoxNzI3MTY5OTAwfQ.z8e79HaeqW_KVSWiyWlJ6KmnW5W66dmKt-JY8OCpljs
- Méthode POST sur postman : http://localhost:3001/api/v1/user/login avec le bearer token que l'on a récupéré depuis la route /login

### Steve Rogers

Expand All @@ -59,14 +92,18 @@ Once you run the `populate-db` script, you should have two users in your databas
- Email: `[email protected]`,
- Password: `password456`

## API Documentation
### Installation and launch of the front-end in a new terminal:

To learn more about how the API works, once you have started your local environment, you can visit: http://localhost:3001/api-docs
1. Go to the argent-bank folder:

## Design Assets
- cd argent-bank

Static HTML and CSS has been created for most of the site and is located in: `/designs`.
2. Install all dependencies and launch the frontend:

For some of the dynamic features, like toggling user editing, there is a mock-up for it in `/designs/wireframes/edit-user-name.png`.
```bash
cd argent-bank
npm run dev
```

And for the API model that you will be proposing for transactitons, the wireframe can be found in `/designs/wireframes/transactions.png`.
The front-end will be launched at the URL:
`http://localhost:5173/`
18 changes: 18 additions & 0 deletions argent-bank/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions argent-bank/.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?
35 changes: 35 additions & 0 deletions argent-bank/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
export default {
// other rules...
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
};
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list

# Start

- cd argent-bank
- npm run dev
17 changes: 17 additions & 0 deletions argent-bank/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<script
src="https://kit.fontawesome.com/25a6e78e8b.js"
crossorigin="anonymous"
></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Argent Bank</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading