Beispiel #1
0
from google.appengine.ext import ndb
from skel.datastore import EntityBase

import voluptuous
import logging

from datetime import datetime

log_schema = {
    'key': voluptuous.any(None, voluptuous.ndbkey(), ''),
    'froms': basestring,
    'tos': basestring,
    'added': voluptuous.any(None, datetime, ''),
    'type': basestring,
    'message': basestring
}

log_query_schema = {
    'flike_froms': basestring,
    'flike_tos': basestring,
    'feq_type': basestring
}

class Log(EntityBase):
    #date occurs log
    added = ndb.DateTimeProperty('d', auto_now_add=True)
    #from email or phone
    froms = ndb.StringProperty('fr')
    #to email or phone
    tos = ndb.StringProperty('to')
    #message to be logged
Beispiel #2
0
from google.appengine.ext import ndb

import voluptuous
import os
import uuid

from skel.rest_api.rules import RestQueryRule
from webapp2_extras import security

from .school import School

user_schema = {
    'key': voluptuous.any(None, voluptuous.ndbkey(), ''),
    'first_name': basestring,
    'last_name': basestring,
    # 'default_school': voluptuous.ndbkey(),
    'schools': [voluptuous.ndbkey()],
    # 'contacts': [{'type': basestring, 'value': basestring}],
    'email': basestring,
    'phone': basestring,
    'password': basestring
}

user_query_schema = {
    'flike_first_name': basestring,
    'flike_phone': basestring,
    'flike_email': basestring,
    'feq_is_admin': voluptuous.boolean(),
    'feq_schools': voluptuous.any('', voluptuous.ndbkey()),
}
Beispiel #3
0
from google.appengine.ext import ndb

import voluptuous

from skel.datastore import EntityBase
from skel.rest_api.rules import RestQueryRule

ADMIN_GROUPS_ID = "admin__"
STAFF_GROUPS_ID = "staff__"

group_schema = {
    "key": voluptuous.any(None, voluptuous.ndbkey(), ""),
    "name": basestring,
    "notes": basestring,
    "default": voluptuous.boolean(),
}

group_query_schema = {"flike_name": basestring, "feq_default": voluptuous.boolean(), "feq_school": voluptuous.ndbkey()}


class Group(EntityBase):
    """Represents a group."""

    _query_properties = {"name": RestQueryRule("name_", lambda x: x.lower() if x else "")}

    # Store the schema version, to aid in migrations.
    version_ = ndb.IntegerProperty("v_", default=1)

    # Useful timestamps.
    added = ndb.DateTimeProperty("a_", auto_now_add=True)
    modified = ndb.DateTimeProperty("m_", auto_now=True)
from google.appengine.ext import ndb
from skel.datastore import EntityBase

import voluptuous
import logging

from datetime import datetime

log_schema = {
    'key': voluptuous.any(None, voluptuous.ndbkey(), ''),
    'date': voluptuous.any(None, datetime, ''),
    'message': basestring,
    'event' : basestring
}

log_query_schema = {
    'feq_type': basestring
}

class ErrorLog(EntityBase):
    #date occurs log
    added = ndb.DateTimeProperty('d', auto_now_add=True)
    #error to be logged
    message = ndb.StringProperty('ms')

    event = ndb.StringProperty()

    @classmethod
    def from_dict(cls, data):
        key = data.get("key")
        error_log = None
Beispiel #5
0
from google.appengine.ext import ndb

import voluptuous

from skel.datastore import EntityBase
from skel.rest_api.rules import RestQueryRule

from sosbeacon.error_log import create_error_log
from sosbeacon.group import Group

DEFAULT_STUDENT_ID = "student__"
EMAIL_REGEX = re.compile("^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$")

