class LoungeSchema(ma.Schema): dateTime = ma.DateTime(attribute = 'date_time', required = True) location = ma.String() community = ma.String() isReserved = ma.Boolean(attribute = 'is_reserved', required = True) topic = ma.String() summary = ma.String()
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 UserLoungeBaseSchema(ma.Schema): topic = ma.String() summary = ma.String() showedUp = ma.Boolean(attribute = 'showed_up') isHost = ma.Boolean(attribute = 'is_host', required = True)
class UserPictureSchema(ma.Schema): href = ma.URLFor('picture_ep', picture_id = '<id>') id = ma.String('picture_ep', picture_id = '<id>') image = ma.URLFor('picture_image_ep', picture_id = '<id>')
class KeySchema(ma.Schema): key = ma.String(required = True) href = ma.URLFor('key_ep', user_id = '<user.id>')
class UserSignInSchema(ma.Schema): email = ma.String(required = True) password = ma.String(required = True)
class RoledUserSchema(UserSchema): role = ma.String(validate = validate_role)
class PasswordedUserSchema(UserSchema): password = ma.String(required = True)
class UserHostApplicationSchema(ma.Schema): application = ma.String(required = True) isApproved = ma.Boolean(attribute = 'is_approved')
class AuthenticationSchema(ma.Schema): key = ma.String(attribute = 'Authorization-API-Key', required = True)