Skip to content

Commit c318004

Browse files
committed
fix some bugs
1 parent 41c115e commit c318004

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

src/webapp/database.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def init_db(env: str):
8686
ApiKeyTable(
8787
id=LOCAL_APIKEY_UUID,
8888
hashed_key_value=get_api_key_hash("key_1"),
89+
allows_enduser=True,
8990
created_at=DATETIME_TESTING,
9091
updated_at=DATETIME_TESTING,
9192
created_by=LOCAL_USER_UUID,

src/webapp/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,12 @@ async def generate_api_key(
277277
if not query_result:
278278
raise HTTPException(
279279
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
280-
detail="Database write of the institution creation failed.",
280+
detail="Database write of the API key failed.",
281281
)
282282
elif len(query_result) > 1:
283283
raise HTTPException(
284284
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
285-
detail="Database write of the institution created duplicate entries.",
285+
detail="Database write of the API key duplicate entries.",
286286
)
287287
return {
288288
"access_type": query_result[0][0].access_type,

src/webapp/routers/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def trigger_inference_run(
530530
):
531531
raise HTTPException(
532532
status_code=status.HTTP_400_BAD_REQUEST,
533-
detail="The files in this batch don't conform to the Schema configs allowed by this batch.",
533+
detail="The files in this batch don't conform to the schema configs allowed by this model.",
534534
)
535535
# Note to Datakind: In the long-term, this is where you would have a case block or something that would call different types of pipelines.
536536
db_req = DatabricksInferenceRunRequest(

src/webapp/utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def authenticate_api_key(api_key_enduser_tuple: str, sess: Session) -> BaseUser:
289289
):
290290
# If enduser is set, only allow if the API allows the enduser and the enduser exists.
291291
if enduser:
292-
if not query_result[0][0].allows_enduser:
292+
if not elem[0].allows_enduser:
293293
return False
294294
user_query = select(AccountTable).where(
295295
AccountTable.email == enduser,

0 commit comments

Comments
 (0)