ticketfrei3/kibicara/platforms/email/model.py

32 lines
855 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>
2020-07-05 17:21:40 +00:00
#
# SPDX-License-Identifier: 0BSD
from kibicara.model import Hood, Mapping
from ormantic import Integer, ForeignKey, Model, Text
2020-07-05 17:21:40 +00:00
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'