예제 #1
0
class Emails(MongoModel):
    userEmail = fields.EmailField()
    msgid = fields.IntegerField()
    efrom = fields.EmailField()
    eto = fields.EmailField(blank=True)
    subject = fields.CharField(
        max_length=100, blank=True
    )  # max_length=100 to store just the beginning of the subject
    internaldate = fields.DateTimeField()
    content = fields.CharField()
    charset = fields.CharField()
    flags = fields.CharField()
class User(MongoModel):
    email = fields.EmailField(
        primary_key=True
    )  # because primary_key is True, we will need to query this field using the label _id
    age = fields.IntegerField()
    heart_rate = fields.ListField(field=fields.IntegerField())
    heart_rate_times = fields.ListField(field=fields.DateTimeField())
예제 #3
0
class User(MongoModel):
    email = fields.EmailField(primary_key=True, required=True)
    handle = fields.CharField(required=True)
    password = fields.CharField(required=True)

    class Meta:
        collection_name = "users"
예제 #4
0
class User(MongoModel):
    id = fields.CharField(primary_key=True)
    uuid = fields.CharField()
    email = fields.EmailField()
    name = fields.CharField()
    surname = fields.CharField()
    authmethod = fields.CharField()
    password = fields.CharField(required=True)
    mfa_hash = fields.CharField()
    first_login = fields.DateTimeField(blank=True)
    last_login = fields.DateTimeField(blank=True)
    last_password_change = fields.DateTimeField(blank=True)
    is_active = fields.BooleanField(default=True)
    privacy_accepted = fields.BooleanField(default=True)
    expiration = fields.DateTimeField(blank=True)

    roles = fields.EmbeddedDocumentListField(Role, blank=True)
    belongs_to = fields.EmbeddedDocumentField("Group", blank=True)

    class Meta:
        # write_concern = WriteConcern(j=True)
        connection_alias = AUTH_DB

        indexes = [
            IndexModel("uuid", unique=True),
            IndexModel("email", unique=True)
        ]
예제 #5
0
class test_User(MongoModel):
    patient_id = fields.IntegerField(primary_key=True)
    attending_email = fields.EmailField()
    user_age = fields.FloatField()
    time_stamp = fields.DateTimeField()
    heart_rate = fields.ListField(field=fields.IntegerField())
    time_stamp = fields.ListField(field=fields.DateTimeField())
예제 #6
0
class UserDetails(MongoModel):
    '''Model to maintain user details.

    Attributes:
        createdOn: Datetime object
        updatedOn: Datetime object
    '''

    createdOn = fields.DateTimeField(required=True, default=lambda: datetime.now())
    updatedOn = fields.DateTimeField(required=True, default=lambda: datetime.now())
    email = fields.EmailField(required=True, primary_key=False)
    pincode = fields.CharField(required=False, blank=True)
    district = fields.CharField(required=False, blank=True)
    active = fields.BooleanField(required=True, default=False)
    alertCount = fields.IntegerField(required=True, default=0)
    age = fields.IntegerField(required=True)
    objects = UserDetailsManager()

    class Meta:
        collection_name = 'UserDetails'
        indexes = [
            IndexModel(
                [
                    ('pincode', DESCENDING),
                    ('district', DESCENDING)
                ],
                background=True
            )
        ]
        final = True
예제 #7
0
class User(MongoModel):
    # Make all these fields required, so that if we try to save a User instance
    # that lacks one of these fields, we'll get a ValidationError, which we can
    # catch and render as an error on a form.
    #
    # Use the email as the "primary key" (will be stored as `_id` in MongoDB).
    email = fields.EmailField(primary_key=True, required=True)
    user_type = fields.CharField(required=True)
    image_url = fields.CharField(blank=True)
    # `password` here will be stored in plain text! We do this for simplicity of
    # the example, but this is not a good idea in general. A real authentication
    # system should only store hashed passwords, and queries for a matching
    # user/password will need to hash the password portion before of the query.
    password = fields.CharField(required=True)
    user_promos = fields.EmbeddedDocumentListField(UserPromo)

    def hash_password(self, password_input):
        salt = uuid.uuid4().hex
        self.password = hashlib.sha256(
            salt.encode() + password_input.encode()).hexdigest() + ':' + salt

    def verify_password(self, hashed_password, user_password):
        password, salt = hashed_password.split(':')
        return password == hashlib.sha256(salt.encode() +
                                          user_password.encode()).hexdigest()
예제 #8
0
파일: app.py 프로젝트: kendny/study_docker
class User(MongoModel):
    email = fields.EmailField(primary_key=True)
    first_name = fields.CharField()
    last_name = fields.CharField()

    class Meta:
        write_concern = WriteConcern(j=True)
        connection_alias = 'my-app'
