Phase 1 of #313
Create a new Biotrackr.LifeEvents.Api domain API service — the first domain API with write endpoints (POST/PUT/DELETE). Follows the Food.Api pattern as the cleanest existing template.
PR Scope
src/Biotrackr.LifeEvents.Api/ (new service — app + unit tests + integration tests)
Steps
Step 1.1: Scaffold solution and project structure (.sln, 3 .csproj, coverage.runsettings)
Step 1.2: Implement data models (LifeEventDocument, CreateLifeEventRequest, UpdateLifeEventRequest, PaginationRequest, LifeEventCategory)
Step 1.3: Implement repository (read with interval overlap queries + write with CreateItemAsync/ReplaceItemAsync/DeleteItemAsync)
Step 1.4: Implement endpoint handlers and LifeEventValidator (ASI01 prompt injection scanning on Description/Notes)
Step 1.5: Implement extensions (ServiceCollectionExtensions.AddCosmosDb(), EndpointRouteBuilderExtensions)
Step 1.6: Implement Program.cs with rate limiting (30 writes/min) and 64KB request body size limit
Step 1.7: Create Dockerfile and .dockerignore
Step 1.8: Create unit test project
Step 1.9: Implement LifeEventsHandlersShould tests (read + write + validation + injection scanning)
Step 1.10: Implement CosmosRepositoryShould tests
Step 1.11: Implement model and extension tests (LifeEventCategoryShould, PaginationRequestShould, etc.)
Step 1.12: Create integration test project with fixtures (WebApplicationFactory, ContractTestFixture, IntegrationTestFixture)
Step 1.13: Implement contract tests (ApiSmokeTests, ProgramStartupTests)
Step 1.14: Implement E2E tests (CRUD lifecycle, multi-day event overlap queries)
Step 1.15: Validate — build, run all tests, verify ≥70% coverage
API Endpoints
Route
Method
Handler
Returns
GET /
GET
GetAllLifeEvents
Ok<PaginationResponse<LifeEventDocument>>
GET /{date}
GET
GetLifeEventsByDate
BadRequest | Ok<PaginationResponse<LifeEventDocument>>
GET /range/{startDate}/{endDate}
GET
GetLifeEventsByDateRange
BadRequest | Ok<PaginationResponse<LifeEventDocument>>
POST /
POST
CreateLifeEvent
BadRequest | Created<LifeEventDocument>
PUT /{id}
PUT
UpdateLifeEvent
BadRequest | NotFound | Ok<LifeEventDocument>
DELETE /{id}
DELETE
DeleteLifeEvent
NotFound | NoContent
Acceptance Criteria
Details
.copilot-tracking/details/2026-04-23/life-events-feature-details.md — Phase 1 (Steps 1.1–1.15)
Phase 1 of #313
Create a new
Biotrackr.LifeEvents.Apidomain API service — the first domain API with write endpoints (POST/PUT/DELETE). Follows the Food.Api pattern as the cleanest existing template.PR Scope
src/Biotrackr.LifeEvents.Api/(new service — app + unit tests + integration tests)Steps
.sln, 3.csproj,coverage.runsettings)LifeEventDocument,CreateLifeEventRequest,UpdateLifeEventRequest,PaginationRequest,LifeEventCategory)CreateItemAsync/ReplaceItemAsync/DeleteItemAsync)LifeEventValidator(ASI01 prompt injection scanning on Description/Notes)ServiceCollectionExtensions.AddCosmosDb(),EndpointRouteBuilderExtensions)Program.cswith rate limiting (30 writes/min) and 64KB request body size limit.dockerignoreLifeEventsHandlersShouldtests (read + write + validation + injection scanning)CosmosRepositoryShouldtestsLifeEventCategoryShould,PaginationRequestShould, etc.)WebApplicationFactory,ContractTestFixture,IntegrationTestFixture)ApiSmokeTests,ProgramStartupTests)API Endpoints
GET /GetAllLifeEventsOk<PaginationResponse<LifeEventDocument>>GET /{date}GetLifeEventsByDateBadRequest | Ok<PaginationResponse<LifeEventDocument>>GET /range/{startDate}/{endDate}GetLifeEventsByDateRangeBadRequest | Ok<PaginationResponse<LifeEventDocument>>POST /CreateLifeEventBadRequest | Created<LifeEventDocument>PUT /{id}UpdateLifeEventBadRequest | NotFound | Ok<LifeEventDocument>DELETE /{id}DeleteLifeEventNotFound | NoContentAcceptance Criteria
LifeEventValidatorscans Description/Notes for prompt injection patterns (ASI01)Details
.copilot-tracking/details/2026-04-23/life-events-feature-details.md— Phase 1 (Steps 1.1–1.15)