schemas.py 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # coding=utf-8
  2. import marshmallow
  3. class ProfileSchema(marshmallow.Schema):
  4. id = marshmallow.fields.Int(dump_only=True, required=True)
  5. name = marshmallow.fields.String()
  6. class UserSchema(marshmallow.Schema):
  7. user_id = marshmallow.fields.Int(dump_only=True, required=True)
  8. email = marshmallow.fields.Email(required=True)
  9. display_name = marshmallow.fields.String()
  10. created = marshmallow.fields.DateTime(format='iso8601')
  11. is_active = marshmallow.fields.Bool()
  12. # TODO - G.M - 17-04-2018 - Restrict timezone values
  13. timezone = marshmallow.fields.String()
  14. # TODO - G.M - 17-04-2018 - check this, relative url allowed ?
  15. caldav_url = marshmallow.fields.Url(relative=True)
  16. profile = marshmallow.fields.Nested(
  17. ProfileSchema,
  18. many=False,
  19. )
  20. class BasicAuthSchema(marshmallow.Schema):
  21. email = marshmallow.fields.Email(required=True)
  22. password = marshmallow.fields.String(required=True, load_only=True)
  23. class LoginOutputHeaders(marshmallow.Schema):
  24. expire_after = marshmallow.fields.String()
  25. class OkResponse(marshmallow.Schema):
  26. message = marshmallow.fields.String(required=True)