Exemplo n.º 1
0
 def get_resource_fields(self):
     return {
         'id':
         fields.Integer(attribute='pk'),
         'uri':
         InstanceURI('track'),
         'files':
         TrackFiles,
         'bitrate':
         fields.Integer,
         'length':
         fields.Integer,
         'title':
         fields.String,
         'slug':
         fields.String,
         'artist':
         ForeignKeyField(
             Artist, {
                 'id': fields.Integer(attribute='pk'),
                 'uri': InstanceURI('artist'),
             }),
         'album':
         ForeignKeyField(
             Album, {
                 'id': fields.Integer(attribute='pk'),
                 'uri': InstanceURI('album'),
             }),
         'number':
         fields.Integer,
     }
Exemplo n.º 2
0
 def get_resource_fields(self):
     return {
         'id': fields.Integer(attribute='pk'),
         'name': fields.String,
         'slug': fields.String,
         'year': fields.Integer,
         'uri': InstanceURI('albums'),
         'artists': ManyToManyField(Artist, {
             'id': fields.Integer(attribute='pk'),
             'uri': InstanceURI('artists'),
         }),
         'cover': fields.String(default=app.config['DEFAULT_ALBUM_COVER']),
     }
Exemplo n.º 3
0
def _get_cloud_fields():
    return {
        'clouddef_id': fields.Integer,
        'name': fields.String,
        'cloudprovider_id': fields.Integer(
            default=None),  # Make sure we actually get "null" and not "0"
        'virtual_device_layer_id': fields.Integer(
            default=None),  # Make sure we actually get "null" and not "0"
        'test_layer_id': fields.Integer(
            default=None),  # Make sure we actually get "null" and not "0"
        'snapshot_id': fields.String,
        'snapshot_image_id': fields.String,
        'client_startup_parameters': fields.String,
        'uri': BpUrl(api_restful, CloudApi, absolute=True)
    }
Exemplo n.º 4
0
 def get_resource_fields(self):
     return {
         'id':
         fields.String,
         'artists':
         ManyToManyField(
             Artist, {
                 'id': fields.Integer(attribute='pk'),
                 'uri': InstanceURI('artist'),
             }),
         'other_artists':
         fields.List(fields.Raw),
         'datetime':
         fields.DateTime,
         'title':
         fields.String,
         'tickets_left':
         Boolean,
         'venue':
         fields.Nested({
             'latitude': fields.String,
             'longitude': fields.String,
             'name': fields.String,
         }),
     }
Exemplo n.º 5
0
class AlbumFields(Fieldset):
    id = fields.Integer(attribute="a_id"),
    title = fields.String,
    thumbnail = OptionalNestedField(PictureFields, "id", plain_field=fields.Integer)
    date = fields.String(attribute="a_date"),
    location_name = fields.String(attribute='a_location'),
    description = fields.String(attribute='a_desc')
Exemplo n.º 6
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), unique=True)
    email = db.Column(db.String(255), unique=True)
    password = db.Column(db.String(255))
    active = db.Column(db.Boolean())
    created_at = db.Column(db.DateTime())
    confirmed_at = db.Column(db.DateTime())
    playlists = db.relationship('Playlist', backref='user', lazy='dynamic')

    def is_authenticated(self):
        return True

    def is_active(self):
        return self.active

    def is_anonymous(self):
        return False

    def get_id(self):
        return self.id

    def update_password(self, password):
        self.password = bcrypt.encrypt(password)

    def check_password(self, password):
        return bcrypt.verify(password, self.password)

    resource_fields = {'id': fields.Integer(), 'name': fields.String()}
Exemplo n.º 7
0
class PictureFields(Fieldset):
    id = fields.Integer(attribute="pid"),
    album_id = fields.Integer,
    hits = fields.Integer,
    url = PixmaUrl(),
    thumb_small_url = PixmaUrl(format_type=PixmaUrl.thumb_small),
    thumb_square_url = PixmaUrl(format_type=PixmaUrl.thumb_square),
    thumb_url = PixmaUrl(format_type=PixmaUrl.thumb)
Exemplo n.º 8
0
class EventLocationFields(Fieldset):
    id = fields.Integer(attribute="lid")
    name = fields.String(attribute="location")
    url = fields.String
    slug = fields.String(attribute="location_url")
    street = fields.String(attribute="strasse")
    zip_no = fields.String(attribute="plz")
    town = fields.String(attribute="stadt")
Exemplo n.º 9
0
def get_criteria_in_course():
    data_format = get_criteria()
    data_format.update({
        'course_id': fields.Integer(attribute=lambda x: x.course_assoc.courses_id),
        'active': fields.Boolean(attribute=lambda x: x.course_assoc.active),
        'in_question': fields.Boolean(attribute=lambda x: x.course_assoc.in_question)
    })
    return data_format
Exemplo n.º 10
0
 def get_resource_fields(self):
     return {
         'id': fields.Integer(attribute='pk'),
         'name': fields.String,
         'slug': fields.String,
         'uri': InstanceURI('artist'),
         'image': fields.String(default=app.config['DEFAULT_ARTIST_IMAGE']),
         'events_uri': fields.String(attribute='events'),
     }
Exemplo n.º 11
0
class OrganizerField(Fieldset):
    class Meta:
        default_embedd = ["location"]

    id = fields.Integer(attribute="vid")
    approved = fields.Boolean
    location = OptionalNestedField(EventLocationFields,
                                   "lid",
                                   attribute="location")
    member = OptionalNestedField(MemberFields, "id", attribute="mid")
Exemplo n.º 12
0
def _get_layer_details_fields():
    return {
            'layer_id' : fields.Integer,
            'name' : fields.String,
            'tag' : fields.String,
            'content' : fields.String,
            'parent_id' : fields.Integer(default=None), # Make sure we actually get "null" and not "0"
            'modified_on' : fields.DateTime(dt_format='iso8601'),
            'uri' : BpUrl(api_restful, LayerApi, absolute=True)
            }
Exemplo n.º 13
0
def _get_dataprovider_fields():
    return {
            'datadef_id' : fields.Integer,
            'name' : fields.String,
            'dataprovider_id' : fields.Integer(default=None),
            'source' : fields.String,
            'source_path_filter' : fields.String,
            'source_filename_filter' : fields.String,
            'destination' : fields.String,
            'uri' : BpUrl(api_restful, DataProviderApi, absolute=True)
            }
Exemplo n.º 14
0
class EventFields(Fieldset):
    class Meta:
        default_embedd = []

    id = fields.Integer(attribute="event_id")
    title = fields.String
    start = fields.DateTime
    end = fields.DateTime
    editable = fields.Boolean
    allDay = fields.Boolean
    type = fields.String(attribute="type_name")
    overall_end = fields.DateTime
    category = OptionalNestedField(EventCategoryFields,
                                   "tag",
                                   attribute="category_instance")
    location = OptionalNestedField(EventLocationFields,
                                   "lid",
                                   attribute="location")