ticketfrei3/kibicara/platforms/telegram/model.py
2020-12-30 21:45:06 +01:00

31 lines
761 B
Python

# Copyright (C) 2020 by Cathy Hu <cathy.hu@fau.de>
# Copyright (C) 2020 by Martin Rey <martin.rey@mailbox.org>
#
# SPDX-License-Identifier: 0BSD
from ormantic import Boolean, ForeignKey, Integer, Model, Text
from kibicara.model import Hood, Mapping
class Telegram(Model):
id: Integer(primary_key=True) = None
hood: ForeignKey(Hood)
api_token: Text(unique=True)
welcome_message: Text()
username: Text(allow_null=True) = None
enabled: Boolean() = True
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'