Status: Planned Phase: MVP (Phase 1) Priority: High Depends On: Epic 1 (Friend Management) Extracted From: Epic 1C
Add a timestamped notes system to friends, allowing users to record important details, conversations, and observations about their relationships over time. Notes provide a simple way to capture context that doesn't fit into structured fields.
- Allow users to add timestamped notes to any friend
- Provide a chronological history of notes per friend
- Enable basic search within notes
- Keep the interface simple and fast
- Add timestamped notes to any friend
- Plain text (rich text deferred to future enhancement)
- Edit existing notes
- Delete notes
- Notes displayed in reverse chronological order (newest first)
- Notes are searchable (basic substring search for MVP)
- As a user, I want to add notes about a friend so I can remember important details
- As a user, I want to see when I added each note so I have temporal context
- As a user, I want to edit a note if I made a mistake
- As a user, I want to delete a note I no longer need
- As a user, I want to see notes in chronological order so I can follow the history
CREATE TABLE friend_notes (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
friend_id UUID NOT NULL REFERENCES friends(id) ON DELETE CASCADE,
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, -- Who wrote the note
content TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT notes_content_not_empty CHECK (LENGTH(TRIM(content)) > 0)
);
CREATE INDEX idx_friend_notes_friend_id ON friend_notes(friend_id);
CREATE INDEX idx_friend_notes_created_at ON friend_notes(friend_id, created_at DESC);
-- Full-text search index for notes (basic search)
CREATE INDEX idx_friend_notes_content_search ON friend_notes
USING GIN (to_tsvector('english', content));| Method | Endpoint | Description |
|---|---|---|
| GET | /api/friends/:id/notes |
List notes for friend (paginated) |
| POST | /api/friends/:id/notes |
Add new note |
| PUT | /api/friends/:id/notes/:noteId |
Update note |
| DELETE | /api/friends/:id/notes/:noteId |
Delete note |
import { type } from 'arktype'
// Note create schema
export const noteCreateSchema = type({
content: 'string > 0',
})
// Note update schema
export const noteUpdateSchema = type({
content: 'string > 0',
})
// Note list query schema
export const noteListQuerySchema = type({
'page?': 'string.numeric.parse',
'limit?': 'string.numeric.parse',
})| Component | Description |
|---|---|
NotesList |
Chronological list of notes with timestamps |
NoteItem |
Single note display with edit/delete actions |
NoteForm |
Text area for adding/editing notes |
NotesSection |
Container for notes in friend detail view |
- Create
friend_notestable with schema above - Add indexes for performance
- Run migration
- Create
friend-notes.sqlwith PgTyped queries - Generate TypeScript types
- Add routes to
friends.tsfor notes CRUD - Add validation schemas to shared package
- Create
NotesSection.sveltecomponent - Create
NoteItem.sveltefor individual notes - Create
NoteForm.sveltefor add/edit - Integrate into
FriendDetail.svelte - Add inline editing support (following Epic 14 patterns)
- Include notes content in friend search (Epic 10)
- Add notes to search_vector trigger or search query
- Notes list loads in <200ms for 100 notes
- Note creation in <100ms
- Notes search returns results in <300ms
- Test coverage >80%
- Epic 1: Friend Management (must be complete) - Done
- Epic 5: Multi-User Management (for user_id on notes) - Done
- Rich text/markdown formatting (future enhancement)
- Note attachments/images (future enhancement)
- Note categories/tags (future enhancement)
- Shared notes between users (future enhancement)
- Note templates (future enhancement)
- Epic 1: Friend Management - provides friends to attach notes to
- Epic 6: CalDAV/CardDAV - notes could sync via vCard NOTE property
- Epic 8: Activity Timeline - notes could appear in timeline
- Epic 10: Search - notes should be searchable
- Note validation (empty content rejected)
- Note service methods
- CRUD operations for notes
- Pagination of notes list
- Cascade delete when friend is deleted
- Add note flow
- Edit note flow
- Delete note with confirmation
- Notes display in friend detail