student_schema = {
    'key':
    voluptuous.any(None, voluptuous.ndbkey(), ''),
    'first_name':
    basestring,
    'last_name':
    basestring,
    #    'identifier': basestring,
    'groups': [voluptuous.ndbkey()],
    'contacts': [{
        'name':
        basestring,
        'type':
        voluptuous.any('p', 'o', 'd'),
        'notes':
        basestring,
        'methods': [{
            'type': voluptuous.any('e', 't', 'p'),
Beispiel #6
0
GROUPS_TX_ENDPOINT = "/task/event/tx/start"
GROUP_TX_ENDPOINT = "/task/event/tx/group"
GROUP_TX_QUEUE = "group-tx"

STUDENT_TX_ENDPOINT = "/task/event/tx/student"
STUDENT_TX_QUEUE = "student-tx"

CONTACT_TX_ENDPOINT = "/task/event/tx/contact"
CONTACT_TX_QUEUE = "contact-tx"

METHOD_TX_ENDPOINT = "/task/event/tx/method"
METHOD_TX_QUEUE = "method-tx"

message_schema = {
    "key": voluptuous.any(None, voluptuous.ndbkey(), ""),
    "event": voluptuous.ndbkey(),
    "user": voluptuous.any(None, voluptuous.ndbkey(), ""),
    "user_name": basestring,
    "timestamp": voluptuous.any(None, datetime, ""),
    "type": basestring,
    "message": {"message": basestring, "sms": basestring, "title": basestring, "email": basestring},
}

message_query_schema = {
    "feq_event": voluptuous.ndbkey(),
    "feq_user": voluptuous.any(None, voluptuous.ndbkey(), ""),
    "feq_message_type": basestring,
}

import os
import sys
import voluptuous

from skel.rest_api.rules import RestQueryRule
from skel.datastore import EntityBase

from google.appengine.ext import ndb

reply_message_schema = {
    'key': voluptuous.any(None, voluptuous.ndbkey(), ''),
    'message': voluptuous.ndbkey(),
    'content': basestring,
}

reply_message_query_schema = {
    'feq_message': voluptuous.ndbkey(),
}


class ReplyMessage(EntityBase):
    """Reply a Message."""

    _query_properties = {
        'name': RestQueryRule('n_', lambda x: x.lower() if x else ''),
    }

    # Store the schema version, to aid in migrations.
    version_ = ndb.IntegerProperty('v_', default=1)
    content = ndb.StringProperty('ct')
Beispiel #8
0
from google.appengine.ext import ndb

import voluptuous

from skel.datastore import EntityBase
from skel.rest_api.rules import RestQueryRule

from sosbeacon.error_log import create_error_log
from sosbeacon.group import Group

DEFAULT_STUDENT_ID = "student__"
EMAIL_REGEX = re.compile("^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$")

student_schema = {
    'key': voluptuous.any(None, voluptuous.ndbkey(), ''),
    'first_name': basestring,
    'last_name': basestring,
#    'identifier': basestring,
    'groups': [voluptuous.ndbkey()],
    'contacts': [{
        'name': basestring,
        'type': voluptuous.any('p', 'o', 'd'),
        'notes': basestring,
        'methods': [{'type': voluptuous.any('e', 't', 'p'),
                     'value': basestring}]
    }]
}

student_query_schema = {
    'flike_first_name': basestring,
from skel.datastore import EntityBase
from skel.rest_api.rules import RestQueryRule

from sosbeacon.event.event import Event


CONTACT_MERGE_ENDPOINT = '/task/event/update/contact_marker'
CONTACT_MERGE_QUEUE = "contact-marker-update"

MARKER_MERGE_ENDPOINT = '/task/event/merge/contact_marker'
MARKER_MERGE_QUEUE = "contact-marker-merge"


marker_schema = {
    'key': voluptuous.any(None, voluptuous.ndbkey(), ''),
    'acknowledged': voluptuous.boolean(),
    'first_name': basestring,
    'last_name': basestring,
    'responded': [basestring],
}

marker_query_schema = {
    'feq_acknowledged': voluptuous.boolean(),
    'feq_event': voluptuous.ndbkey(),
    'fan_key': voluptuous.ndbkey(),
    'first_name': basestring,
    'last_name': basestring
}

Beispiel #10
0
GROUPS_TX_ENDPOINT = '/task/event/tx/start'
GROUP_TX_ENDPOINT = '/task/event/tx/group'
GROUP_TX_QUEUE = "group-tx"

STUDENT_TX_ENDPOINT = '/task/event/tx/student'
STUDENT_TX_QUEUE = "student-tx"

CONTACT_TX_ENDPOINT = '/task/event/tx/contact'
CONTACT_TX_QUEUE = "contact-tx"

METHOD_TX_ENDPOINT = '/task/event/tx/method'
METHOD_TX_QUEUE = "method-tx"

message_schema = {
    'key': voluptuous.any(None, voluptuous.ndbkey(), ''),
    'event': voluptuous.ndbkey(),
    'user': voluptuous.any(None, voluptuous.ndbkey(), ''),
    'user_name': basestring,
    'timestamp': voluptuous.any(None, datetime, ''),
    'type': basestring,
    'message': {
        'message': basestring,
        'sms': basestring,
        'title': basestring,
        'email': basestring
    }
}

message_query_schema = {
    'feq_event': voluptuous.ndbkey(),
Beispiel #11
0
from google.appengine.ext import ndb
from skel.datastore import EntityBase

import voluptuous
import logging

from datetime import datetime

log_schema = {
    "key": voluptuous.any(None, voluptuous.ndbkey(), ""),
    "froms": basestring,
    "tos": basestring,
    "added": voluptuous.any(None, datetime, ""),
    "type": basestring,
    "message": basestring,
}

log_query_schema = {"flike_froms": basestring, "flike_tos": basestring, "feq_type": basestring}


class Log(EntityBase):
    # date occurs log
    added = ndb.DateTimeProperty("d", auto_now_add=True)
    # from email or phone
    froms = ndb.StringProperty("fr")
    # to email or phone
    tos = ndb.StringProperty("to")
    # message to be logged
    message = ndb.StringProperty(indexed=False)

    type = ndb.StringProperty("tp")
import os
import sys
import voluptuous

from skel.rest_api.rules import RestQueryRule
from skel.datastore import EntityBase

from google.appengine.ext import ndb

reply_message_schema = {
    'key': voluptuous.any(None, voluptuous.ndbkey(), ''),
    'message': voluptuous.ndbkey(),
    'content': basestring,
}

reply_message_query_schema = {
    'feq_message' : voluptuous.ndbkey(),
}

class ReplyMessage(EntityBase):
    """Reply a Message."""

    _query_properties = {
        'name': RestQueryRule('n_', lambda x: x.lower() if x else ''),
    }

    # Store the schema version, to aid in migrations.
    version_ = ndb.IntegerProperty('v_', default=1)
    content = ndb.StringProperty('ct')

    message = ndb.KeyProperty('m')