aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dbstore')
-rw-r--r--dbstore/peewee_store.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/dbstore/peewee_store.py b/dbstore/peewee_store.py
index 89e4b4b..3d37140 100644
--- a/dbstore/peewee_store.py
+++ b/dbstore/peewee_store.py
@@ -24,6 +24,23 @@ class User(BaseModel):
24 toot_visibility = CharField(max_length=128, default=TOOT_VISIBILITY_PRIVATE) 24 toot_visibility = CharField(max_length=128, default=TOOT_VISIBILITY_PRIVATE)
25 25
26 26
27def get_user_by_state(state: str) -> dict:
28 with db.connection_context():
29 try:
30 user = User.get(User.state == state)
31 return {
32 "telegram_user_id": user.telegram_user_id,
33 "access_key": user.access_key,
34 "home_instance": user.home_instance,
35 "state": user.state,
36 "client_id": user.client_id,
37 "client_secret": user.client_secret,
38 "toot_visibility": user.toot_visibility,
39 }
40 except DoesNotExist:
41 return {}
42
43
27class Location(BaseModel): 44class Location(BaseModel):
28 fsq_id = CharField(unique=True, primary_key=True) 45 fsq_id = CharField(unique=True, primary_key=True)
29 name = CharField(max_length=128) 46 name = CharField(max_length=128)
Powered by cgit v1.2.3 (git 2.41.0)