prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add photo field to the User model
  ## Description
  The user profile photo might be automatically fetched from the third-party account system (Google or Apple), or it can also be uploaded from by the user. Since the file itself might be stored on an external storage service, this field will be used to store the location of the file.
  
  In this issue, it's important to consider the flow front-end → back-end for photo upload.
  
  ## Suggested subtasks
  - [ ] Design the overall flow to upload photo considering front-end → back-end flow
  - [ ] Add the new field on model with proper support to the external storage service (upload) and update DB migrations
  - [ ] Implement upload feature to update photo
  - [ ] Add support to present the proper photo URL from external services
  - [ ] Add the new photo field on user API
  
  This issue depends on:
  - #21 
  
  </issue>
  <code>
  [start of terraso_backend/apps/graphql/schema/users.py]
  1 import graphene
  2 from graphene import relay
  3 from graphene_django import DjangoObjectType
  4 
  5 from apps.core.models import User
  6 
  7 from .commons import BaseDeleteMutation
  8 
  9 
  10 class UserNode(DjangoObjectType):
  11     id = graphene.ID(source="pk", required=True)
  12 
  13     class Meta:
  14         model = User
  15         filter_fields = {
  16             "email": ["exact", "icontains"],
  17             "first_name": ["icontains"],
  18             "last_name": ["icontains"],
  19         }
  20         fields = ("email", "first_name", "last_name", "memberships")
  21         interfaces = (relay.Node,)
  22 
  23 
  24 class UserAddMutation(relay.ClientIDMutation):
  25     user = graphene.Field(UserNode)
  26 
  27     class Input:
  28         first_name = graphene.String()
  29         last_name = graphene.String()
  30         email = graphene.String(required=True)
  31         password = graphene.String(required=True)
  32 
  33     @classmethod
  34     def mutate_and_get_payload(cls, root, info, **kwargs):
  35         user = User.objects.create_user(
  36             kwargs.pop("email"), password=kwargs.pop("password"), **kwargs
  37         )
  38 
  39         return cls(user=user)
  40 
  41 
  42 class UserUpdateMutation(relay.ClientIDMutation):
  43     user = graphene.Field(UserNode)
  44 
  45     model_class = User
  46 
  47     class Input:
  48         id = graphene.ID(required=True)
  49         first_name = graphene.String()
  50         last_name = graphene.String()
  51         email = graphene.String()
  52         password = graphene.String()
  53 
  54     @classmethod
  55     def mutate_and_get_payload(cls, root, info, **kwargs):
  56         _id = kwargs.pop("id")
  57 
  58         user = User.objects.get(pk=_id)
  59         new_password = kwargs.pop("password", None)
  60 
  61         if new_password:
  62             user.set_password(new_password)
  63 
  64         for attr, value in kwargs.items():
  65             setattr(user, attr, value)
  66 
  67         user.save()
  68 
  69         return cls(user=user)
  70 
  71 
  72 class UserDeleteMutation(BaseDeleteMutation):
  73     user = graphene.Field(UserNode)
  74     model_class = User
  75 
  76     class Input:
  77         id = graphene.ID()
  78
  [end of terraso_backend/apps/graphql/schema/users.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/terraso_backend/apps/graphql/schema/users.py b/terraso_backend/apps/graphql/schema/users.py
  --- a/terraso_backend/apps/graphql/schema/users.py
  +++ b/terraso_backend/apps/graphql/schema/users.py
  @@ -17,7 +17,7 @@
               "first_name": ["icontains"],
               "last_name": ["icontains"],
           }
  -        fields = ("email", "first_name", "last_name", "memberships")
  +        fields = ("email", "first_name", "last_name", "profile_image", "memberships")
           interfaces = (relay.Node,)
  
verification_info: {"golden_diff": "diff --git a/terraso_backend/apps/graphql/schema/users.py b/terraso_backend/apps/graphql/schema/users.py\n--- a/terraso_backend/apps/graphql/schema/users.py\n+++ b/terraso_backend/apps/graphql/schema/users.py\n@@ -17,7 +17,7 @@\n             \"first_name\": [\"icontains\"],\n             \"last_name\": [\"icontains\"],\n         }\n-        fields = (\"email\", \"first_name\", \"last_name\", \"memberships\")\n+        fields = (\"email\", \"first_name\", \"last_name\", \"profile_image\", \"memberships\")\n         interfaces = (relay.Node,)\n", "issue": "Add photo field to the User model\n## Description\r\nThe user profile photo might be automatically fetched from the third-party account system (Google or Apple), or it can also be uploaded from by the user. Since the file itself might be stored on an external storage service, this field will be used to store the location of the file.\r\n\r\nIn this issue, it's important to consider the flow front-end \u2192 back-end for photo upload.\r\n\r\n## Suggested subtasks\r\n- [ ] Design the overall flow to upload photo considering front-end \u2192 back-end flow\r\n- [ ] Add the new field on model with proper support to the external storage service (upload) and update DB migrations\r\n- [ ] Implement upload feature to update photo\r\n- [ ] Add support to present the proper photo URL from external services\r\n- [ ] Add the new photo field on user API\r\n\r\nThis issue depends on:\r\n- #21 \n", "before_files": [{"content": "import graphene\nfrom graphene import relay\nfrom graphene_django import DjangoObjectType\n\nfrom apps.core.models import User\n\nfrom .commons import BaseDeleteMutation\n\n\nclass UserNode(DjangoObjectType):\n    id = graphene.ID(source=\"pk\", required=True)\n\n    class Meta:\n        model = User\n        filter_fields = {\n            \"email\": [\"exact\", \"icontains\"],\n            \"first_name\": [\"icontains\"],\n            \"last_name\": [\"icontains\"],\n        }\n        fields = (\"email\", \"first_name\", \"last_name\", \"memberships\")\n        interfaces = (relay.Node,)\n\n\nclass UserAddMutation(relay.ClientIDMutation):\n    user = graphene.Field(UserNode)\n\n    class Input:\n        first_name = graphene.String()\n        last_name = graphene.String()\n        email = graphene.String(required=True)\n        password = graphene.String(required=True)\n\n    @classmethod\n    def mutate_and_get_payload(cls, root, info, **kwargs):\n        user = User.objects.create_user(\n            kwargs.pop(\"email\"), password=kwargs.pop(\"password\"), **kwargs\n        )\n\n        return cls(user=user)\n\n\nclass UserUpdateMutation(relay.ClientIDMutation):\n    user = graphene.Field(UserNode)\n\n    model_class = User\n\n    class Input:\n        id = graphene.ID(required=True)\n        first_name = graphene.String()\n        last_name = graphene.String()\n        email = graphene.String()\n        password = graphene.String()\n\n    @classmethod\n    def mutate_and_get_payload(cls, root, info, **kwargs):\n        _id = kwargs.pop(\"id\")\n\n        user = User.objects.get(pk=_id)\n        new_password = kwargs.pop(\"password\", None)\n\n        if new_password:\n            user.set_password(new_password)\n\n        for attr, value in kwargs.items():\n            setattr(user, attr, value)\n\n        user.save()\n\n        return cls(user=user)\n\n\nclass UserDeleteMutation(BaseDeleteMutation):\n    user = graphene.Field(UserNode)\n    model_class = User\n\n    class Input:\n        id = graphene.ID()\n", "path": "terraso_backend/apps/graphql/schema/users.py"}]}