Oops
This commit is contained in:
@@ -19,6 +19,7 @@ class AuthController:
|
||||
auth_api = AuthApi(client)
|
||||
|
||||
auth_request = AuthRequestDto(
|
||||
username=StrictStr(received_data["username"]),
|
||||
username=StrictStr(received_data["username"]),
|
||||
key=StrictStr(received_data["key"]),
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from board_mate.client import Configuration, ApiClient, ClientApi, ClientDto, ApiException
|
||||
from flask import jsonify
|
||||
from flask import jsonify, request
|
||||
from pydantic import StrictStr
|
||||
|
||||
|
||||
@@ -13,21 +13,25 @@ class GameController:
|
||||
app.add_url_rule("/client/create", view_func=self.create, methods=['POST'])
|
||||
|
||||
def create(self):
|
||||
with ApiClient(self.config) as api_client:
|
||||
client_api = ClientApi(api_client)
|
||||
try:
|
||||
with ApiClient(self.config) as api_client:
|
||||
request_data = request.get_json()
|
||||
|
||||
new_client = ClientDto(
|
||||
name=StrictStr("Alice Example"),
|
||||
username=StrictStr("alice123"),
|
||||
)
|
||||
client_api = ClientApi(api_client)
|
||||
|
||||
new_client = ClientDto(
|
||||
companyName=StrictStr(request_data["companyName"]),
|
||||
username=StrictStr(request_data["username"]),
|
||||
key=StrictStr(request_data["key"]),
|
||||
)
|
||||
|
||||
try:
|
||||
response = client_api.create(client_dto=new_client)
|
||||
print("Success:", response.success)
|
||||
print("Message:", response.message)
|
||||
print("Data:", response.data)
|
||||
return jsonify(response), 200
|
||||
except ApiException as e:
|
||||
print(f"Exception when calling ClientApi->create: {e}")
|
||||
return jsonify(response), 500
|
||||
|
||||
except ApiException as e:
|
||||
print(f"Exception when calling ClientApi->create: {e}")
|
||||
return jsonify(response), 500
|
||||
|
||||
|
||||
Reference in New Issue
Block a user