Skip to content

Cleanup User Auth Code in GraphQL Resolvers #88

@Feyzanrs

Description

@Feyzanrs

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

Metadata

Metadata

Assignees

Labels

Bemedium priorityImportant issues to be addressed soonwaiting topicIssue is waiting for a topic label

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions