-
Notifications
You must be signed in to change notification settings - Fork 0
Retrieve all users #75
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7d7871f
Added members list view for admin users
Arshadul-Monir 762de58
Replaced getAllMembers with getMembersByFilters
Arshadul-Monir 5b5854c
Added pagination for members
Arshadul-Monir 291ec48
fixed failing tests
Arshadul-Monir 09eba03
Addressed nit fixes
Arshadul-Monir adae2d1
changed frontend filtering to text boxes
Arshadul-Monir 09e1771
Added default page and default page size to MemberFilterCriteria
Arshadul-Monir b5867c4
Removed redundant buildGetMembersByFiltersSql overload
Arshadul-Monir f235d96
Added test to validate 'where' filters
Arshadul-Monir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| INSERT INTO members ( | ||
| id, | ||
| first_name, | ||
| last_name, | ||
| email, | ||
| linked_in_url, | ||
| introduction, | ||
| referral_source, | ||
| active, | ||
| match_pref, | ||
| industry_pref, | ||
| role_pref, | ||
| topics, | ||
| extra_notes | ||
| ) | ||
| VALUES | ||
| ( | ||
| '10000000-0000-4000-8000-000000000001', | ||
| 'Avery', | ||
| 'Chen', | ||
| 'avery.chen@example.com', | ||
| 'https://www.linkedin.com/in/avery-chen-example', | ||
| 'Product designer interested in making financial tools easier to use.', | ||
| 'Patina Network newsletter', | ||
| TRUE, | ||
| 'Peer - I want to meet someone with similar experience', | ||
| 'Financial Technology', | ||
| 'Product Designer', | ||
| 'Design systems, Financial literacy, Career growth', | ||
| 'Available for coffee in Manhattan or a virtual chat.' | ||
| ), | ||
| ( | ||
| '10000000-0000-4000-8000-000000000002', | ||
| 'Jordan', | ||
| 'Williams', | ||
| 'jordan.williams@example.com', | ||
| 'https://www.linkedin.com/in/jordan-williams-example', | ||
| 'Backend engineer building reliable systems for healthcare teams.', | ||
| 'Friend', | ||
| TRUE, | ||
| 'Mentor - I am looking for guidance from someone with more experience', | ||
| 'Healthcare Technology', | ||
| 'Software Engineer', | ||
| 'Distributed systems, Leadership, Open source', | ||
| 'Usually available after work on Tuesdays and Thursdays.' | ||
| ), | ||
| ( | ||
| '10000000-0000-4000-8000-000000000003', | ||
| 'Priya', | ||
| 'Patel', | ||
| 'priya.patel@example.com', | ||
| 'https://www.linkedin.com/in/priya-patel-example', | ||
| 'Founder working on software that helps small businesses measure emissions.', | ||
| 'Patina Network event', | ||
| TRUE, | ||
| 'Peer - I want to exchange ideas with another builder', | ||
| 'Climate Technology', | ||
| 'Founder', | ||
| 'Fundraising, Sustainability, Product strategy', | ||
| 'Happy to meet virtually or in Brooklyn.' | ||
| ), | ||
| ( | ||
| '10000000-0000-4000-8000-000000000004', | ||
| 'Marcus', | ||
| 'Johnson', | ||
| 'marcus.johnson@example.com', | ||
| NULL, | ||
| 'Data analyst focused on improving outcomes for public school students.', | ||
| 'Colleague', | ||
| FALSE, | ||
| 'Mentor - I can offer guidance to someone earlier in their career', | ||
| 'Education', | ||
| 'Data Analyst', | ||
| 'Analytics, Public policy, Mentorship', | ||
| 'Taking a break from matching this month.' | ||
| ), | ||
| ( | ||
| '10000000-0000-4000-8000-000000000005', | ||
| 'Sofia', | ||
| 'Rodriguez', | ||
| 'sofia.rodriguez@example.com', | ||
| 'https://www.linkedin.com/in/sofia-rodriguez-example', | ||
| 'Community program director connecting volunteers with neighborhood nonprofits.', | ||
| 'Community partner', | ||
| TRUE, | ||
| 'Open - I am happy to meet a peer, mentor, or mentee', | ||
| 'Nonprofit', | ||
| 'Program Director', | ||
| 'Community building, Social impact, Volunteer engagement', | ||
| 'Prefers an in-person conversation when possible.' | ||
| ), | ||
| ( | ||
| '10000000-0000-4000-8000-000000000006', | ||
| 'Ethan', | ||
| 'Kim', | ||
| 'ethan.kim@example.com', | ||
| 'https://www.linkedin.com/in/ethan-kim-example', | ||
| 'Graduate student researching responsible machine learning applications.', | ||
| 'University alumni group', | ||
| TRUE, | ||
| 'Mentor - I am looking for guidance from someone with more experience', | ||
| 'Artificial Intelligence', | ||
| 'Graduate Researcher', | ||
| 'Responsible AI, Research careers, Entrepreneurship', | ||
| NULL | ||
| ), | ||
| ( | ||
| '10000000-0000-4000-8000-000000000007', | ||
| 'Nia', | ||
| 'Thompson', | ||
| 'nia.thompson@example.com', | ||
| NULL, | ||
| 'Marketing strategist helping independent creators grow sustainable audiences.', | ||
| 'LinkedIn', | ||
| TRUE, | ||
| 'Peer - I want to meet someone with similar experience', | ||
| 'Media', | ||
| 'Marketing Strategist', | ||
| 'Brand strategy, Creator economy, Storytelling', | ||
| 'Virtual chats work best during weekday mornings.' | ||
| ), | ||
| ( | ||
| '10000000-0000-4000-8000-000000000008', | ||
| 'Leo', | ||
| 'Martinez', | ||
| 'leo.martinez@example.com', | ||
| 'https://www.linkedin.com/in/leo-martinez-example', | ||
| 'Operations manager interested in technology-enabled hospitality experiences.', | ||
| 'Friend', | ||
| TRUE, | ||
| 'Open - I am happy to meet a peer, mentor, or mentee', | ||
| 'Hospitality', | ||
| 'Operations Manager', | ||
| 'Operations, Customer experience, Small business', | ||
| 'Available in Queens or by video call.' | ||
| ), | ||
| ( | ||
| '10000000-0000-4000-8000-000000000009', | ||
| 'Maya', | ||
| 'Brooks', | ||
| 'maya.brooks@example.com', | ||
| 'https://www.linkedin.com/in/maya-brooks-example', | ||
| 'People operations leader building inclusive teams at growing companies.', | ||
| 'Patina Network event', | ||
| TRUE, | ||
| 'Mentor - I can offer guidance to someone earlier in their career', | ||
| 'Professional Services', | ||
| 'People Operations Director', | ||
| 'Inclusive hiring, Management, Organizational design', | ||
| 'Open to meeting anywhere near a major subway line.' | ||
| ), | ||
| ( | ||
| '10000000-0000-4000-8000-000000000010', | ||
| 'Noah', | ||
| 'Okafor', | ||
| 'noah.okafor@example.com', | ||
| NULL, | ||
| 'Independent consultant helping local retailers modernize their operations.', | ||
| 'Community partner', | ||
| FALSE, | ||
| 'Peer - I want to exchange ideas with another builder', | ||
| 'Retail', | ||
| 'Business Consultant', | ||
| 'Digital transformation, Consulting, Local business', | ||
| 'Inactive seed record for testing member status filters.' | ||
| ) | ||
| ON CONFLICT (email) DO NOTHING; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| import { MembersPage } from "@/features/members/Members.page"; | ||
| import { | ||
| fireEvent, | ||
| renderWithProviders, | ||
| screen, | ||
| within, | ||
| } from "@/lib/test/render"; | ||
| import { server } from "@/lib/test/server"; | ||
| import { waitFor } from "@testing-library/react"; | ||
| import userEvent from "@testing-library/user-event"; | ||
| import { http, HttpResponse } from "msw"; | ||
| import { expect, test } from "vitest"; | ||
|
|
||
| test("renders every member returned by the API", async () => { | ||
| renderWithProviders(<MembersPage />); | ||
|
|
||
| expect(await screen.findByText("Alex Morgan")).toBeInTheDocument(); | ||
| expect(screen.getByText("Jordan Lee")).toBeInTheDocument(); | ||
| expect(screen.getByText("2 members")).toBeInTheDocument(); | ||
| const membersTable = screen.getByRole("table"); | ||
| expect(within(membersTable).getByText("Active")).toBeInTheDocument(); | ||
| expect(within(membersTable).getByText("Inactive")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("renders an empty state when there are no members", async () => { | ||
| server.use( | ||
| http.get("/api/members", () => | ||
| HttpResponse.json({ | ||
| message: "Members retrieved successfully", | ||
| payload: [], | ||
| success: true, | ||
| }), | ||
| ), | ||
| ); | ||
|
|
||
| renderWithProviders(<MembersPage />); | ||
|
|
||
| expect(await screen.findByText("No members found.")).toBeInTheDocument(); | ||
| expect(screen.getByText("0 members")).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test("applies form filters as API request parameters", async () => { | ||
| const user = userEvent.setup(); | ||
| const requestedUrls: URL[] = []; | ||
| server.use( | ||
| http.get("/api/members", ({ request }) => { | ||
| requestedUrls.push(new URL(request.url)); | ||
| return HttpResponse.json({ | ||
| message: "Members retrieved successfully", | ||
| payload: [], | ||
| success: true, | ||
| }); | ||
| }), | ||
| ); | ||
|
|
||
| renderWithProviders(<MembersPage />, { route: "/admin/members" }); | ||
|
|
||
| expect(await screen.findByText("No members found.")).toBeInTheDocument(); | ||
|
|
||
| await user.type(screen.getByLabelText("First name"), " Alex "); | ||
| await user.type(screen.getByLabelText("Last name"), "Morgan"); | ||
| await user.type(screen.getByLabelText("Email"), "alex@example.com"); | ||
| await user.click(screen.getByPlaceholderText("Any status")); | ||
| fireEvent.click(screen.getByRole("option", { hidden: true, name: "Active" })); | ||
| await user.type(screen.getByLabelText("Match preference"), "Peer"); | ||
| await user.type(screen.getByLabelText("Industry"), "Technology"); | ||
| await user.type(screen.getByLabelText("Role"), "Engineering"); | ||
| await user.type(screen.getByLabelText("Topics"), "Community building"); | ||
| await user.click(screen.getByRole("button", { name: "Apply filters" })); | ||
|
|
||
| await waitFor(() => expect(requestedUrls).toHaveLength(2)); | ||
| const requestedUrl = requestedUrls[1]; | ||
| expect(requestedUrl.searchParams.get("firstName")).toBe("Alex"); | ||
| expect(requestedUrl.searchParams.get("lastName")).toBe("Morgan"); | ||
| expect(requestedUrl.searchParams.get("email")).toBe("alex@example.com"); | ||
| expect(requestedUrl.searchParams.get("active")).toBe("true"); | ||
| expect(requestedUrl.searchParams.get("matchPref")).toBe("Peer"); | ||
| expect(requestedUrl.searchParams.get("industryPref")).toBe("Technology"); | ||
| expect(requestedUrl.searchParams.get("rolePref")).toBe("Engineering"); | ||
| expect(requestedUrl.searchParams.get("topics")).toBe("Community building"); | ||
| }); | ||
|
|
||
| test("allows status to be deselected and clears it with the other filters", async () => { | ||
| const user = userEvent.setup(); | ||
| const requestedUrls: URL[] = []; | ||
| server.use( | ||
| http.get("/api/members", ({ request }) => { | ||
| requestedUrls.push(new URL(request.url)); | ||
| return HttpResponse.json({ | ||
| message: "Members retrieved successfully", | ||
| payload: [], | ||
| success: true, | ||
| }); | ||
| }), | ||
| ); | ||
|
|
||
| renderWithProviders(<MembersPage />); | ||
|
|
||
| expect(await screen.findByText("No members found.")).toBeInTheDocument(); | ||
| const statusInput = screen.getByRole("textbox", { name: "Status" }); | ||
| await user.click(statusInput); | ||
| fireEvent.click(screen.getByRole("option", { hidden: true, name: "Active" })); | ||
| expect(statusInput).toHaveValue("Active"); | ||
|
|
||
| await user.click(screen.getByRole("button", { name: "Clear status" })); | ||
| expect(statusInput).toHaveValue(""); | ||
| await user.type(screen.getByLabelText("First name"), "Alex"); | ||
| await user.click(screen.getByRole("button", { name: "Apply filters" })); | ||
|
|
||
| await waitFor(() => expect(requestedUrls).toHaveLength(2)); | ||
| expect(requestedUrls[1].searchParams.get("firstName")).toBe("Alex"); | ||
| expect(requestedUrls[1].searchParams.has("active")).toBe(false); | ||
|
|
||
| const renderedStatusInput = await screen.findByRole("textbox", { | ||
| name: "Status", | ||
| }); | ||
| await user.click(renderedStatusInput); | ||
| fireEvent.click( | ||
| screen.getByRole("option", { hidden: true, name: "Inactive" }), | ||
| ); | ||
| await user.click(screen.getByRole("button", { name: "Clear filters" })); | ||
|
|
||
| expect(renderedStatusInput).toHaveValue(""); | ||
| expect(screen.getByLabelText("First name")).toHaveValue(""); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.