Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: support filtering users table by login type #17238

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

Merged
merged 15 commits into from
Apr 9, 2025

Conversation

utsavll0
Copy link
Contributor

@utsavll0 utsavll0 commented Apr 3, 2025

#15896 Mentions ability to add support for filtering by login type

The issue mentions that backend API support exists but the backend did not seem to have the support for this filter. So I have added the ability to filter it.

I also added a corresponding update to readme file to make sure the docs will correctly showcase this feature

@cdr-bot cdr-bot bot added the community Pull Requests and issues created by the community. label Apr 3, 2025
Copy link

github-actions bot commented Apr 3, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@utsavll0 utsavll0 changed the title PR: Fixes #15896 Support filtering Users table by login type feat(backend) support filtering Users table by login type Apr 3, 2025
@utsavll0 utsavll0 changed the title feat(backend) support filtering Users table by login type feat: support filtering Users table by login type Apr 3, 2025
@utsavll0
Copy link
Contributor Author

utsavll0 commented Apr 3, 2025

I have read the CLA Document and I hereby sign the CLA

cdrci2 added a commit to coder/cla that referenced this pull request Apr 3, 2025
@utsavll0 utsavll0 changed the title feat: support filtering Users table by login type feat: support filtering users table by login type Apr 3, 2025
@ethanndickson
Copy link
Member

ethanndickson commented Apr 3, 2025

Thanks for the PR!

Looking good so far, but we'll need some tests. I believe the right place for those is coderd/users_test.go

Also, please run make fmt/go, make lint/go, and make gen after each change!

@utsavll0
Copy link
Contributor Author

utsavll0 commented Apr 3, 2025

@ethanndickson I added a few tests for the PR and I also ran the commands which you mentioned

Edit: Can you please help me in running the users_test.go file? I am not able to figure out why the test is failing. Making a call from the frontend works fine but the unit test keeps on failing. I am not sure if there is some extra config required to make it run

Copy link
Member

@ethanndickson ethanndickson left a comment

Choose a reason for hiding this comment

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

Your newly written tests are failing as, by default, DB queries are ran against a fake DB in dbmem.go. You'll need to update the GetUsers Go function with the same logic as the Postgres query.

To run go test against postgres, just set DB=ci:
DB=ci go test -run "TestGetUsersFilters" github.com/coder/coder/v2/coderd
(This is essentially what make test-postgres does)

Copy link
Member

@ethanndickson ethanndickson left a comment

Choose a reason for hiding this comment

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

Nice work on these tests! Just a few comments, mostly on style.

CI is all passing except for weekly-docs / check-docs, which you can safely ignore (it should go away if you merge / rebase your branch off main)

@utsavll0
Copy link
Contributor Author

utsavll0 commented Apr 8, 2025

Thank you for your feed @ethanndickson. I am to blame for these silly errors because of my over-reliance on copilot. I have fixed the style and removed unnecessary comments from the code. Please have a look again.

@utsavll0
Copy link
Contributor Author

utsavll0 commented Apr 8, 2025

ok @ethanndickson I think this final test should do it

Copy link
Member

@ethanndickson ethanndickson left a comment

Choose a reason for hiding this comment

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

Looking good, just two comments on the copy.

ethanndickson
ethanndickson previously approved these changes Apr 9, 2025
Copy link
Member

@ethanndickson ethanndickson left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the PR and your patience through these review cycles! ❤️

@ethanndickson ethanndickson dismissed their stale review April 9, 2025 03:51

Waiting for macOS runner issue to be resolved, will reapprove

@utsavll0
Copy link
Contributor Author

utsavll0 commented Apr 9, 2025

Thank you @ethanndickson for staying with me. This was my first ever PR in Go and I learned a lot. 🥳 🍾

@ethanndickson ethanndickson merged commit 0e65821 into coder:main Apr 9, 2025
31 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
community Pull Requests and issues created by the community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants