-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from CentreForDigitalHumanities/feature/contr…
…ibutions-in-db Feature/contributions in db
- Loading branch information
Showing
15 changed files
with
261 additions
and
6 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
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
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,20 @@ | ||
# Generated by Django 4.2.7 on 2024-08-06 10:02 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('event', '0021_rename_eventdescriptionagent_episodeagent_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='episode', | ||
name='contributors', | ||
field=models.ManyToManyField(blank=True, help_text='Users who contributed to this entry', to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
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
30 changes: 30 additions & 0 deletions
30
backend/letter/migrations/0018_giftdescription_contributors_and_more.py
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,30 @@ | ||
# Generated by Django 4.2.7 on 2024-08-06 10:02 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('letter', '0017_alter_giftdescriptioncategory_category_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='giftdescription', | ||
name='contributors', | ||
field=models.ManyToManyField(blank=True, help_text='Users who contributed to this entry', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AddField( | ||
model_name='letterdescription', | ||
name='contributors', | ||
field=models.ManyToManyField(blank=True, help_text='Users who contributed to this entry', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AddField( | ||
model_name='preservedletter', | ||
name='contributors', | ||
field=models.ManyToManyField(blank=True, help_text='Users who contributed to this entry', to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
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
33 changes: 33 additions & 0 deletions
33
backend/person/migrations/0020_agentdescription_contributors_and_more.py
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,33 @@ | ||
# Generated by Django 4.2.7 on 2024-08-06 10:02 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("person", "0019_alter_agentdescriptionlocation_agent"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="agentdescription", | ||
name="contributors", | ||
field=models.ManyToManyField( | ||
blank=True, | ||
help_text="Users who contributed to this entry", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="historicalperson", | ||
name="contributors", | ||
field=models.ManyToManyField( | ||
blank=True, | ||
help_text="Users who contributed to this entry", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
] |
35 changes: 35 additions & 0 deletions
35
backend/space/migrations/0017_region_contributors_settlement_contributors_and_more.py
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,35 @@ | ||
# Generated by Django 4.2.7 on 2024-08-06 10:02 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('space', '0016_settlement_regions'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='region', | ||
name='contributors', | ||
field=models.ManyToManyField(blank=True, help_text='Users who contributed to this entry', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AddField( | ||
model_name='settlement', | ||
name='contributors', | ||
field=models.ManyToManyField(blank=True, help_text='Users who contributed to this entry', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AddField( | ||
model_name='spacedescription', | ||
name='contributors', | ||
field=models.ManyToManyField(blank=True, help_text='Users who contributed to this entry', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AddField( | ||
model_name='structure', | ||
name='contributors', | ||
field=models.ManyToManyField(blank=True, help_text='Users who contributed to this entry', to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
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,27 @@ | ||
from graphene import Field, List, ResolveInfo | ||
from django.db.models import QuerySet | ||
from graphene import ID, Field, List, NonNull, ObjectType, ResolveInfo | ||
from django.db.models import QuerySet | ||
from user.types.UserType import UserType | ||
from user.models import User | ||
|
||
|
||
class UserQueries(ObjectType): | ||
user_description = Field(UserType, id=ID(required=True)) | ||
user_descriptions = List(NonNull(UserType), required=True) | ||
|
||
@staticmethod | ||
def resolve_user_description( | ||
parent: None, info: ResolveInfo, id: str | ||
) -> User | None: | ||
try: | ||
return UserType.get_queryset(User.objects, info).get(id=id) | ||
except User.DoesNotExist: | ||
return None | ||
|
||
@staticmethod | ||
def resolve_user_descriptions( | ||
parent: None, | ||
info: ResolveInfo, | ||
) -> QuerySet[User]: | ||
return UserType.get_queryset(User.objects, info) |
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,21 @@ | ||
from graphene import ResolveInfo | ||
from graphene_django import DjangoObjectType | ||
|
||
from django.db.models import QuerySet | ||
from user.models import User | ||
|
||
|
||
class UserType(DjangoObjectType): | ||
class Meta: | ||
model = User | ||
fields = [ | ||
"id", | ||
"first_name", | ||
"last_name", | ||
] | ||
|
||
@classmethod | ||
def get_queryset( | ||
cls, queryset: QuerySet[User], info: ResolveInfo | ||
) -> QuerySet[User]: | ||
return queryset.all() |
Oops, something went wrong.