Service Layer medium complexity backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations

Description

Business logic layer for contact retrieval, filtering, and search operations. Enforces role-based access rules so only permitted contacts are returned for a given authenticated user. Translates raw repository results into view-ready models with organisation-specific terminology applied.

Feature: Contact List & Search

contact-service

Sources & reasoning

Line 162 explicitly marks contact search as MUST HAVE Phase 1 for all five organisations. Line 291 confirms role-specific views as a core mobile architecture requirement. Line 467 canonically places this feature in the Contacts area taxonomy. MVP target derives from the Phase 1 position in the priority matrix and from line 321 listing contact list as a Phase 1 deliverable.

  • docs/source/likeperson.md · line 162
    | Basic search (contact og notater) | ✓ | ✓ | ✓ | ✓ | ✓ | MUST | 1 |
  • docs/source/likeperson.md · line 291
    - Contacts list with role-specific views
  • docs/source/likeperson.md · line 467
    | contacts | Contacts | Contact List & Search, Contact Detail & Edit, Caregiver & Next-of-Kin |

Responsibilities

  • Enforce role-based contact visibility rules before returning results to callers
  • Execute search queries against ContactRepository using name and identifier fields
  • Apply pagination parameters and return structured paginated response objects
  • Map raw database records to domain contact models with resolved display labels
  • Validate and sanitise incoming search queries before forwarding to the data layer

Interfaces

getContacts(userId: string, role: UserRole, page: number, pageSize: number): Promise<PaginatedContactList>
searchContacts(userId: string, query: string, role: UserRole): Promise<Contact[]>
getContactById(contactId: string, requestingUserId: string): Promise<Contact>

Related Data Entities (3)

Data entities managed by this component