class Order(BaseDocument): product_id = db.ObjectIdField(required=True) quantity = db.IntField(required=True) name = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) email = db.StringField(max_length=STRING_LENGTH['LONG']) phone = db.StringField(max_length=STRING_LENGTH['EX_SHORT'], required=True) description = db.StringField(max_length=STRING_LENGTH['EX_SHORT']) address = db.StringField(max_length=STRING_LENGTH['EX_LONG']) product_type = db.StringField(max_length=STRING_LENGTH['LONG']) status = db.IntField(required=True)
class User(Person, BaseDocument): password = db.StringField(required=True, max_length=STRING_LENGTH['EX_LONG']) role_id = db.ObjectIdField(required=True) def output(self, result=None, includes=None, excludes=None): if not excludes: excludes = ['password'] else: excludes.append('password') return super().output(result=result, includes=includes, excludes=excludes)
class WifiProduct(BaseDocument): country = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) internet_name = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) connection = db.IntField(default=1) speed_download = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) speed_upload = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) information = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) prepayment = db.IntField() price_day = db.IntField() image = db.ObjectIdField() continent = db.StringField(max_length=STRING_LENGTH['LONG'], required=True)
class Product(BaseDocument): name = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) price = db.IntField() category = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) image_id = db.ObjectIdField() country = db.StringField(max_length=STRING_LENGTH['LONG'], required=True)
class Post(BaseDocument): category_id = db.StringField(required=True, max_length=STRING_LENGTH['EX_SHORT']) name = db.StringField(required=True, max_length=STRING_LENGTH['LONG']) content = db.StringField(max_length=STRING_LENGTH['EX_LARGE']) images = db.ListField(db.ObjectIdField(), default=[]) banner = db.ObjectIdField()
class Banner(BaseDocument): name = db.StringField(required=True, max_length=STRING_LENGTH['LONG']) object_type = db.StringField(max_length=STRING_LENGTH['EX_SHORT']) images = db.ListField(db.ObjectIdField(), default=[])
class SimProduct(BaseDocument): owned = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) day_used = db.IntField(default=0) price = db.IntField(default=0) image = db.ObjectIdField() country = db.StringField(max_length=STRING_LENGTH['LONG'])
class Category(BaseDocument): name = db.StringField(max_length=STRING_LENGTH['LONG'], required=True) parent_id = db.ObjectIdField() images = db.ListField(db.ObjectIdField(), default=[]) country = db.StringField(max_length=STRING_LENGTH['LONG'], required=True)