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

Cleanup User Auth Code in GraphQL Resolvers #88

Open
Feyzanrs opened this issue Jul 11, 2024 · 0 comments · May be fixed by #100
Open

Cleanup User Auth Code in GraphQL Resolvers #88

Feyzanrs opened this issue Jul 11, 2024 · 0 comments · May be fixed by #100
Assignees
Labels
Be medium priority Important issues to be addressed soon waiting topic Issue is waiting for a topic label

Comments

@Feyzanrs
Copy link
Member

Feyzanrs commented Jul 11, 2024

In the pkg\presentation\controller\graphql\resolver\dlr.resolvers.go file of our GraphQL service, each resolver function begins with five lines of code handling user authentication checks. These lines are responsible for fetching the user ID and type from the context, and conditionally setting the user ID if the user is not an admin. As our authentication processes are now centrally managed by a dedicated authentication service, these checks within the resolver functions are redundant and need to be removed. This cleanup will help in maintaining a cleaner and more focused codebase, ensuring that each component adheres strictly to its designated responsibility.

Here are the lines that need to be removed from each function:

userId := ctx.Value(smodel.QueryKeyUid).(string)
userType := ctx.Value(smodel.QueryKeyUType).(pb_user.UserType)
if userType != pb_user.UserType_UserTypeADMIN {
	user.ID = &userId
}

The changes will be merged into the refactor/team/89/dlr-switch-book first. Therefore, set the base branch of the pull request as refactor/team/89/dlr-switch-book

@octopos-prime octopos-prime added Be medium priority Important issues to be addressed soon waiting topic Issue is waiting for a topic label labels Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Be medium priority Important issues to be addressed soon waiting topic Issue is waiting for a topic label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants