4.1 KiB
4.1 KiB
Story 3: Contact Management
Story Overview
As a system user
I want to manage contacts and their roles
So that I can associate stakeholders with applications and business units
Story Type: Feature
Priority: Medium
Estimated Effort: 3-5 days
Dependencies: Story 0 (Foundation)
Business Value
Contacts represent stakeholders (Product Owners, Developers, etc.) and their roles. This enables:
- Tracking who is responsible for what
- Contact information management
- Foundation for application stakeholder mapping (used in later stories)
Scope
In Scope
✅ Contact role management (predefined roles)
✅ Person management (individuals)
✅ Contact-Person associations
✅ Basic CRUD for all entities
Out of Scope (Story 2, 6)
❌ Application-Contact associations (added when Story 2 needs it)
❌ Business Unit-Contact associations
❌ SLA-Contact associations (Phase 2)
Database Schema
-- Contact Roles (predefined)
CREATE TABLE contact_role (
id UUID PRIMARY KEY,
role_name VARCHAR(100) UNIQUE NOT NULL,
description TEXT,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL
);
-- Persons (individuals)
CREATE TABLE person (
id UUID PRIMARY KEY,
first_name VARCHAR(100) NOT NULL,
last_name VARCHAR(100) NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
phone VARCHAR(50),
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL
);
-- Contacts (functional roles)
CREATE TABLE contact (
id UUID PRIMARY KEY,
contact_role_id UUID NOT NULL REFERENCES contact_role(id),
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL
);
-- Contact-Person junction (many-to-many)
CREATE TABLE contact_person (
contact_id UUID NOT NULL REFERENCES contact(id) ON DELETE CASCADE,
person_id UUID NOT NULL REFERENCES person(id) ON DELETE CASCADE,
is_primary BOOLEAN NOT NULL DEFAULT false,
PRIMARY KEY (contact_id, person_id)
);
-- Indexes
CREATE INDEX idx_person_email ON person(email);
CREATE INDEX idx_contact_role ON contact(contact_role_id);
Key Endpoints
Contact Roles
GET /api/contact-roles- List all rolesPOST /api/contact-roles- Create role (admin only)
Persons
GET /api/persons- List all personsGET /api/persons/{id}- Get person detailsPOST /api/persons- Create personPUT /api/persons/{id}- Update personDELETE /api/persons/{id}- Delete person
Contacts
GET /api/contacts- List all contactsGET /api/contacts/{id}- Get contact with personsPOST /api/contacts- Create contact (with person IDs)PUT /api/contacts/{id}- Update contactPOST /api/contacts/{id}/persons/{personId}- Add person to contactDELETE /api/contacts/{id}/persons/{personId}- Remove person from contactPATCH /api/contacts/{id}/persons/{personId}/primary- Set as primary
Frontend Components
PersonListComponent
- Table: First Name, Last Name, Email, Phone, Actions
- CRUD operations
ContactRoleListComponent
- Simple list of roles (mostly read-only for regular users)
ContactFormComponent
- Select contact role (dropdown)
- Multi-select persons (with primary designation)
- Add/remove persons dynamically
Acceptance Criteria
- Contact roles can be created and listed
- Persons can be created with unique email
- Contacts can be created with role and persons
- One person per contact can be marked as primary
- Person can be associated with multiple contacts
- All CRUD operations work via UI
- Email uniqueness enforced
- Tests pass (>80% backend, >70% frontend)
Testing Scenarios
- Create Person: Add new person with unique email
- Duplicate Email: Attempt to create person with existing email (should fail)
- Create Contact: Create contact with role and multiple persons
- Set Primary: Mark one person as primary contact
- Remove Person: Remove person from contact
- Delete Person: Delete person (should remove from all contacts)
Story Status: Ready for Development
Estimated Completion: 3-5 days