Assign user_id if not present in key/generate

If the user_id is not specified in the key/generate request it is not added automatically and doesn't appear in the dashboard.
This commit is contained in:
Daniele Scasciafratte 2025-09-30 15:38:42 +02:00 • committed by GitHub
parent fd1a986596
commit 8911a14eaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -580,6 +580,9 @@ async def _common_key_generation_helper( # noqa: PLR0915
prisma_client=prisma_client,
)
if data_json.get("user_id", None) is None:
data_json["user_id"] = user_api_key_dict.user_id
await _enforce_unique_key_alias(
key_alias=data_json.get("key_alias", None),
prisma_client=prisma_client,