generated from ocadotechnology/codeforlife-template-backend
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Start api models for contribution agreement (#82) * api models for contribution * change import sorting and format * fixture data for testing * change model fields * test string parsing * Migrate models * fixture data for testing * api models and tests files * fix import statements * fix code format * Fix static types * fix linting test file format * import fix * Check static code * import sort * update DateTime Field * Tests for models * Repository testing * fix class name * tests for models * correct formatting and comments * Change meta classes * Fix code format and imports * Delete all fruit files * Delete last fruit migration * Fix migration issue * change data fields * Apply changes after review * apply initial migrations * Fix contributor type error * Add verbose names * Fix import error * Create api serializers * Test the serializer's functionality * Check static code * Add module doc strings * Contributor tests * Apply changes from second review * Migrate models * Fix doc strings * apply review changes
- Loading branch information
Showing
5 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
© Ocado Group | ||
Created on 12/07/2024 at 14:07:45(+01:00). | ||
""" | ||
|
||
from codeforlife.serializers import ModelSerializer | ||
from codeforlife.user.models import User | ||
|
||
from ..models import AgreementSignature | ||
|
||
|
||
class AgreementSignatureSerializer(ModelSerializer[User, AgreementSignature]): | ||
"""Agreement serializer class""" | ||
|
||
class Meta: | ||
model = AgreementSignature | ||
fields = ["id", "contributor", "agreement_id", "signed_at"] |
This file contains 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
""" | ||
© Ocado Group | ||
Created on 12/07/2024 at 17:16:58(+01:00). | ||
""" | ||
|
||
from codeforlife.tests import ModelSerializerTestCase | ||
from codeforlife.user.models import User | ||
|
||
from ..models import AgreementSignature | ||
from .agreement_signature import AgreementSignatureSerializer | ||
|
||
|
||
class TestAgreementSignatureSerializer( | ||
ModelSerializerTestCase[User, AgreementSignature] | ||
): | ||
"""Test the Agreement Signature serializers""" | ||
|
||
model_serializer_class = AgreementSignatureSerializer |
This file contains 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
© Ocado Group | ||
Created on 12/07/2024 at 14:07:59(+01:00). | ||
""" | ||
from codeforlife.serializers import ModelSerializer | ||
from codeforlife.user.models import User | ||
|
||
from ..models import Contributor | ||
|
||
|
||
class ContributorSerializer(ModelSerializer[User, Contributor]): | ||
"""Contributor serializer class""" | ||
|
||
class Meta: | ||
model = Contributor | ||
fields = ["id", "email", "name", "location", "html_url", "avatar_url"] |
This file contains 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
© Ocado Group | ||
Created on 12/07/2024 at 11:36:23(+01:00). | ||
""" | ||
|
||
from codeforlife.tests import ModelSerializerTestCase | ||
from codeforlife.user.models import User | ||
|
||
from ..models import Contributor | ||
from .contributor import ContributorSerializer | ||
|
||
|
||
class TestContributorSerializer(ModelSerializerTestCase[User, Contributor]): | ||
"""Test the Contributor serializers""" | ||
|
||
model_serializer_class = ContributorSerializer |