コード例 #1
0
ファイル: schema.py プロジェクト: sreyemnayr/commandment
class AvailableOSUpdateSchema(Schema):
    class Meta:
        type_ = 'available_os_updates'
        self_view = 'api_app.available_os_update_detail'
        self_view_kwargs = {'available_os_update_id': '<id>'}
        self_view_many = 'api_app.available_os_updates_list'

    id = fields.Int(dump_only=True)
    allows_install_later = fields.Boolean()
    #  app_identifiers_to_close = fields.List(fields.String())
    human_readable_name = fields.Str()
    human_readable_name_locale = fields.Str()
    is_config_data_update = fields.Boolean()
    is_critical = fields.Boolean()
    is_firmware_update = fields.Boolean()
    metadata_url = fields.URL()
    product_key = fields.String()
    restart_required = fields.Boolean()
    version = fields.String()

    device = Relationship(
        related_view='api_app.device_detail',
        related_view_kwargs={'device_id': '<device_id>'},
        type_='devices',
    )
コード例 #2
0
class ItemSchema(Schema):

    id = fields.String(dump_only=True)
    name = fields.String(required=True,
                         validator=ma.validate.Length(min=3, max=20))
    description = fields.String()
    tags = fields.List(fields.String())
    upc = fields.String()
    color = fields.String()
    size = fields.String()
    weight = fields.String()
    dimension = fields.String()
    category = fields.String()
    image = fields.URL()

    manufactory = fields.String()
    meta = fields.Dict()

    status = fields.String(requred=True, default='deactive')

    created_date = fields.DateTime(dump_only=True)
    updated_date = fields.DateTime(dump_only=True)

    class Meta:
        type_ = 'items'
        strict = True
        inflect = common.dasherize
コード例 #3
0
class VideoStreamExtraOptionsSchema(JsonSchema):
    record = fields.Boolean(default=True)
    autoStartRecording = fields.Boolean(default=False)
    muteOnStart = fields.Boolean(default=True)
    welcome = fields.String(required=False, allow_none=True)
    maxParticipants = fields.Integer(required=False, allow_none=True)
    duration = fields.Integer(required=False, allow_none=True)
    moderatorOnlyMessage = fields.String(required=False, allow_none=True)
    logo = fields.URL(required=False, allow_none=True)
    bannerText = fields.String(required=False, allow_none=True)
    bannerColor = fields.String(required=False, allow_none=True)
    guestPolicy = fields.String(required=False, allow_none=True)
    allowModsToUnmuteUsers = fields.Boolean(default=True)
    endCurrentMeeting = fields.Boolean(default=False)
コード例 #4
0
class ApplicationSchema(Schema):

    id = fields.String()
    name = fields.String(required=True,
                         validator=ma.validate.Length(min=3, max=20))
    description = fields.String()
    detail = fields.String()

    publicurl = fields.URL(required=True)
    status = fields.String(requred=True, default='deactivate')

    created_date = fields.DateTime(dump_only=True)
    updated_date = fields.DateTime(dump_only=True)

    class Meta:
        type_ = 'applications'
        strict = True
        inflect = common.dasherize
コード例 #5
0
class AuthorsSchema(Schema):

    not_blank = validate.Length(min=1, error='Field cannot be blank')
    # add validate=not_blank in required fields
    id = fields.Integer(dump_only=True)

    name = fields.String(validate=not_blank)
    profile = fields.String(validate=not_blank)
    url = fields.URL(validate=not_blank)

    # self links
    def get_top_level_links(self, data, many):
        if many:
            self_link = "/authors/"
        else:
            self_link = "/authors/{}".format(data['id'])
        return {'self': self_link}

    class Meta:
        type_ = 'authors'
コード例 #6
0
class CommentsSchema(Schema):

    not_blank = validate.Length(min=1, error='Field cannot be blank')
    # add validate=not_blank in required fields
    id = fields.Integer(dump_only=True)

    author = fields.String(validate=not_blank)
    body = fields.String(validate=not_blank)
    author_url = fields.URL(validate=not_blank)
    created_on = fields.Date(required=True)
    approved = fields.Integer(required=True)

    # self links
    def get_top_level_links(self, data, many):
        if many:
            self_link = "/comments/"
        else:
            self_link = "/comments/{}".format(data['id'])
        return {'self': self_link}

    class Meta:
        type_ = 'comments'
コード例 #7
0
class UsersSchema(Schema):

    #not_blank = validate.Length(min=1, error='Field cannot be blank')
    id = fields.Str(dump_only=True)
    name = fields.String()
    email = fields.Email()
    address = fields.String()
    website = fields.URL()
    creation_date = fields.DateTime()
    is_active = fields.Boolean()
    mobile = fields.Integer()
    Birthday = fields.Date()
    
    #self links
    def get_top_level_links(self, data, many):
        if many:
            self_link = "/users/"
        else:
            self_link = "/users/{}".format(data['id'])
        return {'self': self_link}

    class Meta:
        type_ = 'users'
コード例 #8
0
ファイル: schema.py プロジェクト: pythonModule/commandment
class MDMServiceURL(Schema):
    uri = fields.URL()
    http_method = fields.String()