diff options
Diffstat (limited to 'dbstore')
-rw-r--r-- | dbstore/peewee_store.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/dbstore/peewee_store.py b/dbstore/peewee_store.py index d05c642..ebf3536 100644 --- a/dbstore/peewee_store.py +++ b/dbstore/peewee_store.py | |||
@@ -23,6 +23,15 @@ class User(BaseModel): | |||
23 | client_id = CharField(max_length=128) | 23 | client_id = CharField(max_length=128) |
24 | client_secret = CharField(max_length=128) | 24 | client_secret = CharField(max_length=128) |
25 | toot_visibility = CharField(max_length=128, default=TOOT_VISIBILITY_PRIVATE) | 25 | toot_visibility = CharField(max_length=128, default=TOOT_VISIBILITY_PRIVATE) |
26 | # delayed checkin in minutes | ||
27 | delayed_checkin = IntegerField(default=0) | ||
28 | |||
29 | |||
30 | def update_delayed_checkin(telegram_user_id: str, delayed_checkin: int) -> int: | ||
31 | with db.connection_context(): | ||
32 | return User.update(delayed_checkin=delayed_checkin).where( | ||
33 | User.telegram_user_id == telegram_user_id | ||
34 | ).execute() | ||
26 | 35 | ||
27 | 36 | ||
28 | def update_user_visibility(telegram_user_id: str, visibility: str) -> int: | 37 | def update_user_visibility(telegram_user_id: str, visibility: str) -> int: |
@@ -45,6 +54,7 @@ def get_user_by_id(telegram_user_id: str) -> dict: | |||
45 | "client_id": user.client_id, | 54 | "client_id": user.client_id, |
46 | "client_secret": user.client_secret, | 55 | "client_secret": user.client_secret, |
47 | "toot_visibility": user.toot_visibility, | 56 | "toot_visibility": user.toot_visibility, |
57 | "delayed_checkin": user.delayed_checkin, | ||
48 | } | 58 | } |
49 | except DoesNotExist: | 59 | except DoesNotExist: |
50 | return {} | 60 | return {} |