diff options
Diffstat (limited to 'dbstore')
-rw-r--r-- | dbstore/peewee_store.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/dbstore/peewee_store.py b/dbstore/peewee_store.py index ed52257..2f637bf 100644 --- a/dbstore/peewee_store.py +++ b/dbstore/peewee_store.py | |||
@@ -51,6 +51,19 @@ def get_user_access_key(telegram_user_id: str) -> str: | |||
51 | return "" | 51 | return "" |
52 | 52 | ||
53 | 53 | ||
54 | def get_user_home_instance(telegram_user_id: str) -> dict: | ||
55 | with db.connection_context(): | ||
56 | try: | ||
57 | user = User.get(User.telegram_user_id == telegram_user_id) | ||
58 | return { | ||
59 | "home_instance": user.home_instance, | ||
60 | "home_instance_type": user.home_instance_type, | ||
61 | "default_visibility": user.toot_visibility, | ||
62 | } | ||
63 | except DoesNotExist: | ||
64 | return {} | ||
65 | |||
66 | |||
54 | class Location(BaseModel): | 67 | class Location(BaseModel): |
55 | fsq_id = CharField(unique=True, primary_key=True) | 68 | fsq_id = CharField(unique=True, primary_key=True) |
56 | name = CharField(max_length=128) | 69 | name = CharField(max_length=128) |