Skip to content

Implement ticket check #24

Description

@github-actions

# TODO: Implement ticket check

        return Response({"message": "GET request received"}, status=200)
    elif request.method == "POST":
        return Response({"message": "POST request received"}, status=200)


@api_view(["GET"])
def verify_ticket(request, ticket):
    # TODO: Implement ticket check
    if ticket == 'test123':
        return Response(
            {"is_valid": True}, status=status.HTTP_200_OK,
        )
    return Response(
        {"is_valid": False}, status=status.HTTP_400_BAD_REQUEST,
    )


@api_view(["POST"])
def create_attendant(request):
    ticket_id = request.data.get("ticket_id")
    nfc_id = b16decode(request.data.get("nfc_id"), casefold=True)

    if not ticket_id or not nfc_id:
        return Response(
            {"error": "ticket_id and nfc_id are required."},
            status=status.HTTP_400_BAD_REQUEST,
        )

    attendant = Attendant.objects.create(ticket_id=ticket_id, nfc_id=nfc_id)

    return Response(
        {
            "message": "Attendant created successfully.",
            "id": attendant.id,
        }
    )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions