Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2770-getUserTasks #2833

Open
wants to merge 18 commits into
base: feature/homepage-redesign
Choose a base branch
from

Conversation

caiodasilva2005
Copy link
Contributor

@caiodasilva2005 caiodasilva2005 commented Sep 12, 2024

Changes

Added an endpoint to get all of a user's tasks.

Screenshots

image

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #2770

@bderbs30
Copy link
Contributor

There might be a more efficient way to query the assigned tasks. Right now you have it going through all the tasks and then finding the assignees from there. However it might be more efficient to go through the user (there is an assignedTasks field on the User object)

const requestedUser = await prisma.user.findUnique({ where: { userId } });
if (!requestedUser) throw new NotFoundException('User', userId);

const tasks = prisma.task.findMany({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can find the user then get assigned tasks from there. Though this might be trivial in reality and if this works then we can keep it as is. What are your thoughts?

@walker-sean walker-sean linked an issue Sep 19, 2024 that may be closed by this pull request
2 tasks
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.

[Home Page] - Create getUsersTasks Endpoint
2 participants