Skip to content

Conversation

@nickpalladino
Copy link
Member

@nickpalladino nickpalladino commented Jul 9, 2025

Description

Story:

  • Changed from doing checkExistingUserByEmail on front end to using bi-api search call that we now have
    • eliminated paging problem with pageSize being set to 50 and not getting all system users
  • Added getById to UserService, ended up not needing it but left it in for future use

Dependencies

  • bi-api release/1.1.1

Testing

Can use the following SQL to setup 50 test users. Test adding a user to a program that is beyond 50 and ensure they are added to the program successfully. Regression test program user management functionality.

DO $$
DECLARE
    user_id UUID;
BEGIN

-- Ensure the 'system' user exists and get its ID.
-- This assumes a 'system' user is already in your 'bi_user' table.
-- If not, you might need to create it first or use a different default user ID.
SELECT id INTO user_id FROM bi_user WHERE name = 'system' LIMIT 1;

-- If no 'system' user is found, you might want to handle that,
-- for example by raising an exception or using a hardcoded UUID.
IF user_id IS NULL THEN
    RAISE EXCEPTION 'System user not found. Cannot create test users.';
END IF;

-- Insert 50 new test users
insert into bi_user (orcid, name, email, created_by, updated_by)
values
('0001-0001-0001-0001', 'Alice Johnson', 'alice.j@example.com', user_id, user_id),
('0001-0001-0001-0002', 'Bob Williams', 'bob.w@example.com', user_id, user_id),
('0001-0001-0001-0003', 'Charlie Brown', 'charlie.b@example.com', user_id, user_id),
('0001-0001-0001-0004', 'Diana Miller', 'diana.m@example.com', user_id, user_id),
('0001-0001-0001-0005', 'Ethan Davis', 'ethan.d@example.com', user_id, user_id),
('0001-0001-0001-0006', 'Fiona Garcia', 'fiona.g@example.com', user_id, user_id),
('0001-0001-0001-0007', 'George Rodriguez', 'george.r@example.com', user_id, user_id),
('0001-0001-0001-0008', 'Hannah Wilson', 'hannah.w@example.com', user_id, user_id),
('0001-0001-0001-0009', 'Ian Martinez', 'ian.m@example.com', user_id, user_id),
('0001-0001-0001-0010', 'Jane Anderson', 'jane.a@example.com', user_id, user_id),
('0001-0001-0001-0011', 'Kevin Taylor', 'kevin.t@example.com', user_id, user_id),
('0001-0001-0001-0012', 'Laura Thomas', 'laura.t@example.com', user_id, user_id),
('0001-0001-0001-0013', 'Mason Hernandez', 'mason.h@example.com', user_id, user_id),
('0001-0001-0001-0014', 'Nora Moore', 'nora.m@example.com', user_id, user_id),
('0001-0001-0001-0015', 'Oscar Martin', 'oscar.m@example.com', user_id, user_id),
('0001-0001-0001-0016', 'Penelope Jackson', 'penelope.j@example.com', user_id, user_id),
('0001-0001-0001-0017', 'Quentin Thompson', 'quentin.t@example.com', user_id, user_id),
('0001-0001-0001-0018', 'Rachel White', 'rachel.w@example.com', user_id, user_id),
('0001-0001-0001-0019', 'Samuel Lopez', 'samuel.l@example.com', user_id, user_id),
('0001-0001-0001-0020', 'Tina Lee', 'tina.l@example.com', user_id, user_id),
('0001-0001-0001-0021', 'Uma Gonzalez', 'uma.g@example.com', user_id, user_id),
('0001-0001-0001-0022', 'Victor Harris', 'victor.h@example.com', user_id, user_id),
('0001-0001-0001-0023', 'Wendy Clark', 'wendy.c@example.com', user_id, user_id),
('0001-0001-0001-0024', 'Xavier Lewis', 'xavier.l@example.com', user_id, user_id),
('0001-0001-0001-0025', 'Yara Robinson', 'yara.r@example.com', user_id, user_id),
('0001-0001-0001-0026', 'Zane Walker', 'zane.w@example.com', user_id, user_id),
('0001-0001-0001-0027', 'Ava Hall', 'ava.h@example.com', user_id, user_id),
('0001-0001-0001-0028', 'Ben Young', 'ben.y@example.com', user_id, user_id),
('0001-0001-0001-0029', 'Chloe Allen', 'chloe.a@example.com', user_id, user_id),
('0001-0001-0001-0030', 'David King', 'david.k@example.com', user_id, user_id),
('0001-0001-0001-0031', 'Ella Wright', 'ella.w@example.com', user_id, user_id),
('0001-0001-0001-0032', 'Frank Scott', 'frank.s@example.com', user_id, user_id),
('0001-0001-0001-0033', 'Grace Green', 'grace.g@example.com', user_id, user_id),
('0001-0001-0001-0034', 'Henry Adams', 'henry.a@example.com', user_id, user_id),
('0001-0001-0001-0035', 'Isabella Baker', 'isabella.b@example.com', user_id, user_id),
('0001-0001-0001-0036', 'Jack Nelson', 'jack.n@example.com', user_id, user_id),
('0001-0001-0001-0037', 'Kate Carter', 'kate.c@example.com', user_id, user_id),
('0001-0001-0001-0038', 'Liam Mitchell', 'liam.m@example.com', user_id, user_id),
('0001-0001-0001-0039', 'Mia Perez', 'mia.p@example.com', user_id, user_id),
('0001-0001-0001-0040', 'Noah Roberts', 'noah.r@example.com', user_id, user_id),
('0001-0001-0001-0041', 'Olivia Turner', 'olivia.t@example.com', user_id, user_id),
('0001-0001-0001-0042', 'Paul Phillips', 'paul.p@example.com', user_id, user_id),
('0001-0001-0001-0043', 'Quinn Campbell', 'quinn.c@example.com', user_id, user_id),
('0001-0001-0001-0044', 'Riley Parker', 'riley.p@example.com', user_id, user_id),
('0001-0001-0001-0045', 'Sophia Evans', 'sophia.e@example.com', user_id, user_id),
('0001-0001-0001-0046', 'Tom Edwards', 'tom.e@example.com', user_id, user_id),
('0001-0001-0001-0047', 'Victoria Collins', 'victoria.c@example.com', user_id, user_id),
('0001-0001-0001-0048', 'William Stewart', 'william.s@example.com', user_id, user_id),
('0001-0001-0001-0049', 'Zoe Sanchez', 'zoe.s@example.com', user_id, user_id),
('0001-0001-0001-0050', 'Adam Morris', 'adam.m@example.com', user_id, user_id);

