Example #1
0
from mongokit import Document
from pouch import connection
from datetime import datetime

@connection.register
class Babysitter(Document):
        __collection__= 'babysitters'
        __database__= 'pouch'
        structure = {
                'first_name' : unicode,
                'last_name' : unicode,
                'creation' : datetime,
                'rate' : float,
                'phone_number' : int,
                'uuid' : unicode,
                'photo' : {
                        'path' : unicode,
                        'file' : unicode,
                        'width' : int,
                        'height' : int
                }
        }
        required_fields = ['first_name', 'last_name']
        default_values = {'creation' : datetime.utcnow()}
        use_dot_notation = True

connection.register([Babysitter])
Example #2
0
# toilet
# video


@connection.register
class Event(Document):
    __collection__ = "events"
    __database__ = "pouch"
    use_schemaless = True
    structure = {
        "reminders": [{"type": unicode, "timestamp": unicode, "description": unicode}],
        # 'moments' : [
        # {
        #     'type' : unicode,
        #     'time' : datetime,
        #     'description' : unicode
        # }
        # ],
        "started_babysitting_ts": datetime,
        "starting_ts": datetime,
        "ending_ts": datetime,
        "babysitter_uuid": unicode,
        "child_uuid": unicode,
        "event_uuid": unicode,
        "house_rules": [unicode],
    }
    use_dot_notation = True


connection.register([Event])
Example #3
0
from mongokit import Document
from pouch import connection
from datetime import datetime


@connection.register
class Child(Document):
    __collection__ = "children"
    __database__ = "pouch"
    structure = {
        "first_name": unicode,
        "last_name": unicode,
        "creation": datetime,
        "uuid": unicode,
        "gender": unicode,
        "emergency_contacts": [{"name": unicode, "number": int}],
        "age": int,
        "concerns": [unicode],
        "allergies": [unicode],
        "photo": {"url": unicode, "file": unicode, "width": int, "height": int},
    }
    required_fields = ["first_name", "last_name"]
    default_values = {"creation": datetime.utcnow()}
    use_dot_notation = True


connection.register([Child])