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())
class UserLoungeListSchema(ma.Schema): items = ma.Nested(LinkedUserLoungeSchema, many = True, attribute = 'user_lounges') href = ma.URLFor('user_lounges_ep', user_id = '<user_id>')
class LoungeListSchema(ma.Schema): items = ma.Nested(LinkedLoungeSchema, many = True, attribute = 'lounges') href = ma.URLFor('lounges_ep')
class LoungePictureListSchema(ma.Schema): items = ma.Nested(LinkedLoungePictureSchema, many = True, attribute = 'lounge_pictures') href = ma.URLFor('lounge_pictures_ep', lounge_id = '<lounge_id>')
class LoungePictureSchema(ma.Schema): picture = ma.Nested(PictureSchema, allow_null = True, default = dict(), required = True)
class PictureListSchema(ma.Schema): items = ma.Nested(PictureSchema, many = True, attribute = 'pictures') href = ma.URLFor('pictures_ep')
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>')
class UserListSchema(ma.Schema): items = ma.Nested(UserSchema, many = True, attribute = 'users') href = ma.URLFor('users_ep')
class LoungeUserListSchemaExpanded(LoungeUserListSchema): items = ma.Nested(LinkedLoungeUserSchemaExpanded, many = True, attribute = 'lounge_users')
class LoungeUserListSchema(ma.Schema): items = ma.Nested(LinkedLoungeUserSchema, many = True, attribute = 'lounge_users') href = ma.URLFor('lounge_users_ep', lounge_id = '<lounge_id>')
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>') })