ticketfrei3/kibicara/platforms/email/model.py

34 lines
912 B
Python
Raw Normal View History

2020-07-15 21:50:24 +00:00
# Copyright (C) 2020 by Maike <maike@systemli.org>
# Copyright (C) 2020 by Cathy Hu <cathy.hu@fau.de>
# Copyright (C) 2020 by Thomas Lindner <tom@dl6tom.de>
# Copyright (C) 2020 by Martin Rey <martin.rey@mailbox.org>
2020-07-05 17:21:40 +00:00
#
# SPDX-License-Identifier: 0BSD
2020-10-13 08:35:20 +00:00
from ormantic import ForeignKey, Integer, Model, Text
2020-07-05 17:21:40 +00:00
from kibicara.model import Hood, Mapping
2020-07-15 21:50:24 +00:00
class Email(Model):
"""This table is used to track the names. It also stores the token secret."""
2020-07-06 19:26:32 +00:00
2020-07-05 17:21:40 +00:00
id: Integer(primary_key=True) = None
hood: ForeignKey(Hood)
2020-07-15 21:50:24 +00:00
name: Text(unique=True)
secret: Text()
2020-07-05 17:21:40 +00:00
class Mapping(Mapping):
2020-07-15 21:50:24 +00:00
table_name = 'email'
2020-07-05 17:21:40 +00:00
2020-07-15 21:50:24 +00:00
class EmailSubscribers(Model):
"""This table stores all subscribers, who want to receive messages via email."""
2020-07-06 19:26:32 +00:00
2020-07-05 17:21:40 +00:00
id: Integer(primary_key=True) = None
2020-07-15 21:50:24 +00:00
hood: ForeignKey(Hood)
email: Text(unique=True)
2020-07-05 17:21:40 +00:00
class Mapping(Mapping):
2020-07-15 21:50:24 +00:00
table_name = 'email_subscribers'