From abcd758f54bc51e8fa100be8266703d641fc5695 Mon Sep 17 00:00:00 2001
From: Baptiste CERDAN <baptiste.owenia@gmail.com>
Date: Wed, 15 Dec 2021 16:46:19 +0100
Subject: [PATCH] :sparkles: change README and auth.js

---
 README.md              | 72 ++++++------------------------------------
 backend/routes/auth.js | 20 ------------
 2 files changed, 9 insertions(+), 83 deletions(-)

diff --git a/README.md b/README.md
index 2495382..8447098 100644
--- a/README.md
+++ b/README.md
@@ -1,73 +1,19 @@
-# jwt-express-react-example
+# Student Part - ERP 2021
 
-A two part example application with a frontend and backend.
-
-Try it out at: http://jwt-express-react-example.trina.si/
-
-
-## Functionality
-
-- Sign up
-- Log in
-- [Logged in] Log out
-- [Logged in] Change password
-- List of all users in the application (sorted by most-liked first)
-- Show all users that are currently in the system
-- Show number of likes
-- [logged in] Like/unlike a user
-- jwt token authentication with passport
-- At least one test for all endpoints
-
-## Tools used
-
-- [Node.js](https://nodejs.org/en/) v8 (async/await functionality)
-- [mongodb](https://www.mongodb.com/), [mongoose](https://mongoosejs.com/)
-- [Express.js](https://expressjs.com/)
-- [Passport.js](http://www.passportjs.org/) for authentication
-- [ReactJS](https://reactjs.org/)
-- [Redux](https://redux.js.org/) for state management
-- [Mocha](https://mochajs.org/) for testing
+## Baptiste CERDAN, Victor VOGT, Thomas STEINMETZ, Janos FALKE
 
 ## REST endpoints
 Features the following REST endpoints:
 
-- /signup
-
-    Sign up to the system (username, password)
-    
-- /login
-
-    Logs in an existing user with a password
-    
-- **/me**
-
-    Get the currently logged in user information
-    
-- **/me/update-password**
-
-    Update the current user's password
-    
-- /user/:username/
-
-    List username & number of likes of a user
-
-- **/user/:username/like**
-
-    Like a user
-
-- **/user/:username/unlike**
-
-    Unlike a user
+- **/api/signup**
 
-- /most-liked
+- **/api/login**
 
-    List users in a most liked to least liked
+- **/api/pay_adhesion**
 
-Each user can like another only once, and they can unlike each other.
-The bolded endpoints are authenticated calls.
+- **/api/me**
 
-## Usage
+- **/api/me/update**
 
-### Development
-- Run `npm start` in `frontend/`, server will run at `http://localhost:3000`
-- Run `npm start` in `backend/`, server will run at `http://localhost:8000`
+## Development
+- Run `npm start`, server will run at `http://localhost:8005` and MongoDB `http://localhost:27017`
diff --git a/backend/routes/auth.js b/backend/routes/auth.js
index 3a40dbf..a4fa60e 100644
--- a/backend/routes/auth.js
+++ b/backend/routes/auth.js
@@ -141,24 +141,4 @@ router.post('/me/update', passport.authenticate('jwt', {session: false}), async
     res.status(200).json();
 });
 
-router.post('/pay_adhesion', passport.authenticate('jwt', {session: false}), async function(req, res, next) {
-    const student_number = req.body.student_number;
-
-    if (!student_number)
-        return res.status(400);
-
-    const dbUser = await User.findOne({student_number: req.body.student_number});
-
-
-    if (student_number)
-        dbUser.date_subscription = new Date();
-
-    try {
-        await dbUser.save();
-    } catch (e) {
-        return res.status(400).json(e);
-    }
-    res.status(200).json();
-});
-
 module.exports = router;
-- 
GitLab