API: GET/PUT /api/today endpoints #2

Open
opened 2026-03-28 02:09:34 +00:00 by forgejo_admin · 0 comments

Type

Feature

Lineage

Standalone — scoped from Daily 100 design spec.

Repo

forgejo_admin/daily-100-api

User Story

As a user
I want to view and update today's checklist
So that I can track my daily progress

Context

GET /api/today returns today's entry (auto-creates if missing). "Today" is determined by America/Denver timezone. PUT /api/today accepts 8 boolean fields to update. Past days are frozen — PUT must reject updates for any date that is not today. Request body: {"doordash": true, "pushups": true, "jumprope": false, ...}.

File Targets

Files the agent should modify or create:

  • app/routes/today.py -- GET and PUT endpoint handlers
  • app/schemas.py -- Pydantic request/response models

Files the agent should NOT touch:

  • app/models.py -- already defined in scaffold issue

Acceptance Criteria

  • GET creates entry if none exists for today
  • GET returns current state of all 8 items
  • PUT accepts and updates 8 boolean fields
  • PUT rejects edits to past days (returns 403)
  • "Today" uses America/Denver timezone

Test Expectations

  • Unit test: GET creates entry on first access
  • Unit test: PUT toggles items correctly
  • Unit test: PUT rejects past-day edits
  • Unit test: timezone boundary behavior
  • Run command: pytest tests/test_today.py

Constraints

  • Use zoneinfo.ZoneInfo("America/Denver") for timezone
  • Pydantic v2 models for request/response

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • daily-100 -- project
### Type Feature ### Lineage Standalone — scoped from Daily 100 design spec. ### Repo `forgejo_admin/daily-100-api` ### User Story As a user I want to view and update today's checklist So that I can track my daily progress ### Context GET /api/today returns today's entry (auto-creates if missing). "Today" is determined by America/Denver timezone. PUT /api/today accepts 8 boolean fields to update. Past days are frozen — PUT must reject updates for any date that is not today. Request body: `{"doordash": true, "pushups": true, "jumprope": false, ...}`. ### File Targets Files the agent should modify or create: - `app/routes/today.py` -- GET and PUT endpoint handlers - `app/schemas.py` -- Pydantic request/response models Files the agent should NOT touch: - `app/models.py` -- already defined in scaffold issue ### Acceptance Criteria - [ ] GET creates entry if none exists for today - [ ] GET returns current state of all 8 items - [ ] PUT accepts and updates 8 boolean fields - [ ] PUT rejects edits to past days (returns 403) - [ ] "Today" uses America/Denver timezone ### Test Expectations - [ ] Unit test: GET creates entry on first access - [ ] Unit test: PUT toggles items correctly - [ ] Unit test: PUT rejects past-day edits - [ ] Unit test: timezone boundary behavior - Run command: `pytest tests/test_today.py` ### Constraints - Use `zoneinfo.ZoneInfo("America/Denver")` for timezone - Pydantic v2 models for request/response ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `daily-100` -- project
Commenting is not possible because the repository is archived.
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/daily-100-api#2
No description provided.