From 66aaef4b2e238fbd82d98845b00eb54525db4f84 Mon Sep 17 00:00:00 2001 From: woozai Date: Sun, 18 Aug 2024 11:30:20 +0300 Subject: [PATCH 1/2] fixed stats --- routes/posts.js | 3 +++ 1 file changed, 3 insertions(+) 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 From 4ee3ccf4dbc80b761913c00495921504bc449382 Mon Sep 17 00:00:00 2001 From: kobia77 Date: Sun, 18 Aug 2024 12:05:14 +0300 Subject: [PATCH 2/2] update readme --- README.md | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) 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 + ```