예제 #9
0
class ImageDB(MongoModel):
    user_email = fields.EmailField(primary_key=True)
    uploaded_images = fields.ListField(field=fields.DictField())
    image_formats = fields.ListField(field=fields.DictField())
    upload_times = fields.ListField(field=fields.DateTimeField())
    image_size = fields.ListField(field=fields.DictField())
    processed_info = fields.ListField(field=fields.DictField())
    user_metrics = fields.DictField()
예제 #10
0
class Admin(MongoModel):
    userId = fields.CharField(primary_key=True)
    status = fields.CharField()
    password = fields.CharField()
    otp = fields.CharField()
    emailId = fields.EmailField()
    firstName = fields.CharField()
    lastName = fields.CharField()
예제 #11
0
class Imageset(MongoModel):
    """
    Data Class used by MongoDB
    """
    user_email = fields.EmailField(primary_key=True)
    image_data = fields.CharField()
    actions = fields.ListField()
    timestamps = fields.ListField()
예제 #12
0
class Patient(MongoModel):
    patient_id = fields.IntegerField(primary_key=True)
    attending_email = fields.EmailField()
    age = fields.IntegerField()
    new_heart_rate = fields.IntegerField()
    new_timestamp = fields.DateTimeField()
    heart_rates = fields.ListField()
    timestamps = fields.ListField()
예제 #13
0
class User(MongoModel):
    """
    Model for user recording
    """
    email = fields.EmailField(primary_key=True)
    age = fields.IntegerField()
    heart_rate = fields.ListField(field=fields.IntegerField())
    heart_rate_times = fields.ListField(field=fields.DateTimeField())
예제 #14
0
class User(MongoModel, UserMixin):
    email = fields.EmailField(primary_key=True, required=True)
    username = fields.CharField(required=True)
    password = fields.CharField(required=True)
    image_file = fields.CharField(required=True, default='default.jpg')

    def __repr__(self):
        return f"User('{self.username}', '{self.email}', '{self.image_file}')"
예제 #15
0
class GoogleFieldsModel(EmbeddedMongoModel):
    name = fields.CharField()
    given_name = fields.CharField()
    family_name = fields.CharField()
    picture = fields.URLField()
    email = fields.EmailField()
    email_verified = fields.BooleanField()
    token = fields.CharField()
예제 #16
0
class Customer(MongoModel):
    """Setup up table model using pymodm"""
    user_id = fields.CharField(primary_key=True)  # comment out for testing import
    first_name = fields.CharField()
    last_name = fields.CharField()
    address = fields.CharField()
    phone_number = fields.CharField()
    email = fields.EmailField()
class User(MongoModel):
    email = fields.EmailField()
    username = fields.CharField()
    password_hash = fields.CharField()
    balance = fields.FloatField()

    class Meta:
        connection_alias = 'bank-app'
예제 #18
0
class User(MongoModel):
    email = fields.EmailField()
    first_name = fields.CharField()
    last_name = fields.CharField()
    password = fields.CharField()

    class Meta:
        indexes = [IndexModel([('email', TEXT)], unique=True)]
class Patient(MongoModel):

    patient_id = fields.IntegerField(primary_key=True)
    attending_email = fields.EmailField()
    user_age = fields.IntegerField()
    heart_rate_data = fields.ListField()

    REQUIRED_REQUEST_KEYS = ["user_id", "attending_email", "user_age"]
예제 #20
0
class User(MongoModel):
    email = fields.EmailField(required=False, mongo_name='email')
    name = fields.CharField(required=False, mongo_name='name')
    mobile_no = fields.CharField(min_length=10,
                                 max_length=10,
                                 required=False,
                                 mongo_name='mobile_no')
    role = fields.CharField(choices=('mentor', 'student', 'admin'),
                            required=False,
                            mongo_name='role')
    photo_url = fields.CharField(mongo_name='photo_url', default=None)
    uploaded_photo_url = fields.CharField(mongo_name='uploaded_photo_url',
                                          default=None)
    user_token = fields.CharField(mongo_name='user_token')
    user_group = fields.CharField(mongo_name='user_group', default=None)
    nickname = fields.CharField(mongo_name='nickname')
    preferences = fields.ListField(mongo_name='preferences')
    created_at = fields.DateTimeField(mongo_name='created_at')
    updated_at = fields.DateTimeField(mongo_name='updated_at')
    linkedin = fields.CharField(mongo_name='linkedin')
    certificates = fields.CharField(mongo_name='certificates')
    courses = fields.CharField(mongo_name='courses')
    background = fields.CharField(mongo_name='background')
    mentor_verified = fields.BooleanField(mongo_name='mentor_verified',
                                          default=False)
    hours_per_day = fields.CharField(mongo_name='hours_per_day')
    login_status = fields.BooleanField(mongo_name='login_status', default=True)
    sessions = fields.BigIntegerField(mongo_name='sessions', default=0)

    class Meta:
        write_concern = WriteConcern(j=True)
        ignore_unknown_fields = True
        connection_alias = 'onx-app'
        final = True

    def clean(self):
        if self.email != None:
            self.check_duplicate_user()
        self.validate_user_group()

    def check_duplicate_user(self):
        try:
            User.objects.get({'email': self.email})
            raise ValidationError('User with this email already exist')
        except User.DoesNotExist:
            pass

    def validate_user_group(self):
        try:
            if self.user_group != None:
                group = CorporateGroup.objects.get({'code': self.user_group})
                self.user_group = str(group._id)
            else:
                pass
        except Exception as e:
            message = "Invalid corporate code." if str(e) == "" else str(e)
            raise ValidationError(message)
