Skip to content

Sync dev to main#1186

Merged
prakashchoudhary07 merged 7 commits intomainfrom
develop
Jun 21, 2023
Merged

Sync dev to main#1186
prakashchoudhary07 merged 7 commits intomainfrom
develop

Conversation

@RitikJaiswal75
Copy link
Contributor

@RitikJaiswal75 RitikJaiswal75 commented Jun 21, 2023

Date: 21 June 2023
Developer Name: @RitikJaiswal75 @TanishqSingla @prerana1821

PR Number(s):-

Backend changes

  • Yes
  • No

Frontend Changes

  • Yes
  • No

Database changes

  • Yes
  • No

Breaking changes (If your feature is breaking/missing something please mention pending tickets)

  • Yes
  • No

Deployment notes
Any special instructions for the deployment

Tested in staging

  • Yes
  • No

List of PRs going in this Sync.

Also, attach their screenshots.

image

RitikJaiswal75 and others added 7 commits June 15, 2023 18:14
* feat: Add get route for tasks requests for Super User

* feat: Add createTaskRequest model function

* feat: Add controller for adding task request

* feat: Edit assign task flow to create task reques instead

      Earlier in the task flow the user would automatically be assigned
      the task, in this change the flow is changed to create a task
      request first which will be approved by superuser

* feat: Add controllers and model functions for task tasksRequests

      Update create task request model function
      Add approve task controller and model fucntion
      Add fetch tasks for user controller and model function

* fix: Call createTaskRequest model function in task controller

* feat: Add function to validate task request payload

      toFirestoreData for task request has been added
      This function validates the payload and returns a valid firestore
      object.

* feat: Make create task request a working implementation from stub

* feat: Add endpoint for task requests

* feat: Make fetch requests working from stub

* feat: Make approve task route working from stub

* test: Add test for put request in task request

* fix: Task request when a already existed task is requested by another user

* test: Add test for already existing tasks requests

* fix: task requests cached response is fetched to unauthorized users

* tests: add tests for fetch request

* test: Add test for approve task request

* feat: Add more test for approve tasks

* fix: Return response instead of throwing error in controllers

* feat: update task request controller added

* refactor: Add different controller for updating task request requestor

          Earlier createTaskRequest handled updation and creation of
          task request, this controller had been deconstructed into two
          controllers i.e createTaskRequest and addRequestor

* fix: Make one function for updating and creating task request

* fix: change create controller name to addOrUpdate

     add sinon stubs in test

* fix: remove mock verify function that wraps sinon stub

* Delete empty file

* fix: Change createTaskRequest to addOrUpdate

* fix: Task request error message for task does not exist

* refactor(tasksRequests): Review comments

                         Use shorthand firestore methode `docs` for
                         creating array of tasksRequests
                         Fix server errors

* feat: send user to task request fetch api

* fix: Check user status before creating task request

Check if the user status exists before creating task request

* fix: Review changes

- Use array.some for requestors
- Store taskId in the taskrequest obj
- Fix test description for approve route on 400 request status

* fix: Review comments

- Fixed variable name from requestorExists to already requesting
- Restrict OOO and active users to request for tasks

* fix: Review comments

- Remove redundant `.limit()`
- Remove redundant if statement

* fix: match task request data with the data-model

* refactor: code restructure for taskrequests controller and models

* feat: Fix visited users bug mentioned in review comments

* fix: fetchTaskRequest task request requestors data

* fix: Review comments

* fix: Use Promise.all to fetch task requests

* fix: Generic Object Sink

* test: Improve test coverage

Covering all test cases for controllers, improving it from 86.95 to
89.18
* docs: made the prerequisites setup more clear

* docs: fixed an unwanted change

* feat: initial setup for 100ms

* fix: private variable issue

* feat: rooms apis

* feat: added jsdoc comments to the controller and model

* fix: added object destructuring to payloads

* test: added unit tests for models

* test: added integration tests for room APIs

* fix: removed logs

* fix: added constant and refresh token function.

* fix: replaced uuid with crypto package to generate the unique ids.

* fix: unit test for event update API

* fix: removed crypto module

* fix: rooms to events

* fix: fallback for env variables in prod

* fix: changed the endActiveRoom from delete to patch

* fix: env variables in prod

* feat: added removeUnwantedProperties utility function

* fix: added env in test config

* fix: getAllRooms controller

* chore: added env variables to the config

* fix: sinon variable naming

* fix: added www-authenticate header check and removed payload check in post method

* fix: added config default value and removed extra expiration check in isTokenExpired method

* fix: changed naming from rooms to events everywhere

* fix: integration and unit tests according to the changes

* add: added validators for response

* fix: added a constant and updated the imports

* fix: joinEvent API

* fix: integration test for event apis

* fix: utility function

* fix: integration tests for events
Co-authored-by: sanketumesh.dhabarde <sanketumesh.dhabarde@clarivate.com>
* add unverified role to all users who have not linked their discord id

* add unit tests

* add integration tests

* move generate auth token for cloudflare to a util

* beautify addRoleToUser function in services

* add role id to test config

* add unverified role id to configs

* change the url from discord actions to post users
const { validateUser } = require("../middlewares/taskRequests");

router.get("/", authenticate, authorizeRoles([SUPERUSER]), cache(), taskRequests.fetchTaskRequests);
router.post("/addOrUpdate", authenticate, validateUser, taskRequests.addOrUpdate);

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [authorization](1), but is not rate-limited. This route handler performs [authorization](2), but is not rate-limited. This route handler performs [authorization](3), but is not rate-limited.

router.get("/", authenticate, authorizeRoles([SUPERUSER]), cache(), taskRequests.fetchTaskRequests);
router.post("/addOrUpdate", authenticate, validateUser, taskRequests.addOrUpdate);
router.patch("/approve", authenticate, authorizeRoles([SUPERUSER]), validateUser, taskRequests.approveTaskRequest);

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [authorization](1), but is not rate-limited. This route handler performs [authorization](2), but is not rate-limited. This route handler performs [authorization](3), but is not rate-limited.
const authenticate = require("../middlewares/authenticate");
const eventsValidator = require("../middlewares/validators/events");

router.post("/", authenticate, eventsValidator.createEvent, events.createEvent);

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [authorization](1), but is not rate-limited. This route handler performs [authorization](2), but is not rate-limited. This route handler performs [authorization](3), but is not rate-limited.
router.get("/", eventsValidator.getAllEvents, events.getAllEvents);
router.post("/join", eventsValidator.joinEvent, events.joinEvent);
router.get("/:id", eventsValidator.getEventById, events.getEventById);
router.patch("/", authenticate, eventsValidator.updateEvent, events.updateEvent);

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [authorization](1), but is not rate-limited. This route handler performs [authorization](2), but is not rate-limited. This route handler performs [authorization](3), but is not rate-limited.
router.post("/join", eventsValidator.joinEvent, events.joinEvent);
router.get("/:id", eventsValidator.getEventById, events.getEventById);
router.patch("/", authenticate, eventsValidator.updateEvent, events.updateEvent);
router.patch("/end", authenticate, eventsValidator.endActiveEvent, events.endActiveEvent);

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [authorization](1), but is not rate-limited. This route handler performs [authorization](2), but is not rate-limited. This route handler performs [authorization](3), but is not rate-limited.
@prakashchoudhary07 prakashchoudhary07 merged commit 810947e into main Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants