Skip to content

feat: implement eligibility REST API endpoint#136

Merged
Agrendalath merged 20 commits intomainfrom
agrendalath/bb-9902-generation-api
May 1, 2026
Merged

feat: implement eligibility REST API endpoint#136
Agrendalath merged 20 commits intomainfrom
agrendalath/bb-9902-generation-api

Conversation

@Agrendalath
Copy link
Copy Markdown
Member

@Agrendalath Agrendalath commented Feb 13, 2026

Added

  • Credential eligibility check endpoint (GET /api/learning_credentials/v1/eligibility/<learning_context_key>/) with detailed progress information.

Changed

  • Processor functions now return dict[int, dict[str, Any]] with detailed eligibility information instead of list[int] of eligible user IDs.
  • Processor functions now accept an optional user_id parameter for single-user eligibility checks.

@Agrendalath Agrendalath requested a review from Copilot February 13, 2026 21:01
@Agrendalath Agrendalath self-assigned this Feb 13, 2026
@Agrendalath Agrendalath changed the title Agrendalath/bb 9902 generation api feat: implement eligibility REST API endpoint Feb 13, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds new REST API endpoints for credential eligibility checking and generation, marking version 0.5.1rc1. The changes refactor the internal processor functions to return detailed eligibility information (as dictionaries) rather than simple lists of eligible user IDs, enabling more informative API responses. The PR introduces three new endpoints: one for checking eligibility with detailed progress information, one for triggering credential generation, and one for listing user credentials.

Changes:

  • Refactored processor functions to return dict[int, dict[str, Any]] with detailed eligibility and progress information instead of list[int]
  • Added credential eligibility check endpoint (GET) with detailed progress data including current grades, completion percentages, and existing credential information
  • Added credential generation endpoint (POST) for eligible users to request credential generation
  • Added credential list endpoint (GET) with optional filtering by learning context

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
uv.lock Updated version lock to 0.5.1rc1
pyproject.toml Bumped version to 0.5.1rc1
CHANGELOG.rst Added changelog entry for 0.5.1 release
learning_credentials/processors.py Refactored all processor functions to return detailed dict results instead of user ID lists; added user_id parameter for single-user queries
learning_credentials/models.py Added _call_retrieval_func and get_user_eligibility_details methods; updated get_eligible_user_ids to extract eligible IDs from detailed results
learning_credentials/api/v1/views.py Added CredentialEligibilityView for GET/POST eligibility operations and CredentialListView for listing credentials; updated CredentialConfigurationCheckView permissions
learning_credentials/api/v1/serializers.py Added CredentialModelSerializer, CredentialEligibilitySerializer, CredentialEligibilityResponseSerializer, and CredentialListResponseSerializer
learning_credentials/api/v1/permissions.py Added IsAdminOrSelf permission class for username-based access control
learning_credentials/api/v1/urls.py Added URL patterns for eligibility check, credential generation, and credential list endpoints
tests/test_views.py Added comprehensive test suites for CredentialEligibilityView and CredentialListView
tests/test_processors.py Updated tests to match new processor return type and added tests for detailed result structure
tests/test_models.py Added tests for get_user_eligibility_details method
tests/conftest.py Updated mock retrieval function to return dict format with user_id parameter support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_views.py Outdated
Comment thread CHANGELOG.rst Outdated
Comment thread CHANGELOG.rst
Comment thread learning_credentials/api/v1/views.py Outdated
Comment thread learning_credentials/api/v1/views.py Outdated
Comment thread learning_credentials/api/v1/permissions.py Outdated
Comment thread tests/test_views.py Outdated
@Agrendalath Agrendalath force-pushed the agrendalath/bb-9902-generation-api branch 2 times, most recently from 8388035 to 6d8a532 Compare March 16, 2026 15:47
@Agrendalath
Copy link
Copy Markdown
Member Author

Note for future reference: credential list view has been removed in 8d770c1 because we do not need it at the moment.

@Agrendalath Agrendalath force-pushed the agrendalath/bb-9902-generation-api branch 2 times, most recently from d8a6d98 to e693087 Compare March 17, 2026 22:00
@Agrendalath Agrendalath requested a review from Copilot March 17, 2026 22:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG.rst
Comment thread learning_credentials/api/v1/urls.py Outdated
Comment thread learning_credentials/api/v1/views.py
Comment thread learning_credentials/api/v1/views.py Outdated
Comment thread learning_credentials/api/v1/views.py Outdated
Comment thread learning_credentials/api/v1/views.py Outdated
Comment thread learning_credentials/processors.py
Comment thread learning_credentials/models.py
@Agrendalath Agrendalath force-pushed the agrendalath/bb-9902-generation-api branch from 10d29d5 to da84b4f Compare March 26, 2026 20:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread learning_credentials/processors.py Outdated
Comment thread learning_credentials/api/v1/views.py Outdated
Comment thread learning_credentials/api/v1/views.py
Comment thread CHANGELOG.rst
Comment thread pyproject.toml Outdated
Comment thread learning_credentials/processors.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread learning_credentials/processors.py
Comment thread learning_credentials/processors.py
Comment thread learning_credentials/api/v1/views.py
Comment thread learning_credentials/processors.py
@Agrendalath
Copy link
Copy Markdown
Member Author

I'm merging this to unblock things.

@Agrendalath Agrendalath merged commit a1d5e28 into main May 1, 2026
17 checks passed
@Agrendalath Agrendalath deleted the agrendalath/bb-9902-generation-api branch May 1, 2026 19:03
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.

2 participants