class Config(EmbeddedMongoModel):
    # This will be a percentage of tank volume 1/4 (.25)
    low_level = fields.FloatField()
    alert_phone = fields.CharField()
    alert_email = fields.EmailField()
    provider_state = fields.CharField()
    provider_name = fields.CharField()
    provider_phone = fields.CharField()
    provider_emg_phone = fields.CharField()
예제 #22
0
class User(MongoModel):
    email = fields.EmailField(primary_key=True)
    upload_times = fields.ListField(field=fields.DateTimeField())
    # stores the time stamps for different images
    image_names = fields.ListField(field=fields.CharField())
    # stores the names (file names) for different images
    user_action = fields.DictField()
    # stores the amount of times the different user actions have
    # been run (all filtering options)
    latency = fields.ListField(field=fields.IntegerField())
예제 #23
0
class User(MongoModel):
    '''
    if offer_type == rewardpoint:
        offer_data = {"reward_name":"spend 100 and get coke free","reward_points":100,"reward_Info":"coke"}
    '''
    agentId    = fields.ObjectIdField(required=True)
    email      = fields.EmailField(required=True)
    password   = fields.CharField(required=True)
    created_at = fields.DateTimeField(required=True)
    updated_at = fields.DateTimeField(required=True)
예제 #24
0
class Patient(MongoModel):
    """
    Create MONGODB: ID, email, age, is tachycardic?, heart rate, and time.
    """
    patient_id = fields.CharField(primary_key=True)
    attending_email = fields.EmailField()
    user_age = fields.FloatField()
    is_tachycardic = fields.ListField(field=fields.BooleanField())
    heart_rate = fields.ListField(field=fields.IntegerField())
    heart_rate_time = fields.ListField(field=fields.DateTimeField())
예제 #25
0
class User(MongoModel):
    email = fields.EmailField(required=True)
    password_hash = fields.CharField(required=True)
    validation_token = fields.CharField(blank=True)
    submissions = fields.EmbeddedDocumentListField(Submission,
                                                   blank=True,
                                                   default=[])

    class Meta:
        connection_alias = 'ece250ts'
예제 #26
0
class Comment(EmbeddedMongoModel):
    # For comments, we just want an email. We don't require signup like we do
    # for a Post, which has an 'author' field that is a ReferenceField to User.
    # Again, we make all fields required so that we get a ValidationError if we
    # try to save a Comment instance that lacks one of these fields. We can
    # catch this error and render it in a form, telling the user that one or
    # more fields still need to be filled.
    author = fields.EmailField(required=True)
    date = fields.DateTimeField(required=True)
    body = fields.CharField(required=True)
예제 #27
0
class User(MongoModel):
    # bc primary_key is True, need to query this field using label _id
    email = fields.EmailField(primary_key=True)
    orig_img_paths = fields.ListField(field=fields.CharField())
    command = fields.ListField(field=fields.IntegerField())
    orig_timestamp = fields.ListField(field=fields.DateTimeField())
    proc_img_paths = fields.ListField(field=fields.ListField(
        field=fields.CharField()))
    proc_time = fields.ListField(field=fields.FloatField())
    proc_status = fields.ListField(field=fields.BooleanField())
class Patient(MongoModel):
    """
    Data Class used by MongoDB
    """
    patient_id = fields.IntegerField(primary_key=True)
    attending_email = fields.EmailField()
    user_age = fields.IntegerField()
    last_heart_rate = fields.IntegerField()
    last_timestamp = fields.DateTimeField()
    heart_rates = fields.ListField()
    timestamps = fields.ListField()
예제 #29
0
class GuestAccount(BasePyModelModel):
    _COLLECTION_NAME = "guest_accounts"

    class Meta:
        final = True
        collection_name = "guest_accounts"

    id = fields.BigIntegerField(primary_key=True)
    first_name = fields.CharField(required=True)
    last_name = fields.CharField(required=True)
    email = fields.EmailField(required=True)
class User(MongoModel):
    """ class creates user for Mongo Database

    :param email: email of user
    :param age: age of user
    :param heart_rate: heart rate of user
    :heart rate times: prints time of entry
    """
    email = fields.EmailField(primary_key=True)
    age = fields.IntegerField()
    heart_rate = fields.ListField(field=fields.IntegerField())
    heart_rate_times = fields.ListField()