Module kibicara.platforms.email.model

Expand source code
# 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>
#
# SPDX-License-Identifier: 0BSD

from kibicara.model import Hood, Mapping
from ormantic import Integer, ForeignKey, Model, Text


class Email(Model):
    """ This table is used to track the names. It also stores the token secret. """

    id: Integer(primary_key=True) = None
    hood: ForeignKey(Hood)
    name: Text(unique=True)
    secret: Text()

    class Mapping(Mapping):
        table_name = 'email'


class EmailSubscribers(Model):
    """ This table stores all subscribers, who want to receive messages via email. """

    id: Integer(primary_key=True) = None
    hood: ForeignKey(Hood)
    email: Text(unique=True)

    class Mapping(Mapping):
        table_name = 'email_subscribers'

Classes

class Email (**data)

This table is used to track the names. It also stores the token secret.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Email(Model):
    """ This table is used to track the names. It also stores the token secret. """

    id: Integer(primary_key=True) = None
    hood: ForeignKey(Hood)
    name: Text(unique=True)
    secret: Text()

    class Mapping(Mapping):
        table_name = 'email'

Ancestors

  • ormantic.models.Model
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Mapping
var hood : ormantic.fields.ForeignKey
var id : ormantic.fields.Integer
var name : ormantic.fields.Text
var secret : ormantic.fields.Text

Instance variables

var objects
Expand source code
def __get__(self, instance, owner):
    return self.__class__(model_cls=owner)
class EmailSubscribers (**data)

This table stores all subscribers, who want to receive messages via email.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class EmailSubscribers(Model):
    """ This table stores all subscribers, who want to receive messages via email. """

    id: Integer(primary_key=True) = None
    hood: ForeignKey(Hood)
    email: Text(unique=True)

    class Mapping(Mapping):
        table_name = 'email_subscribers'

Ancestors

  • ormantic.models.Model
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Mapping
var email : ormantic.fields.Text
var hood : ormantic.fields.ForeignKey
var id : ormantic.fields.Integer

Instance variables

var objects
Expand source code
def __get__(self, instance, owner):
    return self.__class__(model_cls=owner)