Set up an event-bus so that the discord bot can be notified by the nfc scanner
fromdjango.shortcutsimportrenderfromdjango.views.decorators.httpimportrequire_POSTfromdjango.views.decorators.cacheimportnever_cachefromdjango.httpimportJsonResponsefromdatabase.modelsimportAttendant@require_POST@never_cachedefscanned(request, tag: bytes):
try:
attendant=Attendant.objects.get(tag=tag)
# TODO: Queue eventreturnJsonResponse({"valid": attendant.is_valid}, status=202)
exceptAttendant.DoesNotExist:
returnJsonResponse({"error": "No such tag"}, status=404)
Set up an event-bus so that the discord bot can be notified by the nfc scanner
BackendAPI/backendapi/views.py
Line 14 in 574dcde