Beispiel #1
0
class UserSchema(ma.Schema):
    email = ma.Email(required = True)
    firstName = ma.String(attribute = 'first_name', required = True)
    lastName = ma.String(attribute = 'last_name')
    bio = ma.String()
    notifications = ma.Integer(required = True)
    picture = ma.Nested(UserPictureSchema, default = dict())
    role = ma.String()
    hostApplications = ma.Nested(UserHostApplicationSchema, default = dict())
    userLounges = ma.Nested(LinkedLoungeSchema, default=dict())
Beispiel #2
0
class UserLoungeListSchema(ma.Schema):
    items = ma.Nested(LinkedUserLoungeSchema, many = True, attribute = 'user_lounges')
    href = ma.URLFor('user_lounges_ep', user_id = '<user_id>')
Beispiel #3
0
class LoungeListSchema(ma.Schema):
    items = ma.Nested(LinkedLoungeSchema, many = True, attribute = 'lounges')
    href = ma.URLFor('lounges_ep')
Beispiel #4
0
class LoungePictureListSchema(ma.Schema):
    items = ma.Nested(LinkedLoungePictureSchema, many = True, attribute = 'lounge_pictures')
    href = ma.URLFor('lounge_pictures_ep', lounge_id = '<lounge_id>')
Beispiel #5
0
class LoungePictureSchema(ma.Schema):
    picture = ma.Nested(PictureSchema, allow_null = True, default = dict(), required = True)
Beispiel #6
0
class PictureListSchema(ma.Schema):
    items = ma.Nested(PictureSchema, many = True, attribute = 'pictures')
    href = ma.URLFor('pictures_ep')
Beispiel #7
0
class UserHostApplicationListSchema(ma.Schema):
    items = ma.Nested(LinkedUserHostApplicationSchema, many = True, attribute = 'user_host_applications')
    href = ma.URLFor('user_host_applications_ep', user_id = '<user_id>')
Beispiel #8
0
class UserListSchema(ma.Schema):
    items = ma.Nested(UserSchema, many = True, attribute = 'users')
    href = ma.URLFor('users_ep')
Beispiel #9
0
class LoungeUserListSchemaExpanded(LoungeUserListSchema):
    items = ma.Nested(LinkedLoungeUserSchemaExpanded, many = True, attribute = 'lounge_users')
Beispiel #10
0
class LoungeUserListSchema(ma.Schema):
    items = ma.Nested(LinkedLoungeUserSchema, many = True, attribute = 'lounge_users')
    href = ma.URLFor('lounge_users_ep', lounge_id = '<lounge_id>')
Beispiel #11
0
class LoungeUserListSchemaExpanded(LoungeUserListSchema):
    items = ma.Nested(LinkedLoungeUserSchemaExpanded, many = True, attribute = 'lounge_users')

class UserSchema(ma.Schema):
    email = ma.Email(required = True)
    firstName = ma.String(attribute = 'first_name', required = True)
    lastName = ma.String(attribute = 'last_name')
    bio = ma.String()
    notifications = ma.Integer(required = True)
    picture = ma.Nested(UserPictureSchema, default = dict())
    role = ma.String()
    hostApplications = ma.Nested(UserHostApplicationSchema, default = dict())
    userLounges = ma.Nested(LinkedLoungeSchema, default=dict())


LoungeSchema.loungeUsers = ma.Nested(LoungeUserSchema, default = dict())

class PasswordedUserSchema(UserSchema):
    password = ma.String(required = True)

class RoledUserSchema(UserSchema):
    role = ma.String(validate = validate_role)

class LinkedUserSchema(RoledUserSchema):
    href = ma.URLFor('user_ep', user_id = '<id>')
    key = ma.Hyperlinks({
        'href': ma.URLFor('key_ep', user_id = '<id>')
    })
    userLounges = ma.Hyperlinks({
        'href': ma.URLFor('user_lounges_ep', user_id = '<id>')
    })