Skip to content

Bug: POST /assignments/ returns 500 - current_user.get('id') fails on User object #328

@nycomp

Description

@nycomp

Bug Description

POST /assignments/ endpoint returns 500 error when creating an assignment.

Root Cause

In campus/api/routes/assignments.py:85:

if not current_user or not current_user.get('id'):

The code tries to call .get('id') on current_user, but current_user is a User object, not a dict. This causes an AttributeError: 'User' object has no attribute 'get'.

Expected Behavior

The endpoint should return 201 Created with the new assignment resource.

Actual Behavior

The endpoint returns 500 Internal Server Error.

Related Issues

Fix

Change current_user.get('id') to current_user.id (User objects have an id attribute).

Test Coverage

Contract test created in tests/contract/test_api_submissions.py with 3 tests skipped for this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions