-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement eligibility REST API endpoint #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
3af2c58
feat: implement eligibility REST API endpoint
Agrendalath 51c6170
temp: bump version to create a pre-release
Agrendalath 774d0ec
fixup! feat: implement eligibility REST API endpoint
Agrendalath 4d0b39b
fixup! feat: implement eligibility REST API endpoint
Agrendalath 6d33844
fixup! temp: bump version to create a pre-release
Agrendalath 7a4d162
fixup! feat: implement eligibility REST API endpoint
Agrendalath f5de9d6
fixup! feat: implement eligibility REST API endpoint
Agrendalath 3b7f75d
fixup! feat: implement eligibility REST API endpoint
Agrendalath a22883b
fixup! feat: implement eligibility REST API endpoint
Agrendalath 70695e4
fixup! temp: bump version to create a pre-release
Agrendalath fd1ff19
fixup! feat: implement eligibility REST API endpoint
Agrendalath 00459c3
fixup! feat: implement eligibility REST API endpoint
Agrendalath a9526c8
fixup! feat: implement eligibility REST API endpoint
Agrendalath da84b4f
fixup! feat: implement eligibility REST API endpoint
Agrendalath ba52f72
fixup! temp: bump version to create a pre-release
Agrendalath 72724d1
fixup! temp: bump version to create a pre-release
Agrendalath bff573a
chore: allow filtering Credential Configurations by periodic task status
Agrendalath 9836c9c
fixup! temp: bump version to create a pre-release
Agrendalath 8b20548
fixup! feat: implement eligibility REST API endpoint
Agrendalath 63015b5
fixup! temp: bump version to create a pre-release
Agrendalath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,48 @@ | ||
| """API serializers for learning credentials.""" | ||
|
|
||
| from typing import Any | ||
|
|
||
| from rest_framework import serializers | ||
|
|
||
| from learning_credentials.models import Credential | ||
|
|
||
|
|
||
| class CredentialSerializer(serializers.ModelSerializer): | ||
| """Serializer that returns credential metadata.""" | ||
| """Serializer that returns credential metadata (for the public verification endpoint).""" | ||
|
|
||
| class Meta: | ||
| """Serializer metadata.""" | ||
|
|
||
| model = Credential | ||
| fields = ('user_full_name', 'created', 'learning_context_name', 'status', 'invalidation_reason') | ||
|
|
||
|
|
||
| class CredentialEligibilitySerializer(serializers.Serializer): | ||
| """Serializer for credential eligibility information with dynamic fields.""" | ||
|
|
||
| credential_type_id = serializers.IntegerField() | ||
| name = serializers.CharField() | ||
| is_generation_enabled = serializers.BooleanField() | ||
| is_eligible = serializers.BooleanField() | ||
| existing_credential = serializers.UUIDField(required=False, allow_null=True) | ||
| existing_credential_url = serializers.URLField(required=False, allow_blank=True, allow_null=True) | ||
|
|
||
| current_grades = serializers.DictField(required=False) | ||
| required_grades = serializers.DictField(required=False) | ||
|
|
||
| current_completion = serializers.FloatField(required=False, allow_null=True) | ||
| required_completion = serializers.FloatField(required=False, allow_null=True) | ||
|
|
||
| steps = serializers.DictField(required=False) | ||
|
|
||
| def to_representation(self, instance: dict) -> dict[str, Any]: | ||
| """Remove null/empty fields from representation.""" | ||
| data = super().to_representation(instance) | ||
| return {key: value for key, value in data.items() if value is not None and value not in ({}, [])} | ||
|
|
||
|
|
||
| class CredentialEligibilityResponseSerializer(serializers.Serializer): | ||
| """Serializer for the complete credential eligibility response.""" | ||
|
|
||
| context_key = serializers.CharField() | ||
| credentials = CredentialEligibilitySerializer(many=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.