示例#1
0
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)
示例#2
0
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)
示例#3
0
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)
示例#4
0
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)
示例#5
0
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()
示例#6
0
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=[])
示例#7
0
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'])
示例#8
0
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)