From df45f04f21f43427c7002f53425ac5cb72ced3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Jos=C3=A9?= Date: Tue, 12 Jul 2022 10:29:05 -0300 Subject: [PATCH] 2.0.1 - Togyer (#128) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add backup scheduler to mongodb miaAjudaDB database. * Add rclone file to .gitignore. * Add docker-compose prod file to backup database. * Update README.md with database backup instructions. * Standart pages name to start with capital letter * Change middleware to routes.use * Finish helpOffer structure and fix route mess * Create help offer methods and routes Co-authored-by: Co-authored-by: Ivan Dobbin * Create addPossibleHelpedUsers in service and controller Co-authored-by: gabrieldvpereira Co-authored-by: Ivan Dobbin * Created Entity model * Created Entity routes * Created Entity repository * Created Entity controller * Created Entity Service and update validation on User Service * Add route addPossibleHelpedUsers * Add email option to check user or entity existence. * Delete unused route * Change help request route name * Fix eslint problems and improve code readability. * Removing console.log * Remove console logs and insert await in call of async functions * Create function shortList * Put authentication in getHelpList * Initial find without agregation * Change the model to recieve an array of category * Add projection to show just wanted fields in agreggation * Added first version of Campaign backend * Added a new info to know track user type on firebase * remove console.logs * Create route to retrieve the rest of the informations of a help * Gotten campaign with coords from back * Created delete route and remove unused functions * Create help category * Fix error of finding helps of the own user * Add rclone backup to gitlab CI/CD. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * 96 - Add aggregation in get help by id * Fixed routes with same name * Initial project * Passing campaigns status to front and now entity can help user * 96 - Add route to get help with aggregation of user data * Create helpOffer agreggation * lookup on categories * add possible entities to help * Fix error in socket and error with getHelpListByStatus * Updated Back to delete campaigns * Show only the needed information of a possibleHelper * Fixed bug when choose an entity as helper * Set the offerhelp list to not return user own offers * Add sort by date offerhelp * Added a new route to get any type of user * Separate the fields that only myRequests or myOffer uses * Now help offers of an entity are listed * Remove return from createHelp * Added a new file to ignore * Delete miaajuda.pem hsa private key cant be null * fix bug that prevent the server to return user own help * Help update routes do not return content. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Create logic to return user photo seperaly * Remove function to get user photo * Create function for aggregation of createHelp and shortList. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Revert "Remove function to get user photo" This reverts commit 59f8123232287b95bd99334fff856a2f335d2cfc. * Reverting Commit on develop * Merge and fixed commits * Fix problem to return possiblehelpoers for a help Co-authored-by: DanilloGs * Fixing lint problems * resolve conflicts * 96 - Change aggregations fields * Bump bcrypt from 4.0.1 to 5.0.0 Bumps [bcrypt](https://github.com/kelektiv/node.bcrypt.js) from 4.0.1 to 5.0.0. - [Release notes](https://github.com/kelektiv/node.bcrypt.js/releases) - [Changelog](https://github.com/kelektiv/node.bcrypt.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/kelektiv/node.bcrypt.js/compare/v4.0.1...v5.0.0) Signed-off-by: dependabot[bot] * Resolved conflicts * Added logic to finish a campaign * Fix the bug to return my own helpoffer * Update HelpOfferController.js Remove console.log * Remove getHelpId from route and controller as it is not being used in front-end * Change getHelpListByStatus to retrieve possibleEntities and getByIdWithAggregation to retrieve a help Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Filter Offers Co-authored-by: Duda Melo * Add project to getByIdWithAggregation. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Bump bl from 2.2.0 to 2.2.1 Bumps [bl](https://github.com/rvagg/bl) from 2.2.0 to 2.2.1. - [Release notes](https://github.com/rvagg/bl/releases) - [Commits](https://github.com/rvagg/bl/compare/v2.2.0...v2.2.1) Signed-off-by: dependabot[bot] * Bump node-fetch from 2.6.0 to 2.6.1 Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] * create route to send notifications to all users * Create route for deleting a helpOffer. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Add authorization before deleting an OfferHelp. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Fixed route to get only help offers from owner * #44 - Fixed route to return help offers Co-authored-by: Dâmaso Júnio * #44 - List of help offers is done Co-authored-by: Damaso Junio * Rota para pegar uma Campanha Individual Co-authored-by: Joao Pedro * Bump socket.io from 2.3.0 to 2.4.0 Bumps [socket.io](https://github.com/socketio/socket.io) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/socketio/socket.io/releases) - [Changelog](https://github.com/socketio/socket.io/blob/2.4.0/CHANGELOG.md) - [Commits](https://github.com/socketio/socket.io/compare/2.3.0...2.4.0) Signed-off-by: dependabot[bot] * Add notification to route /helpOffer/possibleHelpedUsers. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Insert validation to /helpOffer/possibleHelpedUsers/ to check if user is already on possibleHelpedUsers. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Create function that checks if user is entity or not. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Create global variable that informs if user is entity or not. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Create function that finds one entity with provided projection. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Send notification to Offer owner when another user requests help. Co-authored-by: Ivan Dobbin Co-authored-by: Welison Almeida * Fix error message * US57 - Agora a ONG pode finalizar uma campanha quando for necessario * Update CampaignRoutes.js * Update CampaignRoutes.js * Bump lodash from 4.17.19 to 4.17.21 Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21) Signed-off-by: dependabot[bot] * Bump hosted-git-info from 2.8.8 to 2.8.9 Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9. - [Release notes](https://github.com/npm/hosted-git-info/releases) - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md) - [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9) Signed-off-by: dependabot[bot] * User can't help his own offer * Bump ws from 7.4.2 to 7.4.6 Bumps [ws](https://github.com/websockets/ws) from 7.4.2 to 7.4.6. - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/7.4.2...7.4.6) Signed-off-by: dependabot[bot] * Fix retrieve of offers in map and in MINHAS OFERTAS * Bump glob-parent from 5.1.1 to 5.1.2 Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2. - [Release notes](https://github.com/gulpjs/glob-parent/releases) - [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md) - [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) --- updated-dependencies: - dependency-name: glob-parent dependency-type: indirect ... Signed-off-by: dependabot[bot] * Bump normalize-url from 4.5.0 to 4.5.1 Bumps [normalize-url](https://github.com/sindresorhus/normalize-url) from 4.5.0 to 4.5.1. - [Release notes](https://github.com/sindresorhus/normalize-url/releases) - [Commits](https://github.com/sindresorhus/normalize-url/commits) --- updated-dependencies: - dependency-name: normalize-url dependency-type: indirect ... Signed-off-by: dependabot[bot] * add route to get helpOffer aggregation by id Co-authored-by: Brian Pina de Sá Co-authored-by: Ivan Dobbin * Fix error when setting userType * Bump socket.io-parser from 3.3.0 to 3.3.2 Bumps [socket.io-parser](https://github.com/socketio/socket.io-parser) from 3.3.0 to 3.3.2. - [Release notes](https://github.com/socketio/socket.io-parser/releases) - [Changelog](https://github.com/socketio/socket.io-parser/blob/3.3.2/CHANGELOG.md) - [Commits](https://github.com/socketio/socket.io-parser/compare/3.3.0...3.3.2) --- updated-dependencies: - dependency-name: socket.io-parser dependency-type: indirect ... Signed-off-by: dependabot[bot] * Refactor aggregations to remove duplication * Solve - Updating Contributing Guide (#109) * docs: add contributing guide * style: add commit lint * docs: fix documents * feat: Adding the correct aggregation return from helpOfferRepository (#110) Co-authored-by: Thiago Paiva * fix: populating help with possibleHelpers Co-authored-by: Rafael Cleydson * Bump tar from 4.4.13 to 4.4.15 (#113) Bumps [tar](https://github.com/npm/node-tar) from 4.4.13 to 4.4.15. - [Release notes](https://github.com/npm/node-tar/releases) - [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md) - [Commits](https://github.com/npm/node-tar/compare/v4.4.13...v4.4.15) --- updated-dependencies: - dependency-name: tar dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump path-parse from 1.0.6 to 1.0.7 (#115) Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * 174-refactoring aggregations (#112) * refactor: getHelpInfoById aggregation Also update Help's categoryId Field to be an array Co-authored-by: Thiago Paiva Co-authored-by: Ivan Dobbin * Refactor: change create function in help repository and create function populateExistingDoc in Base repository Co-authored-by: Lucas Amoêdo Co-authored-by: Thiago Paiva * Refactor: changing getEmailBYHelpOfferId's query to populate * Refactor: adding categories virtual field * Refactor: Refactoring getByIdWithAggregation to populate * Refactor: refactoring list method to populate * Refactor: adding sort methods * Refactor: renaming category virtual field to categories * Refactor: refactoring getCampaignListByStatus to populate * Refactor: adding distances virtual fields * Refactor: refactoring listNear to populate * Refactor: renaming category virtual field to categories * Refactor: refactoring getByIdWithAggregation to populate * Refactor: adding distances virtual fields * Refactor: refactoring listNear method to populate The toObject method was necessary because without it the array was not updating * Refactor: getHelpListByStatus aggregation in Help Only part of it was refactored so far. The condition when we inform a helper ID is not working yet. * Refactor: getHelpListByStatus aggregation in Help The condition when a helper is sent is now handled. * Refactor: add missing categories to help Co-authored-by: Lucas Amoêdo Co-authored-by: Thiago Paiva * US45 - Aceitação de pessoas interessadas para ajudar (#116) * feat: Choosing helped user from interesteds on help offer Co-authored-by: Damaso Junio * Changing chooseHelpedUser route name * feat: changing from aggregations to populate method Co-authored-by: Thiago Paiva Co-authored-by: Lucas Amoêdo * fix: adding isAuthenticated to access helpOffer routes * feat: abstracting addHelped and addPossibleHelped methods on helpOfferService * fix: adding helpOffer/helpedId params at isUserInPossibleHelpedUsers method * fix: Modifying virtual helpedUser ref and helpOfferFields on list func * fix: Adding the corect param to possibleHelpedUser notification Co-authored-by: Damaso Junio Co-authored-by: Thiago Paiva Co-authored-by: Lucas Amoêdo * US43: Deletando Oferta de Ajuda e Notificando pelo Socket (#114) * Feat: sending deleted helpOffer to socket Co-authored-by: Rodrigo Balbino * Fix: refactoring finish help offer Co-authored-by: thiagohdaqw * Bump tar from 4.4.15 to 4.4.19 (#119) Bumps [tar](https://github.com/npm/node-tar) from 4.4.15 to 4.4.19. - [Release notes](https://github.com/npm/node-tar/releases) - [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md) - [Commits](https://github.com/npm/node-tar/compare/v4.4.15...v4.4.19) --- updated-dependencies: - dependency-name: tar dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump ajv from 6.12.2 to 6.12.6 (#121) Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.12.2 to 6.12.6. - [Release notes](https://github.com/ajv-validator/ajv/releases) - [Commits](https://github.com/ajv-validator/ajv/compare/v6.12.2...v6.12.6) --- updated-dependencies: - dependency-name: ajv dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump minimist from 1.2.5 to 1.2.6 (#122) Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump node-fetch from 2.6.1 to 2.6.7 (#124) Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7. - [Release notes](https://github.com/node-fetch/node-fetch/releases) - [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7) --- updated-dependencies: - dependency-name: node-fetch dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Hotfix - Filtro de ajuda/oferta da Instituição já candidatada (#118) * Feat: filtering the help and offer already applied * Fix: passing isUserEntity as params * Bump protobufjs from 6.9.0 to 6.11.3 (#123) Bumps [protobufjs](https://github.com/protobufjs/protobuf.js) from 6.9.0 to 6.11.3. - [Release notes](https://github.com/protobufjs/protobuf.js/releases) - [Changelog](https://github.com/protobufjs/protobuf.js/blob/v6.11.3/CHANGELOG.md) - [Commits](https://github.com/protobufjs/protobuf.js/compare/v6.9.0...v6.11.3) --- updated-dependencies: - dependency-name: protobufjs dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * update readme * feat: add help creation date on getHelpRequest (#126) * fix: add creation date to helpoffer repository (#127) Co-authored-by: Welison Almeida Co-authored-by: Gabriel Davi Co-authored-by: Co-authored-by: Ivan Dobbin Co-authored-by: Danillo Souza Co-authored-by: Ivan Diniz Dobbin <42387797+darmsDD@users.noreply.github.com> Co-authored-by: Pedro Féo Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: saleh Co-authored-by: Duda Melo Co-authored-by: Dâmaso Júnio Co-authored-by: Rafael Ramos <74625814+RcleydsonR@users.noreply.github.com> Co-authored-by: Brian Pina de Sá Co-authored-by: Saleh Kader <35435199+devsalula@users.noreply.github.com> Co-authored-by: Thiago Paiva Co-authored-by: Thiago Paiva <54081877+thiagohdaqw@users.noreply.github.com> Co-authored-by: Rafael Cleydson Co-authored-by: Lucas Amoêdo Co-authored-by: Rodrigo Balbino <54644626+Balbinoo@users.noreply.github.com> Co-authored-by: Guilherme Barbosa Ferreira <200037994@aluno.unb.br> --- src/repository/HelpOfferRepository.js | 3 ++- src/repository/HelpRepository.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/repository/HelpOfferRepository.js b/src/repository/HelpOfferRepository.js index 1642e213..6e2a1879 100644 --- a/src/repository/HelpOfferRepository.js +++ b/src/repository/HelpOfferRepository.js @@ -27,7 +27,8 @@ class OfferdHelpRepository extends BaseRepository { 'categoryId', 'possibleHelpedUsers', 'possibleEntities', - 'helpedUserId' + 'helpedUserId', + 'creationDate' ]; const user = { path: 'user', diff --git a/src/repository/HelpRepository.js b/src/repository/HelpRepository.js index 795aa499..aaa6c4be 100644 --- a/src/repository/HelpRepository.js +++ b/src/repository/HelpRepository.js @@ -89,7 +89,7 @@ class HelpRepository extends BaseRepository { $in: categoryArray.map((categoryString) => ObjectID(categoryString)), }; } - const helpFields = ['_id', 'title', 'description', 'categoryId', 'ownerId']; + const helpFields = ['_id', 'title', 'description', 'categoryId', 'ownerId', 'creationDate']; const user = { path: 'user', select: ['name', 'riskGroup', 'location.coordinates']