diff --git a/README.md b/README.md index 652d2df..b402278 100644 --- a/README.md +++ b/README.md @@ -1,42 +1,50 @@ # GameGrid Server ## Project Description + This is the backend server for GameGrid, a social network for gamers. It handles all server-side logic, data storage, and API endpoints for the client application. ## How to Install ### Requirements + - Node.js (v14 or higher) - npm (v6 or higher) - Git ### Installation -1. Clone the repository: - ```sh - git clone https://github.com/GameGrid-Team/gamegrid-server - cd gamegrid-server - ``` + +1. Clone the repository(branch should be main): + + ```sh + git clone https://github.com/GameGrid-Team/gamegrid-server + cd gamegrid-server + ``` 2. Install dependencies: - ```sh - npm install - ``` + ```sh + npm install + ``` ### Running the Server + 1. Start the server using nodemon: - ```sh - npm run dev - ``` + + ```sh + npm run dev + ``` 2. The server should now be running on `http://localhost:3001`. ### Linting and Testing + 1. Run ESLint: - ```sh - npm run lint - ``` + + ```sh + npm run lint + ``` 2. Run tests: - ```sh - npx cypress run - ``` + ```sh + npx cypress run + ``` diff --git a/routes/posts.js b/routes/posts.js index ad3311b..96b376c 100644 --- a/routes/posts.js +++ b/routes/posts.js @@ -239,6 +239,7 @@ module.exports = (db) => { } post.likes.users.push(userId) postCreator.social.rank.exp += 1 + postCreator.social.total_likes += 1 postCreator.social.rank = general.checkRank(postCreator.social.rank.exp) postDB.updateOne({ _id: new ObjectId(postId) }, { $set: post }) usersDB.updateOne({ _id: new ObjectId(post.user_id) }, { $set: postCreator }) @@ -314,6 +315,7 @@ module.exports = (db) => { } post.saves.users.push(userId) postCreator.social.rank.exp += 3 + postCreator.social.total_saves += 1 postCreator.social.rank = general.checkRank(postCreator.social.rank.exp) postDB.updateOne({ _id: new ObjectId(postId) }, { $set: post }) usersDB.updateOne({ _id: new ObjectId(post.user_id) }, { $set: postCreator }) @@ -438,6 +440,7 @@ module.exports = (db) => { .findOne(originalOwner) .then((user) => { user.social.rank.exp += 4 + user.social.total_share += 1 user.social.rank = general.checkRank(user.social.rank.exp) usersDB.updateOne(originalOwner, { $set: user }) postBody.shared = true