Fix minor bugs
This commit is contained in:
parent
d35a077730
commit
401de2484b
@ -98,12 +98,8 @@ async def post_create_bot_jid(
|
|||||||
# Query the JID for its type
|
# Query the JID for its type
|
||||||
allowed_jid_type: JIDType
|
allowed_jid_type: JIDType
|
||||||
if creation_request.type is None:
|
if creation_request.type is None:
|
||||||
jid_type = await component.get_entity_type(parsed_jid)
|
# Assume that it is a direct-type bot if we cannot query anything
|
||||||
if jid_type is None:
|
jid_type = await component.get_entity_type(parsed_jid) or "account"
|
||||||
raise HTTPException(
|
|
||||||
status_code=500,
|
|
||||||
detail=f"Failed to query entity at {creation_request.jid}",
|
|
||||||
)
|
|
||||||
|
|
||||||
match jid_type:
|
match jid_type:
|
||||||
case "account":
|
case "account":
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from typing import Annotated, Any, Self, cast
|
from typing import Annotated, Any, Generator, Self, cast
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pydantic import BaseModel, Field, model_validator
|
from pydantic import BaseModel, Field, model_validator
|
||||||
@ -86,7 +86,7 @@ class _Config(BaseModel):
|
|||||||
component: _ComponentConfig
|
component: _ComponentConfig
|
||||||
|
|
||||||
|
|
||||||
def load_config() -> _Config:
|
def load_config() -> Generator[_Config]:
|
||||||
"""
|
"""
|
||||||
Load the application config
|
Load the application config
|
||||||
"""
|
"""
|
||||||
@ -111,7 +111,7 @@ def load_config() -> _Config:
|
|||||||
with open(config.database.uri_file, "r", encoding="utf8") as f:
|
with open(config.database.uri_file, "r", encoding="utf8") as f:
|
||||||
config.database.uri_plain = f.read().strip().replace("\n", "")
|
config.database.uri_plain = f.read().strip().replace("\n", "")
|
||||||
|
|
||||||
return config
|
yield config
|
||||||
|
|
||||||
|
|
||||||
ConfigDep = Annotated[_Config, Depends(load_config)]
|
ConfigDep = Annotated[_Config, Depends(load_config)]
|
||||||
|
Loading…
Reference in New Issue
Block a user