2020-07-10 21:53:24 +00:00
|
|
|
# Copyright (C) 2020 by Cathy Hu <cathy.hu@fau.de>
|
2020-09-28 22:54:34 +00:00
|
|
|
# Copyright (C) 2020 by Martin Rey <martin.rey@mailbox.org>
|
2020-07-10 21:53:24 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: 0BSD
|
|
|
|
|
2020-10-13 08:35:20 +00:00
|
|
|
from ormantic import Boolean, ForeignKey, Integer, Model, Text
|
|
|
|
|
2020-07-10 21:53:24 +00:00
|
|
|
from kibicara.model import Hood, Mapping
|
|
|
|
|
|
|
|
|
|
|
|
class Telegram(Model):
|
|
|
|
id: Integer(primary_key=True) = None
|
|
|
|
hood: ForeignKey(Hood)
|
2020-07-17 13:07:24 +00:00
|
|
|
api_token: Text(unique=True)
|
2020-07-10 21:53:24 +00:00
|
|
|
welcome_message: Text()
|
2020-08-31 12:08:53 +00:00
|
|
|
username: Text(allow_null=True) = None
|
2020-07-17 13:07:24 +00:00
|
|
|
enabled: Boolean() = True
|
2020-07-10 21:53:24 +00:00
|
|
|
|
|
|
|
class Mapping(Mapping):
|
|
|
|
table_name = 'telegrambots'
|
|
|
|
|
|
|
|
|
|
|
|
class TelegramUser(Model):
|
|
|
|
id: Integer(primary_key=True) = None
|
|
|
|
user_id: Integer(unique=True)
|
|
|
|
# TODO unique
|
|
|
|
bot: ForeignKey(Telegram)
|
|
|
|
|
|
|
|
class Mapping(Mapping):
|
|
|
|
table_name = 'telegramusers'
|