Skip to content

Refactor user service methods findOne and findUserById #178

Description

@madisonweiss

Description: In users.service.ts there are two methods, findOne and findUserById. They do the same thing, except there is authentication logic in findOne. This is an example of deprecated and duplicate code, which is bad (violates single responsibility principle). To clean this up, remove all instances of findOne and replace it with findUserById. Additionally, extract the user authentication (admin vs applicant, etc.) logic from findOne and move it into the controller layer. Update tests as needed.

Acceptance Criteria:

  • All calls to findOne are replaced with findUserById
  • Authentication logic (admin vs applicant checks) is moved from service layer to controller layer
  • All existing tests are updated to reflect the changes → service layer tests for user authentication (ex: user.status == ADMIN) are removed

Effort Estimate:

  • T-shirt size: M

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions