Skip to content

GroupService

Implements IGroupService, exposing read-only lookups over GroupAssociation data through IUnitOfWork.GetRepository<GroupAssociation>(). Its static constructor registers AutoMapper maps for GroupAssociation→GroupSearchItem/GroupHeader/Group and reuses GroupsMappingHelper.CreateGroupMap() and EmployeesMappingHelper.CreatePolicyUserMap(), so this type is one of several call sites that configure the shared group/employee mapping graph.

Purpose

  • Searches groups by acronym or name for lookup/typeahead scenarios.
  • Retrieves a single group's summary header (with formatted phone number and parent/child type classification) by acronym.
  • Retrieves a single full Group contract by ID, including a formatted phone number.

Context

  • Namespace: SAIF.Services.Groups
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
GroupService(uow) public GroupService(IUnitOfWork uow) Validates the injected unit of work is non-null and stores it for repository access.
GetGroupSearchList() public IEnumerable<GroupSearchItem> GetGroupSearchList() Returns every group mapped to lightweight GroupSearchItem contracts (name title-cased, IsActive derived from a null expiration date).
GetGroupSearchList(searchTerm) public IEnumerable<GroupSearchItem> GetGroupSearchList(string searchTerm) Returns groups whose acronym or name contains searchTerm (case-insensitive), mapped to GroupSearchItem contracts.
GetGroupHeader public GroupHeader GetGroupHeader(string acronym) Returns the GroupHeader for the group matching acronym (case-insensitive), including formatted phone, title-cased type description, and whether the group's type is the parent type.
GetGroup public Group GetGroup(string id) Returns the full Group contract for the group whose ID matches id (case-insensitive), with a formatted PhoneNumber.

Behavioral notes

  • All lookup methods are read-only; none call unitOfWork.Begin()/Commit(), indicating no writes occur through this service*.
  • The static constructor wires AutoMapper maps once per app domain via Mapper.CreateMap, sharing state with other services that also call GroupsMappingHelper.CreateGroupMap() (e.g. SAIF.Services.Groups.Imaging.ImageService, SAIF.Services.Groups.Notes.NoteService)*.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Services/SAIF.Services/Groups/GroupService.cs