Skip to content

Conversation

@ericahan22
Copy link
Member

@ericahan22 ericahan22 commented Nov 29, 2025

Notion ticket link

Implement Admin Authorization

Implementation description

  • Added isAuthorizedAdmin query to determine if a user is an admin
  • Added necessary query resolvers and types
  • Needed to remove duplicate Review GraphQL type from reviewedApplicantRecordTypes.ts
  • Added migration to add createdAt and updatedAt columns to the admins table

Steps to test

  1. Boot up the frontend and log in with your own Blueprint account at http://localhost:3000/admin
  2. In your web dev tools, go to Storage > Local Storage > http://localhost:3000 and copy the value of the accessToken key
  3. Run the following query in the GraphQL playground and verify that isAuthorizedAdmin is false:
query {
  isAuthorizedAdmin(
    accessToken: "your_access_token",
  )
}
  1. Fire up pgAdmin and run SELECT * FROM USERS;, you should see a row with your own details
  2. Copy the number in id and run INSERT INTO admins ("userId", "authorizedDepartments") VALUES (your_id, '{}');
  3. Run the same query from step 3 again, isAuthorizedAdmin should now be true

What should reviewers focus on?

  • Just make sure it works lol

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

@ericahan22 ericahan22 self-assigned this Nov 29, 2025
Copy link
Collaborator

@gavxue gavxue left a comment

Choose a reason for hiding this comment

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

Code looks fine. However, I wasn't able to successfully go through the testing steps. Got stuck at step 4 when I was not able to see my details show up in the users table. Could another reviewer could verify this.

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.

2 participants