Closed XanderVertegaal closed 1 week ago
To address the main issue of authentication: you're right that the endpoint used to be reachable for everyone. To address this, I've added a simple Middleware (only for requests aimed at the GraphQL endpoint) that check if the user is authenticated or not. You can test this by visiting localhost:8000/api/graphql
and querying sources
both when you're logged out and when you're logged in. I've also added a test to makes sure this doesn't break. (Run with python manage.py test
)
Part of #75
Basic implementation of a GraphQL API using Graphene (Django) en Apollo (Angular).
Don't forget to install dependencies and run
yarn codegen
when running the application frontend.This PR also adds a SourceType, a query
sources
and two mutations:DeleteSource
andUpdateOrCreateSource
, so there is something to test. Visitlocalhost:8000/api/graphql
to test them out.Still to do (in other PRs):
codegen.ts
andgraphql.module.ts
are hardcoded.I'll focus on writing more types and queries after this PR so we can start using them in the frontend when the views/components are there.