END $$;

Checklist:

  • I have performed a self-review of my own code
  • I have tested my code and ensured it meets the acceptance criteria of the story
  • I have create/modified unit tests to cover this change
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to documentation
  • I have run TAF: <link to TAF run>
  • I have run SiteImprove on pages impacted by changes

@github-actions github-actions bot added the bug Something isn't working label Jul 9, 2025
@nickpalladino nickpalladino requested review from a team, dmeidlin and mlm483 and removed request for a team July 10, 2025 19:56
Copy link
Contributor

@mlm483 mlm483 left a comment

Choose a reason for hiding this comment

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

I did some local testing, it looks good.
See my comment about improving the error message.

static errorCreateUser: string = 'Unable to create user';
static errorDeleteUser: string = 'Unable to archive user';
static errorGetUsers: string = 'Error while trying to load roles';
static errorGetUser: string = 'Error user not found';
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add punctuation or remove the word "Error".

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated error message

Copy link
Contributor

@dmeidlin dmeidlin left a comment

Choose a reason for hiding this comment

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

When I try adding the 51st user (victoria.c@example.com) the backend sends the banner error, "Error creating user, a user with this email already exists." The same error happened when I tried the 52nd user (wendy.c@example.com). The bi-api console did not show any error or stack trace---just the message, "Email already exists."

@nickpalladino
Copy link
Member Author

nickpalladino commented Jul 16, 2025

When I try adding the 51st user (victoria.c@example.com) the backend sends the banner error, "Error creating user, a user with this email already exists." The same error happened when I tried the 52nd user (wendy.c@example.com). The bi-api console did not show any error or stack trace---just the message, "Email already exists."

@dmeidlin Are you seeing a POST /v1/users/search in devtools when you add a program user?

@nickpalladino nickpalladino requested a review from davedrp August 1, 2025 17:42
@nickpalladino nickpalladino assigned davedrp and unassigned dmeidlin Aug 1, 2025
@nickpalladino
Copy link
Member Author

@dmeidlin Added @davedrp as a reviewer to help clear the review backlog for end of sprint

Copy link
Contributor

@davedrp davedrp left a comment

Choose a reason for hiding this comment

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

passed developer testing

@nickpalladino nickpalladino merged commit da6d685 into release/1.1.1 Aug 1, 2025
1 check passed
@nickpalladino nickpalladino deleted the bug/BI-2691 branch August 1, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants