Skip to content

Conversation

@nycomp
Copy link
Contributor

@nycomp nycomp commented Jan 29, 2026

Implements issue #309 - Assignments resource for campus-classroom.

Summary

Adds a new Assignments resource to the Campus API with full CRUD operations.

Added

  • Models: Assignment, Question, ClassroomLink dataclasses

    • Question IDs use hierarchical dot notation (q1, q1.a, q1.a.i)
    • Self-describing hierarchy without parent_id references
  • Resource Layer: AssignmentsResource with CRUD operations

    • List assignments with optional created_by filter
    • Create new assignment
    • Get assignment by ID
    • Update assignment (title, description, questions, links)
    • Delete assignment
    • Add Classroom links
  • API Routes: /api/v1/assignments

    • GET / - List assignments
    • POST / - Create assignment
    • GET /{id} - Get assignment
    • PATCH /{id} - Update assignment
    • DELETE /{id} - Delete assignment
    • POST /{id}/links - Add Classroom link
  • Tests:

    • 19 unit tests for Assignment model (all passing)
    • Integration tests for API endpoints
  • campus-python client: Assignments resource client

Note

  • Deadlines are managed by Google Classroom, not stored in Campus
  • Integration tests require running auth/vault services

🤖 Generated with Claude Code

Implements issue #309 - Assignments resource for campus-classroom.

Added:
- Assignment model with Question and ClassroomLink dataclasses
- Assignment resource layer with CRUD operations
- Assignment API routes (list, create, get, update, delete, add link)
- Unit tests for Assignment model (19 tests)
- Integration tests for Assignment API endpoints
- campus-python client for Assignments resource

Question IDs use hierarchical dot notation (q1, q1.a, q1.a.i) for
self-describing hierarchy without parent_id references.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@nycomp nycomp linked an issue Jan 29, 2026 that may be closed by this pull request
6 tasks
- Add missing asdict import to routes (fixes NameError)
- Remove unused campus_python import
- Override to_storage() in Assignment model to properly serialize nested dataclasses
- Add __post_init__() validation for question IDs using hierarchical dot notation
- Add explicit authentication check for assignment creation (raise UnauthorizedError instead of silent fallback)
- Add existence check before deletion for consistent error handling

All 19 unit tests pass. Fixes critical serialization and import issues.
@nycomp nycomp merged commit 9792dfe into weekly Jan 29, 2026
1 of 2 checks passed
@nycomp nycomp deleted the nycomp/issue309 branch January 29, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

model and routes for Assignments

3 participants