Esempio n. 1
0
class Blocked(db.EmbeddedDocument):
    user_reference = db.StringField()
    user_email = db.EmailField()
    created_at = db.ComplexDateTimeField(default=datetime.datetime.now)
    last_updated_at = db.ComplexDateTimeField(default=datetime.datetime.now)
    is_active = db.BooleanField(default=True)
    version = db.IntField(default=0)
class SessionHistory(me.Document):
    created_at = me.ComplexDateTimeField(default=datetime.datetime.now)
    user_details = me.ReferenceField(User, dbref=True)
    access_token = me.StringField()
    access_token_jti = me.StringField()
    revoked_at = me.ComplexDateTimeField(default=datetime.datetime.now)
    is_revoked = me.BooleanField(default=False)

    meta = {
        'db_alias': 'bms_ent',
        'collection': 'SessionHistory'
    }
Esempio n. 3
0
class Execution(mongoengine.Document):
    """
    *Concrete* class representing a particular call to an executable.
    """
    arguments = mongoengine.StringField()
    start_time = mongoengine.ComplexDateTimeField()
    end_time = mongoengine.ComplexDateTimeField()
    objects = mongoengine.ListField(mongoengine.ReferenceField('Memory'))

    @staticmethod
    def set_execution(execution):
        Execution._current = execution

    @classmethod
    def current(cls):
        return cls._current
Esempio n. 4
0
class Book(mon.Document):
    name = mon.StringField(required=True, max_length=255)
    summary = mon.StringField()
    author = mon.StringField(required=True)
    genre = mon.StringField(required=True)
    barcode = mon.StringField(max_length=20)
    created_at = mon.ComplexDateTimeField(default=datetime.datetime.now)
    created_by = mon.StringField(required=True)
    last_updated_at = mon.ComplexDateTimeField(default=datetime.datetime.now)
    last_updated_by = mon.StringField(required=False)
    is_active = mon.BooleanField(default=True)
    privacy_scope = mon.StringField(required=True, default="PUBLIC")
    book_cover_url = mon.URLField()
    document_name = mon.StringField()
    repo_key = mon.StringField()
    entity_tag = mon.StringField()

    meta = {'db_alias': 'bms_ent', 'collection': 'books'}
Esempio n. 5
0
class User(meng.Document):
    created_at = meng.ComplexDateTimeField(default=datetime.datetime.now)
    first_name = meng.StringField(required=True, min_length=1, max_length=50)
    last_name = meng.StringField(required=False, max_length=50, default="")
    date_of_birth = meng.DateTimeField(required=True)
    phone_number = meng.LongField(required=True)
    email = meng.EmailField(required=True, unique=True)
    username = meng.StringField(required=True, unique=True)
    alt_username = meng.StringField(required=False)
    password = meng.StringField(required=True)
    last_updated_at = meng.ComplexDateTimeField(default=datetime.datetime.now)
    is_admin = meng.BooleanField(default=False)
    is_active = meng.BooleanField(default=True)
    last_updated_by = meng.ReferenceField('self')
    marked_active_inactive_by_admin = meng.BooleanField(default=False)
    fav_books = meng.ListField(meng.ReferenceField(Book))
    all_followers = meng.EmbeddedDocumentListField(Followers, default=[])
    all_following = meng.EmbeddedDocumentListField(Following, default=[])
    blocked_users = meng.EmbeddedDocumentListField(Blocked, default=[])
    profile_picture = meng.URLField()

    meta = {'db_alias': 'bms_ent', 'collection': 'user'}
Esempio n. 6
0
    class Segment(me.Document):
        segment_id = me.IntField(unique=True)
        label = me.StringField()
        length = me.FloatField()
        segment = me.LineStringField()  # GeoJSON LineString.
        midpoint = me.PointField()  # GeoJSON PointField.
        vehicles = me.ListField(me.ReferenceField('VehicleSegmentData'))
        running_average_speed = me.FloatField()
        running_average_travel_time = me.FloatField()
        last_updated = me.ComplexDateTimeField()

        meta = {
            'collection': config['MONGODB_SEGMENT_COLLECTION'],
            'indexes': ['segment_id', 'last_updated']
        }
    class VehicleSegmentData(me.Document):
        # vehicle data is tied to segment
        vehicle_id = me.IntField(null=True)
        vehicle_datetime = me.ComplexDateTimeField()
        vehicle_location = me.PointField()
        vehicle_segment_speed = me.FloatField()
        vehicle_segment_travel_time = me.FloatField()

        segment = me.ReferenceField('Segment')
        meta = {
            'collection':
            config['MONGODB_VEHICLE_COLLECTION'],
            'indexes': [
                'vehicle_datetime', {
                    "fields": ['vehicle_id'],
                    "unique": True,
                    "partialFilterExpression": {
                        "vehicle_id": {
                            "$type": "int"
                        }
                    }
                }
            ]
        }
Esempio n. 8
0
class Stats(mongoengine.EmbeddedDocument):
    start_date = mongoengine.ComplexDateTimeField(default=now)
    end_date = mongoengine.ComplexDateTimeField()
    number_of_results = mongoengine.IntField(default=0)
Esempio n. 9
0
class Page(me.DynamicDocument):
    title = me.StringField(max_length=200, required=True)
    date = me.ComplexDateTimeField(default=datetime.now)
    meta = {'collection': 'test'}
import mongoengine

class WeatherEvents(mongoengine.Document);

temperaturamax= mongoengine.FloatField()
temperaturamin = mongoengine.FloatField()
preciptacao = mongoengine.FloatField()
local = mongoengine.StringField()
risco = mongoengine.FloatField()
previsao = mongoengine.FloatField()
insolacao = mongoengine.FloatField(),
evaporacao_piche = mongoengine.FloatField(),
temperaturamedia = mongoengine.FloatField(),
umidaderelativa = mongoengine.FloatField(),
velocidadeVento = mongoengine.FloatField(),
timer = mongoengine.ComplexDateTimeField(),
bairro= mongoengine.StringField(),
cidade= mongoengine.StringField(),