diff --git a/games/graphql/mutations/__init__.py b/games/graphql/mutations/__init__.py deleted file mode 100644 index c44e61a..0000000 --- a/games/graphql/mutations/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .game import Mutation as GameMutation diff --git a/games/graphql/mutations/game.py b/games/graphql/mutations/game.py deleted file mode 100644 index c298606..0000000 --- a/games/graphql/mutations/game.py +++ /dev/null @@ -1,29 +0,0 @@ -import graphene - -from games.graphql.types import Game -from games.models import Game as GameModel - - -class UpdateGameMutation(graphene.Mutation): - class Arguments: - id = graphene.ID(required=True) - name = graphene.String() - year_released = graphene.Int() - wikidata = graphene.String() - - game = graphene.Field(Game) - - def mutate(self, info, id, name=None, year_released=None, wikidata=None): - game_instance = GameModel.objects.get(pk=id) - if name is not None: - game_instance.name = name - if year_released is not None: - game_instance.year_released = year_released - if wikidata is not None: - game_instance.wikidata = wikidata - game_instance.save() - return UpdateGameMutation(game=game_instance) - - -class Mutation(graphene.ObjectType): - update_game = UpdateGameMutation.Field() diff --git a/games/graphql/queries/__init__.py b/games/graphql/queries/__init__.py deleted file mode 100644 index 80f7799..0000000 --- a/games/graphql/queries/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from .device import Query as DeviceQuery -from .game import Query as GameQuery -from .platform import Query as PlatformQuery -from .purchase import Query as PurchaseQuery -from .session import Query as SessionQuery diff --git a/games/graphql/queries/device.py b/games/graphql/queries/device.py deleted file mode 100644 index 19657eb..0000000 --- a/games/graphql/queries/device.py +++ /dev/null @@ -1,11 +0,0 @@ -import graphene - -from games.graphql.types import Device -from games.models import Device as DeviceModel - - -class Query(graphene.ObjectType): - devices = graphene.List(Device) - - def resolve_devices(self, info, **kwargs): - return DeviceModel.objects.all() diff --git a/games/graphql/queries/game.py b/games/graphql/queries/game.py deleted file mode 100644 index 0c74173..0000000 --- a/games/graphql/queries/game.py +++ /dev/null @@ -1,18 +0,0 @@ -import graphene - -from games.graphql.types import Game -from games.models import Game as GameModel - - -class Query(graphene.ObjectType): - games = graphene.List(Game) - game_by_name = graphene.Field(Game, name=graphene.String(required=True)) - - def resolve_games(self, info, **kwargs): - return GameModel.objects.all() - - def resolve_game_by_name(self, info, name): - try: - return GameModel.objects.get(name=name) - except GameModel.DoesNotExist: - return None diff --git a/games/graphql/queries/platform.py b/games/graphql/queries/platform.py deleted file mode 100644 index 44226b3..0000000 --- a/games/graphql/queries/platform.py +++ /dev/null @@ -1,11 +0,0 @@ -import graphene - -from games.graphql.types import Platform -from games.models import Platform as PlatformModel - - -class Query(graphene.ObjectType): - platforms = graphene.List(Platform) - - def resolve_platforms(self, info, **kwargs): - return PlatformModel.objects.all() diff --git a/games/graphql/queries/purchase.py b/games/graphql/queries/purchase.py deleted file mode 100644 index e54e0d5..0000000 --- a/games/graphql/queries/purchase.py +++ /dev/null @@ -1,11 +0,0 @@ -import graphene - -from games.graphql.types import Purchase -from games.models import Purchase as PurchaseModel - - -class Query(graphene.ObjectType): - purchases = graphene.List(Purchase) - - def resolve_purchases(self, info, **kwargs): - return PurchaseModel.objects.all() diff --git a/games/graphql/queries/session.py b/games/graphql/queries/session.py deleted file mode 100644 index 42afbf1..0000000 --- a/games/graphql/queries/session.py +++ /dev/null @@ -1,11 +0,0 @@ -import graphene - -from games.graphql.types import Session -from games.models import Session as SessionModel - - -class Query(graphene.ObjectType): - sessions = graphene.List(Session) - - def resolve_sessions(self, info, **kwargs): - return SessionModel.objects.all() diff --git a/games/graphql/types.py b/games/graphql/types.py deleted file mode 100644 index 1f41968..0000000 --- a/games/graphql/types.py +++ /dev/null @@ -1,45 +0,0 @@ -from graphene_django import DjangoObjectType - -from games.models import Device as DeviceModel - -# from games.models import Edition as EditionModel -from games.models import Game as GameModel -from games.models import Platform as PlatformModel -from games.models import Purchase as PurchaseModel -from games.models import Session as SessionModel - - -class Game(DjangoObjectType): - class Meta: - model = GameModel - fields = "__all__" - - -# class Edition(DjangoObjectType): -# class Meta: -# model = EditionModel -# fields = "__all__" - - -class Purchase(DjangoObjectType): - class Meta: - model = PurchaseModel - fields = "__all__" - - -class Session(DjangoObjectType): - class Meta: - model = SessionModel - fields = "__all__" - - -class Platform(DjangoObjectType): - class Meta: - model = PlatformModel - fields = "__all__" - - -class Device(DjangoObjectType): - class Meta: - model = DeviceModel - fields = "__all__" diff --git a/games/schema.py b/games/schema.py deleted file mode 100644 index 4549ed1..0000000 --- a/games/schema.py +++ /dev/null @@ -1,28 +0,0 @@ -import graphene - -from games.graphql.mutations import GameMutation -from games.graphql.queries import ( - DeviceQuery, - GameQuery, - PlatformQuery, - PurchaseQuery, - SessionQuery, -) - - -class Query( - GameQuery, - DeviceQuery, - PlatformQuery, - PurchaseQuery, - SessionQuery, - graphene.ObjectType, -): - pass - - -class Mutation(GameMutation, graphene.ObjectType): - pass - - -schema = graphene.Schema(query=Query, mutation=Mutation) diff --git a/pyproject.toml b/pyproject.toml index 2a412d9..9607b78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,6 @@ dependencies = [ "django>6.0", "gunicorn>=23.0.0,<24", "uvicorn>=0.30.1,<0.31", - "graphene-django>=3.2.0,<4", "django-htmx>=1.18.0,<2", "django-template-partials>=24.2,<25", "markdown>=3.6,<4", diff --git a/tests/test_graphql.py b/tests/test_graphql.py deleted file mode 100644 index 24471a8..0000000 --- a/tests/test_graphql.py +++ /dev/null @@ -1,35 +0,0 @@ -import json -import os - -import django - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "timetracker.settings") -django.setup() - -from django.test import TestCase -from graphene_django.utils.testing import GraphQLTestCase - -from games import schema -from games.models import Game - - -class GameAPITestCase(GraphQLTestCase): - GRAPHENE_SCHEMA = schema.schema - - def test_query_all_games(self): - response = self.query( - """ - query { - games { - id - name - } - } - """ - ) - - self.assertResponseNoErrors(response) - self.assertEqual( - len(json.loads(response.content)["data"]["games"]), - Game.objects.count(), - ) diff --git a/timetracker/settings.py b/timetracker/settings.py index ed181a2..47db6d8 100644 --- a/timetracker/settings.py +++ b/timetracker/settings.py @@ -39,7 +39,6 @@ INSTALLED_APPS = [ "django.contrib.messages", "django.contrib.staticfiles", "template_partials", - "graphene_django", "django_htmx", "django_cotton", "django_q", diff --git a/timetracker/urls.py b/timetracker/urls.py index 85e57a4..1ea14f7 100644 --- a/timetracker/urls.py +++ b/timetracker/urls.py @@ -18,16 +18,13 @@ from django.conf import settings from django.contrib import admin from django.contrib.auth import views as auth_views from django.urls import include, path -from django.views.decorators.csrf import csrf_exempt from django.views.generic import RedirectView -from graphene_django.views import GraphQLView from games.api import api urlpatterns = [ path("", RedirectView.as_view(url="/tracker")), path("api/", api.urls), - path("graphql", csrf_exempt(GraphQLView.as_view(graphiql=True))), path("login/", auth_views.LoginView.as_view(), name="login"), path("logout/", auth_views.LogoutView.as_view(), name="logout"), path("tracker/", include("games.urls")), diff --git a/uv.lock b/uv.lock index 4fded6a..b715305 100644 --- a/uv.lock +++ b/uv.lock @@ -301,59 +301,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b5/36/7fb70f04bf00bc646cd5bb45aa9eddb15e19437a28b8fb2b4a5249fac770/filelock-3.20.3-py3-none-any.whl", hash = "sha256:4b0dda527ee31078689fc205ec4f1c1bf7d56cf88b6dc9426c4f230e46c2dce1", size = 16701, upload-time = "2026-01-09T17:55:04.334Z" }, ] -[[package]] -name = "graphene" -version = "3.4.3" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "graphql-core" }, - { name = "graphql-relay" }, - { name = "python-dateutil" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/cc/f6/bf62ff950c317ed03e77f3f6ddd7e34aaa98fe89d79ebd660c55343d8054/graphene-3.4.3.tar.gz", hash = "sha256:2a3786948ce75fe7e078443d37f609cbe5bb36ad8d6b828740ad3b95ed1a0aaa", size = 44739, upload-time = "2024-11-09T20:44:25.757Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/66/e0/61d8e98007182e6b2aca7cf65904721fb2e4bce0192272ab9cb6f69d8812/graphene-3.4.3-py2.py3-none-any.whl", hash = "sha256:820db6289754c181007a150db1f7fff544b94142b556d12e3ebc777a7bf36c71", size = 114894, upload-time = "2024-11-09T20:44:23.851Z" }, -] - -[[package]] -name = "graphene-django" -version = "3.2.3" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "django" }, - { name = "graphene" }, - { name = "graphql-core" }, - { name = "graphql-relay" }, - { name = "promise" }, - { name = "text-unidecode" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/6f/7a/8aef131349329dcd167578720f6364412f1728bfda14bba22c1e7b5d8365/graphene-django-3.2.3.tar.gz", hash = "sha256:d831bfe8e9a6e77e477b7854faef4addb318f386119a69ee4c57b74560f3e07d", size = 88393, upload-time = "2025-03-13T08:33:03.949Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/18/35/ab9c668222f6271a0b71efb147c46816229dbb9fa5d15ee6b025eb08d4b2/graphene_django-3.2.3-py2.py3-none-any.whl", hash = "sha256:0c673a4dad315b26b4d18eb379ad0c7027fd6a36d23a1848b7c7c09a14a9271e", size = 114959, upload-time = "2025-03-13T08:33:02.453Z" }, -] - -[[package]] -name = "graphql-core" -version = "3.2.7" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ac/9b/037a640a2983b09aed4a823f9cf1729e6d780b0671f854efa4727a7affbe/graphql_core-3.2.7.tar.gz", hash = "sha256:27b6904bdd3b43f2a0556dad5d579bdfdeab1f38e8e8788e555bdcb586a6f62c", size = 513484, upload-time = "2025-11-01T22:30:40.436Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/0a/14/933037032608787fb92e365883ad6a741c235e0ff992865ec5d904a38f1e/graphql_core-3.2.7-py3-none-any.whl", hash = "sha256:17fc8f3ca4a42913d8e24d9ac9f08deddf0a0b2483076575757f6c412ead2ec0", size = 207262, upload-time = "2025-11-01T22:30:38.912Z" }, -] - -[[package]] -name = "graphql-relay" -version = "3.2.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "graphql-core" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/d1/13/98fbf8d67552f102488ffc16c6f559ce71ea15f6294728d33928ab5ff14d/graphql-relay-3.2.0.tar.gz", hash = "sha256:1ff1c51298356e481a0be009ccdff249832ce53f30559c1338f22a0e0d17250c", size = 50027, upload-time = "2022-04-16T11:03:45.447Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/74/16/a4cf06adbc711bd364a73ce043b0b08d8fa5aae3df11b6ee4248bcdad2e0/graphql_relay-3.2.0-py3-none-any.whl", hash = "sha256:c9b22bd28b170ba1fe674c74384a8ff30a76c8e26f88ac3aa1584dd3179953e5", size = 16940, upload-time = "2022-04-16T11:03:43.895Z" }, -] - [[package]] name = "gunicorn" version = "23.0.0" @@ -580,15 +527,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/07/92/caae8c86e94681b42c246f0bca35c059a2f0529e5b92619f6aba4cf7e7b6/pre_commit-3.8.0-py2.py3-none-any.whl", hash = "sha256:9a90a53bf82fdd8778d58085faf8d83df56e40dfe18f45b19446e26bf1b3a63f", size = 204643, upload-time = "2024-07-28T19:58:59.335Z" }, ] -[[package]] -name = "promise" -version = "2.3" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "six" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/cf/9c/fb5d48abfe5d791cd496e4242ebcf87a4bb2e0c3dcd6e0ae68c11426a528/promise-2.3.tar.gz", hash = "sha256:dfd18337c523ba4b6a58801c164c1904a9d4d1b1747c7d5dbf45b693a49d93d0", size = 19534, upload-time = "2019-12-18T07:31:43.07Z" } - [[package]] name = "pydantic" version = "2.12.5" @@ -870,15 +808,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/49/4b/359f28a903c13438ef59ebeee215fb25da53066db67b305c125f1c6d2a25/sqlparse-0.5.5-py3-none-any.whl", hash = "sha256:12a08b3bf3eec877c519589833aed092e2444e68240a3577e8e26148acc7b1ba", size = 46138, upload-time = "2025-12-19T07:17:46.573Z" }, ] -[[package]] -name = "text-unidecode" -version = "1.3" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/ab/e2/e9a00f0ccb71718418230718b3d900e71a5d16e701a3dae079a21e9cd8f8/text-unidecode-1.3.tar.gz", hash = "sha256:bad6603bb14d279193107714b288be206cac565dfa49aa5b105294dd5c4aab93", size = 76885, upload-time = "2019-08-30T21:36:45.405Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a6/a5/c0b6468d3824fe3fde30dbb5e1f687b291608f9473681bbf7dabbf5a87d7/text_unidecode-1.3-py2.py3-none-any.whl", hash = "sha256:1311f10e8b895935241623731c2ba64f4c455287888b18189350b67134a822e8", size = 78154, upload-time = "2019-08-30T21:37:03.543Z" }, -] - [[package]] name = "timetracker" version = "1.6.1" @@ -891,7 +820,6 @@ dependencies = [ { name = "django-ninja" }, { name = "django-q2" }, { name = "django-template-partials" }, - { name = "graphene-django" }, { name = "gunicorn" }, { name = "markdown" }, { name = "pyyaml" }, @@ -922,7 +850,6 @@ requires-dist = [ { name = "django-ninja", specifier = ">1.5" }, { name = "django-q2", specifier = ">=1.7.4,<2" }, { name = "django-template-partials", specifier = ">=24.2,<25" }, - { name = "graphene-django", specifier = ">=3.2.0,<4" }, { name = "gunicorn", specifier = ">=23.0.0,<24" }, { name = "markdown", specifier = ">=3.6,<4" }, { name = "pyyaml", specifier = ">=6.0.2,<7" },