-
Notifications
You must be signed in to change notification settings - Fork 7
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
Merged
walker-sean
merged 19 commits into
feature/homepage-redesign
from
#2770-CaioDaSilva-getUserTasks
Sep 28, 2024
Merged
#2770-getUserTasks #2833
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5c10c8f
#2770-added get user tasks endpoint
caiodasilva2005 f0da467
#2770-more efficient query
caiodasilva2005 8c5a705
#2770-unused import
caiodasilva2005 d04f762
Merge branch 'feature/homepage-redesign' of https://github.com/Northe…
caiodasilva2005 c2cb306
#2770-added test
caiodasilva2005 13a3f4f
#2770-changed error message
caiodasilva2005 ca0fc03
#2770-use user param
caiodasilva2005 f6932c8
#2770-changed test wbs num
caiodasilva2005 78d505a
#2770-created test project
caiodasilva2005 f785165
#2770-linting errors
caiodasilva2005 d7fafc7
#2770- assigned test project to team
caiodasilva2005 259cdaf
#2770-forgot to await
caiodasilva2005 13ac9d8
#2770-fixed test
caiodasilva2005 7081c60
#2770-added invalid user id test
caiodasilva2005 bc54c1e
#2770-fixed test
caiodasilva2005 c6e51ee
#2770- added await
caiodasilva2005 2b094be
#2770-await
caiodasilva2005 1b968c2
#2770-await assertion
caiodasilva2005 5d5121f
#2770-added jsdoc
caiodasilva2005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ import { | |
} from '../prisma-query-args/user.query-args'; | ||
import { getAuthUserQueryArgs } from '../prisma-query-args/auth-user.query-args'; | ||
import authenticatedUserTransformer from '../transformers/auth-user.transformer'; | ||
import { getTaskQueryArgs } from '../prisma-query-args/tasks.query-args'; | ||
|
||
export default class UsersService { | ||
/** | ||
|
@@ -538,4 +539,26 @@ export default class UsersService { | |
|
||
return userScheduleSettingsTransformer(newUserScheduleSettings); | ||
} | ||
|
||
static async getUserTasks(userId: string, organization: Organization) { | ||
const requestedUser = await prisma.user.findUnique({ where: { userId } }); | ||
if (!requestedUser) throw new NotFoundException('User', userId); | ||
|
||
const tasks = prisma.task.findMany({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
where: { | ||
assignees: { | ||
some: { | ||
userId | ||
} | ||
}, | ||
wbsElement: { | ||
organizationId: organization.organizationId | ||
} | ||
}, | ||
...getTaskQueryArgs(organization.organizationId) | ||
}); | ||
|
||
if (!tasks) throw new HttpException(404, 'User tasks Not Found'); | ||
return tasks; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add jsdoc for this