from flask_login import UserMixin
from datetime import datetime
from . import db, login_manager
from . import config
from .utils import current_time
import base64


@login_manager.user_loader
def load_user(user_id):
    return User.objects(username=user_id).first()


class User(db.Document, UserMixin):
    username = db.StringField(required=True, unique=True)
    email = db.EmailField(required=True, unique=True)
    password = db.StringField(required=True)

    # Returns unique string identifying our object
    def get_id(self):
        return self.username


class Item(db.Document):
    item_id = db.StringField(required=True, min_length=1, max_length=9)
    title = db.StringField(required=True, min_length=1, max_length=100)
    price = db.StringField(required=True, min_length=1, max_length=9)
    description = db.StringField(required=True, min_length=5, max_length=5000)
    image = db.StringField(required=True, min_length=5, max_length=500)
    status = db.IntField(required=True)
    count = db.StringField(required=True, min_length=1, max_length=5)
    added_to_cart_by = db.ReferenceField(User, required=False)
    ordered_by = db.ReferenceField(User, required=False)


89229f8271d3a66fcc19f98e4892f49bd01c090c
<mask token>


class User(db.Document, UserMixin):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


class Item(db.Document):
    item_id = db.StringField(required=True, min_length=1, max_length=9)
    title = db.StringField(required=True, min_length=1, max_length=100)
    price = db.StringField(required=True, min_length=1, max_length=9)
    description = db.StringField(required=True, min_length=5, max_length=5000)
    image = db.StringField(required=True, min_length=5, max_length=500)
    status = db.IntField(required=True)
    count = db.StringField(required=True, min_length=1, max_length=5)
    added_to_cart_by = db.ReferenceField(User, required=False)
    ordered_by = db.ReferenceField(User, required=False)

<mask token>


class User(db.Document, UserMixin):
    username = db.StringField(required=True, unique=True)
    email = db.EmailField(required=True, unique=True)
    password = db.StringField(required=True)

    def get_id(self):
        return self.username


class Item(db.Document):
    item_id = db.StringField(required=True, min_length=1, max_length=9)
    title = db.StringField(required=True, min_length=1, max_length=100)
    price = db.StringField(required=True, min_length=1, max_length=9)
    description = db.StringField(required=True, min_length=5, max_length=5000)
    image = db.StringField(required=True, min_length=5, max_length=500)
    status = db.IntField(required=True)
    count = db.StringField(required=True, min_length=1, max_length=5)
    added_to_cart_by = db.ReferenceField(User, required=False)
    ordered_by = db.ReferenceField(User, required=False)

<mask token>


@login_manager.user_loader
def load_user(user_id):
    return User.objects(username=user_id).first()


class User(db.Document, UserMixin):
    username = db.StringField(required=True, unique=True)
    email = db.EmailField(required=True, unique=True)
    password = db.StringField(required=True)

    def get_id(self):
        return self.username


class Item(db.Document):
    item_id = db.StringField(required=True, min_length=1, max_length=9)
    title = db.StringField(required=True, min_length=1, max_length=100)
    price = db.StringField(required=True, min_length=1, max_length=9)
    description = db.StringField(required=True, min_length=5, max_length=5000)
    image = db.StringField(required=True, min_length=5, max_length=500)
    status = db.IntField(required=True)
    count = db.StringField(required=True, min_length=1, max_length=5)
    added_to_cart_by = db.ReferenceField(User, required=False)
    ordered_by = db.ReferenceField(User, required=False)

from flask_login import UserMixin
from datetime import datetime
from . import db, login_manager
from . import config
from .utils import current_time
import base64


@login_manager.user_loader
def load_user(user_id):
    return User.objects(username=user_id).first()


class User(db.Document, UserMixin):
    username = db.StringField(required=True, unique=True)
    email = db.EmailField(required=True, unique=True)
    password = db.StringField(required=True)

    def get_id(self):
        return self.username


class Item(db.Document):
    item_id = db.StringField(required=True, min_length=1, max_length=9)
    title = db.StringField(required=True, min_length=1, max_length=100)
    price = db.StringField(required=True, min_length=1, max_length=9)
    description = db.StringField(required=True, min_length=5, max_length=5000)
    image = db.StringField(required=True, min_length=5, max_length=500)
    status = db.IntField(required=True)
    count = db.StringField(required=True, min_length=1, max_length=5)
    added_to_cart_by = db.ReferenceField(User, required=False)
    ordered_by = db.ReferenceField(User, required=False)

from flask_login import UserMixin
from datetime import datetime
from . import db, login_manager
from . import config
from .utils import current_time
import base64


@login_manager.user_loader
def load_user(user_id):
    return User.objects(username=user_id).first()


class User(db.Document, UserMixin):
    username = db.StringField(required=True, unique=True)
    email = db.EmailField(required=True, unique=True)
    password = db.StringField(required=True)

    # Returns unique string identifying our object
    def get_id(self):
        return self.username


class Item(db.Document):
    item_id = db.StringField(required=True, min_length=1, max_length=9)
    title = db.StringField(required=True, min_length=1, max_length=100)
    price = db.StringField(required=True, min_length=1, max_length=9)
    description = db.StringField(required=True, min_length=5, max_length=5000)
    image = db.StringField(required=True, min_length=5, max_length=500)
    status = db.IntField(required=True)
    count = db.StringField(required=True, min_length=1, max_length=5)
    added_to_cart_by = db.ReferenceField(User, required=False)
    ordered_by = db.ReferenceField(User, required=False)

