Skip to content

Feature/ab#32490 updates to portal contact provider and events#2208

Merged
JamesPasta merged 5 commits intodevfrom
feature/AB#32490-portal-contact-provider
Apr 1, 2026
Merged

Feature/ab#32490 updates to portal contact provider and events#2208
JamesPasta merged 5 commits intodevfrom
feature/AB#32490-portal-contact-provider

Conversation

@AndreGAot
Copy link
Copy Markdown
Contributor

No description provided.

@AndreGAot AndreGAot requested a review from Copilot March 31, 2026 21:40
@AndreGAot AndreGAot changed the title Feature/ab#32490 portal contact provider Feature/ab#32490 updates portal contact provider Mar 31, 2026
@AndreGAot AndreGAot marked this pull request as draft March 31, 2026 21:41
@github-actions
Copy link
Copy Markdown

🧪 Unit Test Results (Parallel Execution)

Tests

📊 Summary

Result Count
✅ Passed 563
❌ Failed 0
⚠️ Skipped 0

📄 HTML Reports

  • Merged Tests (HTML): Included in artifacts
    Generated automatically by CI.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Applicant Portal contact model to use applicant-linked contacts (resolved via submissions/subject) rather than profile-linked contacts, and extends contact payloads to include creationTime.

Changes:

  • Update ContactInfoDataProvider / ApplicantProfileContactService to resolve contacts via ApplicationFormSubmission.OidcSub → ApplicantId(s) → ContactLink(RelatedEntityType="Applicant"), with editability dependent on whether a single applicant is resolved.
  • Update Grants Portal contact command handlers and message DTOs to carry applicantId and link contacts to the Applicant entity type.
  • Add CreationTime to ContactInfoItemDto, update docs/examples, and deduplicate org results via Distinct().

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
documentation/applicant-portal/applicant-profile-data-providers.md Updates CONTACTINFO provider documentation to reflect applicant-linked resolution + editability rule and adds CreationTime mapping.
documentation/applicant-portal/applicant-portal-integration.md Extends CONTACTINFO response example with creationTime (example contactType needs updating).
applications/Unity.GrantManager/src/Unity.GrantManager.Application/ApplicantProfile/ContactInfoDataProvider.cs Switches from profile-based contact lookup to subject/applicant-based lookup.
applications/Unity.GrantManager/src/Unity.GrantManager.Application/ApplicantProfile/ApplicantProfileContactService.cs Implements applicant-ID resolution from submissions and returns conditional IsEditable; populates CreationTime.
applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/ApplicantProfile/IApplicantProfileContactService.cs Replaces profileId-based API with subject-based applicant contact retrieval.
applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/ApplicantProfile/ProfileData/ContactInfoItemDto.cs Adds CreationTime to the contact DTO contract.
applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantsPortal/Handlers/ContactCreateHandler.cs Creates ContactLink records against Applicant using applicantId from command payload.
applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantsPortal/Handlers/ContactEditHandler.cs Adds contact-link primary mutation logic keyed by applicantId (currently has behavior issues).
applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantsPortal/Handlers/ContactSetPrimaryHandler.cs Updates set-primary flow to be applicant-based via applicantId in payload.
applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantsPortal/Messages/Commands/ContactCreateData.cs Adds applicantId to create-contact command payload.
applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantsPortal/Messages/Commands/ContactEditData.cs Adds applicantId to edit-contact command payload.
applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantsPortal/Messages/Commands/ContactSetPrimaryData.cs Introduces DTO for set-primary command applicantId data.
applications/Unity.GrantManager/src/Unity.GrantManager.Application/ApplicantProfile/OrgInfoDataProvider.cs Adds Distinct() to remove duplicate organizations when multiple submissions point to the same applicant/org.
applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/Contacts/ContactInfoServiceTests.cs Updates tests for applicant/subject-based contact resolution and adds editability rule tests (names need updating).
applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/Contacts/ContactInfoDataProviderTests.cs Updates provider tests to expect GetApplicantContactsAsync(...) usage (test name needs updating).
applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/GrantsPortal/ContactCreateHandlerTests.cs Updates create-command tests for applicant-linked contact creation.
applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/GrantsPortal/ContactEditHandlerTests.cs Updates edit-command tests to include applicantId and handler dependency updates.
applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/GrantsPortal/ContactSetPrimaryHandlerTests.cs Updates set-primary tests to include applicantId in payload data (should better exercise new behavior).
applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/Applicants/OrgInfoDataProviderTests.cs Updates expectations to reflect distinct org results.
applications/Unity.GrantManager/test/Unity.GrantManager.Application.Tests/Applicants/ApplicantProfileDataProviderTests.cs Updates mocked contact service call from profile-based to applicant/subject-based.
Comments suppressed due to low confidence (1)

applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantsPortal/Handlers/ContactCreateHandler.cs:62

  • ContactCreateHandler uses innerData.ApplicantId to create the ContactLink, but if applicantId is missing from the JSON it will deserialize as Guid.Empty and create a link to an invalid applicant. Add an explicit validation that ApplicantId != Guid.Empty and throw a clear ArgumentException (e.g., "applicantId is required") before inserting records.
        var contactId = Guid.Parse(payload.ContactId ?? throw new ArgumentException("contactId is required"));
        var profileId = Guid.Parse(payload.ProfileId ?? throw new ArgumentException("profileId is required"));
        var innerData = payload.Data?.ToObject<ContactCreateData>()
                        ?? throw new ArgumentException("Contact data is required");        

        // Idempotency: if the contact already exists, treat as success
        var existing = await contactRepository.FindAsync(contactId);
        if (existing != null)
        {
            logger.LogInformation("Contact {ContactId} already exists. Treating as idempotent success.", contactId);
            return "Contact already exists";
        }

        logger.LogInformation("Creating contact {ContactId} for profile {ProfileId}", contactId, profileId);

        var contact = new Contact
        {
            Name = innerData.Name,
            Email = innerData.Email,
            Title = innerData.Title,
            HomePhoneNumber = innerData.HomePhoneNumber,
            MobilePhoneNumber = innerData.MobilePhoneNumber,
            WorkPhoneNumber = innerData.WorkPhoneNumber,
            WorkPhoneExtension = innerData.WorkPhoneExtension
        };

        EntityHelper.TrySetId(contact, () => contactId);

        await contactRepository.InsertAsync(contact);

        // Create a contact link to track the relationship and primary status
        var contactLink = new ContactLink
        {
            ContactId = contactId,
            RelatedEntityType = "Applicant",
            RelatedEntityId = innerData.ApplicantId,
            Role = innerData.Role,
            IsPrimary = innerData.IsPrimary,
            IsActive = true
        };

Comment thread documentation/applicant-portal/applicant-portal-integration.md Outdated
@AndreGAot AndreGAot changed the title Feature/ab#32490 updates portal contact provider Feature/ab#32490 updates to portal contact provider and events Mar 31, 2026
@github-actions
Copy link
Copy Markdown

🧪 Unit Test Results (Parallel Execution)

Tests

📊 Summary

Result Count
✅ Passed 568
❌ Failed 0
⚠️ Skipped 0

📄 HTML Reports

  • Merged Tests (HTML): Included in artifacts
    Generated automatically by CI.

@github-actions
Copy link
Copy Markdown

🧪 Unit Test Results (Parallel Execution)

Tests

📊 Summary

Result Count
✅ Passed 570
❌ Failed 0
⚠️ Skipped 0

📄 HTML Reports

  • Merged Tests (HTML): Included in artifacts
    Generated automatically by CI.

@AndreGAot AndreGAot requested a review from JamesPasta March 31, 2026 23:43
@AndreGAot AndreGAot marked this pull request as ready for review March 31, 2026 23:43
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

🧪 Unit Test Results (Parallel Execution)

Tests

📊 Summary

Result Count
✅ Passed 573
❌ Failed 0
⚠️ Skipped 0

📄 HTML Reports

  • Merged Tests (HTML): Included in artifacts
    Generated automatically by CI.

@JamesPasta JamesPasta merged commit e250890 into dev Apr 1, 2026
22 checks passed
@JamesPasta JamesPasta deleted the feature/AB#32490-portal-contact-provider branch April 1, 2026 19:01
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.

3 participants