'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()), } class User(ndb.Model): """Represents a user.""" _query_properties = { 'first_name': RestQueryRule('fn_', lambda x: x.lower() if x else ''), 'email': RestQueryRule('email', lambda x: x if x else ''), 'phone': RestQueryRule('phone', lambda x: x if x else ''), } # Store the schema version, to aid in migrations. version_ = ndb.IntegerProperty('v_', default=1)
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)
'type': voluptuous.any('p', 'o', 'd'), 'notes': basestring, 'methods': [{ 'type': voluptuous.any('e', 't', 'p'), 'value': basestring }] }] } student_query_schema = { 'flike_first_name': basestring, 'feq_groups': voluptuous.any('', voluptuous.ndbkey()), 'feq_school': voluptuous.ndbkey(), 'feq_is_direct': voluptuous.boolean() } class Student(EntityBase): """Represents a student.""" _query_properties = { 'last_name': RestQueryRule('last_name_', lambda x: x.lower() if x else ''), 'groups': RestQueryRule('groups', lambda x: None if x == '' else x) } # Store the schema version, to aid in migrations. version_ = ndb.IntegerProperty('v_', default=1)
# '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, 'feq_groups': voluptuous.any('', voluptuous.ndbkey()), 'feq_school': voluptuous.ndbkey(), 'feq_is_direct': voluptuous.boolean() } class Student(EntityBase): """Represents a student.""" _query_properties = { 'last_name': RestQueryRule('last_name_', lambda x: x.lower() if x else ''), 'groups': RestQueryRule('groups', lambda x: None if x == '' else x) } # Store the schema version, to aid in migrations. version_ = ndb.IntegerProperty('v_', default=1) first_name = ndb.StringProperty('fn')
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 } class ContactMarker(EntityBase):
'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()), } class User(ndb.Model): """Represents a user.""" _query_properties = { 'first_name': RestQueryRule('fn_', lambda x: x.lower() if x else ''), 'email': RestQueryRule('email', lambda x: x if x else ''), 'phone': RestQueryRule('phone', lambda x: x if x else ''), } # Store the schema version, to aid in migrations. version_ = ndb.IntegerProperty('v_', default=1)
from google.appengine.ext import ndb import voluptuous from skel.datastore import EntityBase from skel.rest_api.rules import RestQueryRule from sosbeacon.event.event import Event from sosbeacon.utils import get_latest_datetime marker_schema = { 'key': voluptuous.any(None, voluptuous.ndbkey(), ''), 'acknowledged': voluptuous.boolean(), 'first_name': basestring, 'last_name': basestring, 'responded': [basestring], 'is_direct': voluptuous.boolean(), } marker_query_schema = { 'feq_acknowledged': voluptuous.boolean(), 'feq_event': voluptuous.ndbkey(), 'fan_key': voluptuous.ndbkey(), 'first_name': basestring, 'first_name': basestring, 'feq_is_direct': voluptuous.boolean(), }