Ejemplo n.º 1
0
class AddAdminParse(BaseMarshmallow):
    username = fields.String(validate=[validate.str_range(6, 16)], required=True)
    password = fields.String(validate=[validate.str_range(8, 16)], required=True)
    password_ = fields.String(validate=[validate.str_range(8, 16)], required=True)
    nickname = fields.String(validate=[validate.str_range(0, 32)], missing="admin")
    remark = fields.String(validate=[validate.str_range(0, 255)])
    image_id = fields.Integer(validate=[validate.image_exist])
Ejemplo n.º 2
0
class UserRegisterParse(BaseMarshmallow):
    email = fields.Email(validate=[validate.str_range(0, 128)], required=True)
    password = fields.String(validate=[validate.str_range(8, 16)],
                             required=True)
    password_ = fields.String(validate=[validate.str_range(8, 16)],
                              required=True)
    code = fields.String(validate=[validate.str_range(6, 6)], required=True)
Ejemplo n.º 3
0
class AddDownloadParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(0, 128)], required=True)
    description = fields.String()
    version = fields.String(validate=[validate.str_range(0, 64)])
    language = fields.String(validate=[validate.str_range(0, 128)])
    file_id = fields.Integer(validate=[validate.data_exist(Upload)],
                             required=True)
    category_id = fields.Integer(
        validate=[validate.category_exist("download")], required=True)
    cover_id = fields.Integer(validate=[validate.image_exist], required=True)
Ejemplo n.º 4
0
class AddArticleParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(1, 255)], required=True)
    content = fields.String()
    recom = fields.Boolean(missing=False)
    top = fields.Boolean(missing=False)
    published = fields.Boolean(missing=True)
    publish_date = fields.DateTime('%Y-%m-%d %H:%M')
    description = fields.String()
    cover_id = fields.Integer(validate=[validate.image_exist], required=True)
    category_id = fields.Integer(validate=[validate.category_exist("article")],
                                 required=True)
    tag_id = fields.List(fields.Integer(validate=[validate.data_exist(Tag)]))
Ejemplo n.º 5
0
class AddAlbumParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(0, 128)], required=True)
    description = fields.String()
    category_id = fields.Integer(validate=[validate.category_exist("picture")],
                                 required=True)
    cover_id = fields.Integer(validate=[validate.image_exist], required=True)
Ejemplo n.º 6
0
class AddTagParse(BaseMarshmallow):
    name = fields.String(validate=[validate.str_range(0, 128)], required=True)
    sort = fields.Integer(validate=[validate.positive], missing=20)
Ejemplo n.º 7
0
class AdminLoginParse(BaseMarshmallow):
    username = fields.String(validate=[validate.str_range(6, 16)], required=True)
    password = fields.String(validate=[validate.str_range(8, 16)], required=True)
Ejemplo n.º 8
0
class UpdateAdminInfoParse(BaseMarshmallow):
    password = fields.String(validate=[validate.str_range(8, 16)])
    password_ = fields.String(validate=[validate.str_range(8, 16)])
    nickname = fields.String(validate=[validate.str_range(0, 32)], missing="admin")
    remark = fields.String(validate=[validate.str_range(0, 255)])
    image_id = fields.Integer(validate=[validate.image_exist])
Ejemplo n.º 9
0
class UserLoginParse(BaseMarshmallow):
    username = fields.Email(validate=[validate.str_range(0, 128)],
                            required=True)
    password = fields.String(validate=[validate.str_range(8, 16)],
                             required=True)
Ejemplo n.º 10
0
class UserModifyPasswordParse(BaseMarshmallow):
    password = fields.String(validate=[validate.str_range(8, 16)],
                             required=True)
    password_ = fields.String(validate=[validate.str_range(8, 16)],
                              required=True)
    code = fields.String(validate=[validate.str_range(6, 6)], required=True)
Ejemplo n.º 11
0
class UpdateUserInfoParse(BaseMarshmallow):
    nickname = fields.String(validate=[validate.str_range(0, 32)])
    description = fields.String(validate=[validate.str_range(0, 255)])
    gender = fields.Integer(validate=[validate.choice([0, 1, 2])], missing=0)
    image_id = fields.Integer(validate=[validate.image_exist])
Ejemplo n.º 12
0
class SendEmailCodeParse(BaseMarshmallow):
    email = fields.Email(validate=[validate.str_range(0, 128)], required=True)
Ejemplo n.º 13
0
class UpdateCategoryParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(1, 128)], required=True)
    sort = fields.Integer(missing=20)
    upper_id = fields.Integer(validate=[validate.category_exist(level=1)])
Ejemplo n.º 14
0
class AddCategoryParse(BaseMarshmallow):
    title = fields.String(validate=[validate.str_range(1, 128)], required=True)
    sort = fields.Integer(missing=20)
    module = fields.String(validate=[validate.choice(array=Category.MODULE_TYPE.keys())])
    upper_id = fields.Integer(validate=[validate.category_exist(level=1)])