We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Microlocations : GET requests return ERROR 500
**I'm submitting a ...**  (check one with "x")
- [x] bug report
- [ ] feature request
- [ ] support request => Please do not submit support requests here, instead ask your query in out Gitter channel at https://gitter.im/fossasia/open-event-orga-server

Endpoint 
```
GET v1/events/<event_id>/microlocations 
```

Response
```
{
   "errors":[
      {
         "detail":"Unknown error",
         "source":{
            "pointer":""
         },
         "status":500,
         "title":"Unknown error"
      }
   ],
   "jsonapi":{
      "version":"1.0"
   }
}
```

Example URL
```
https://open-event-api.herokuapp.com/v1/events/173/microlocations
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `app/api/microlocations.py`
Content:
```
1 from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
2 from marshmallow_jsonapi.flask import Schema, Relationship
3 from marshmallow_jsonapi import fields
4 
5 from app.api.bootstrap import api
6 from app.api.helpers.utilities import dasherize
7 from app.models import db
8 from app.models.microlocation import Microlocation
9 from app.models.session import Session
10 from app.api.helpers.db import safe_query
11 from app.api.helpers.utilities import require_relationship
12 from app.api.helpers.permission_manager import has_access
13 from app.api.helpers.exceptions import ForbiddenException
14 from app.api.helpers.query import event_query
15 
16 
17 class MicrolocationSchema(Schema):
18     """
19     Api schema for Microlocation Model
20     """
21 
22     class Meta:
23         """
24         Meta class for Microlocation Api Schema
25         """
26         type_ = 'microlocation'
27         self_view = 'v1.microlocation_detail'
28         self_view_kwargs = {'id': '<id>'}
29         self_view_many = 'v1.session_list'
30         inflect = dasherize
31 
32     id = fields.Str(dump_only=True)
33     name = fields.Str(required=True)
34     latitude = fields.Float(validate=lambda n: -90 <= n <= 90, allow_none=True)
35     longitude = fields.Float(validate=lambda n: -180 <= n <= 180, allow_none=True)
36     floor = fields.Integer(allow_none=True)
37     room = fields.Str(allow_none=True)
38     sessions = Relationship(attribute='session',
39                             self_view='v1.microlocation_session',
40                             self_view_kwargs={'id': '<id>'},
41                             related_view='v1.session_list',
42                             related_view_kwargs={'microlocation_id': '<id>'},
43                             schema='SessionSchema',
44                             type_='session')
45     event = Relationship(attribute='event',
46                          self_view='v1.microlocation_event',
47                          self_view_kwargs={'id': '<id>'},
48                          related_view='v1.event_detail',
49                          related_view_kwargs={'microlocation_id': '<id>'},
50                          schema='EventSchema',
51                          type_='event')
52 
53 
54 class MicrolocationListPost(ResourceList):
55     """
56     List and create microlocations
57     """
58     def before_post(self, args, kwargs, data):
59         require_relationship(['event'], data)
60         if not has_access('is_coorganizer', event_id=data['event']):
61             raise ForbiddenException({'source': ''}, 'Co-organizer access is required.')
62 
63     methods = ['POST', ]
64     schema = MicrolocationSchema
65     data_layer = {'session': db.session,
66                   'model': Microlocation}
67 
68 
69 class MicrolocationList(ResourceList):
70     """
71     List Microlocations
72     """
73     def query(self, view_kwargs):
74         query_ = self.session.query(Microlocation)
75         query_ = event_query(self, query_, view_kwargs)
76         if view_kwargs.get('session_id'):
77             session = safe_query(self, Session, 'id', view_kwargs['session_id'], 'session_id')
78             query_ = query_.join(Session).filter(Session.id == session.id)
79         return query_
80 
81     view_kwargs = True
82     methods = ['GET']
83     schema = MicrolocationSchema
84     data_layer = {'session': db.session,
85                   'model': Microlocation,
86                   'methods': {
87                       'query': query
88                   }}
89 
90 
91 class MicrolocationDetail(ResourceDetail):
92     """
93     Microlocation detail by id
94     """
95 
96     def before_get_object(self, view_kwargs):
97 
98         if view_kwargs.get('session_id') is not None:
99             sessions = safe_query(self, Session, 'id', view_kwargs['session_id'], 'session_id')
100             if sessions.event_id is not None:
101                 view_kwargs['id'] = sessions.event_id
102             else:
103                 view_kwargs['id'] = None
104 
105     decorators = (api.has_permission('is_coorganizer', methods="PATCH,DELETE", fetch="event_id", fetch_as="event_id",
106                                      model=Microlocation),)
107     schema = MicrolocationSchema
108     data_layer = {'session': db.session,
109                   'model': Microlocation,
110                   'methods': {'before_get_object': before_get_object}}
111 
112 
113 class MicrolocationRelationshipRequired(ResourceRelationship):
114     """
115     Microlocation Relationship for required entities
116     """
117     decorators = (api.has_permission('is_coorganizer', methods="PATCH", fetch="event_id", fetch_as="event_id",
118                                      model=Microlocation),)
119     methods = ['GET', 'PATCH']
120     schema = MicrolocationSchema
121     data_layer = {'session': db.session,
122                   'model': Microlocation}
123 
124 
125 class MicrolocationRelationshipOptional(ResourceRelationship):
126     """
127     Microlocation Relationship
128     """
129     decorators = (api.has_permission('is_coorganizer', methods="PATCH,DELETE", fetch="event_id", fetch_as="event_id",
130                                      model=Microlocation),)
131     schema = MicrolocationSchema
132     data_layer = {'session': db.session,
133                   'model': Microlocation}
134
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/app/api/microlocations.py b/app/api/microlocations.py
--- a/app/api/microlocations.py
+++ b/app/api/microlocations.py
@@ -26,7 +26,7 @@
         type_ = 'microlocation'
         self_view = 'v1.microlocation_detail'
         self_view_kwargs = {'id': '<id>'}
-        self_view_many = 'v1.session_list'
+        self_view_many = 'v1.microlocation_list_post'
         inflect = dasherize
 
     id = fields.Str(dump_only=True)
@@ -36,6 +36,7 @@
     floor = fields.Integer(allow_none=True)
     room = fields.Str(allow_none=True)
     sessions = Relationship(attribute='session',
+                            many=True,
                             self_view='v1.microlocation_session',
                             self_view_kwargs={'id': '<id>'},
                             related_view='v1.session_list',

{"golden_diff": "diff --git a/app/api/microlocations.py b/app/api/microlocations.py\n--- a/app/api/microlocations.py\n+++ b/app/api/microlocations.py\n@@ -26,7 +26,7 @@\n         type_ = 'microlocation'\n         self_view = 'v1.microlocation_detail'\n         self_view_kwargs = {'id': '<id>'}\n-        self_view_many = 'v1.session_list'\n+        self_view_many = 'v1.microlocation_list_post'\n         inflect = dasherize\n \n     id = fields.Str(dump_only=True)\n@@ -36,6 +36,7 @@\n     floor = fields.Integer(allow_none=True)\n     room = fields.Str(allow_none=True)\n     sessions = Relationship(attribute='session',\n+                            many=True,\n                             self_view='v1.microlocation_session',\n                             self_view_kwargs={'id': '<id>'},\n                             related_view='v1.session_list',\n", "issue": "Microlocations : GET requests return ERROR 500\n**I'm submitting a ...**  (check one with \"x\")\r\n- [x] bug report\r\n- [ ] feature request\r\n- [ ] support request => Please do not submit support requests here, instead ask your query in out Gitter channel at https://gitter.im/fossasia/open-event-orga-server\r\n\r\nEndpoint \r\n```\r\nGET v1/events/<event_id>/microlocations \r\n```\r\n\r\nResponse\r\n```\r\n{\r\n   \"errors\":[\r\n      {\r\n         \"detail\":\"Unknown error\",\r\n         \"source\":{\r\n            \"pointer\":\"\"\r\n         },\r\n         \"status\":500,\r\n         \"title\":\"Unknown error\"\r\n      }\r\n   ],\r\n   \"jsonapi\":{\r\n      \"version\":\"1.0\"\r\n   }\r\n}\r\n```\r\n\r\nExample URL\r\n```\r\nhttps://open-event-api.herokuapp.com/v1/events/173/microlocations\r\n```\r\n\n", "before_files": [{"content": "from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship\nfrom marshmallow_jsonapi.flask import Schema, Relationship\nfrom marshmallow_jsonapi import fields\n\nfrom app.api.bootstrap import api\nfrom app.api.helpers.utilities import dasherize\nfrom app.models import db\nfrom app.models.microlocation import Microlocation\nfrom app.models.session import Session\nfrom app.api.helpers.db import safe_query\nfrom app.api.helpers.utilities import require_relationship\nfrom app.api.helpers.permission_manager import has_access\nfrom app.api.helpers.exceptions import ForbiddenException\nfrom app.api.helpers.query import event_query\n\n\nclass MicrolocationSchema(Schema):\n    \"\"\"\n    Api schema for Microlocation Model\n    \"\"\"\n\n    class Meta:\n        \"\"\"\n        Meta class for Microlocation Api Schema\n        \"\"\"\n        type_ = 'microlocation'\n        self_view = 'v1.microlocation_detail'\n        self_view_kwargs = {'id': '<id>'}\n        self_view_many = 'v1.session_list'\n        inflect = dasherize\n\n    id = fields.Str(dump_only=True)\n    name = fields.Str(required=True)\n    latitude = fields.Float(validate=lambda n: -90 <= n <= 90, allow_none=True)\n    longitude = fields.Float(validate=lambda n: -180 <= n <= 180, allow_none=True)\n    floor = fields.Integer(allow_none=True)\n    room = fields.Str(allow_none=True)\n    sessions = Relationship(attribute='session',\n                            self_view='v1.microlocation_session',\n                            self_view_kwargs={'id': '<id>'},\n                            related_view='v1.session_list',\n                            related_view_kwargs={'microlocation_id': '<id>'},\n                            schema='SessionSchema',\n                            type_='session')\n    event = Relationship(attribute='event',\n                         self_view='v1.microlocation_event',\n                         self_view_kwargs={'id': '<id>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'microlocation_id': '<id>'},\n                         schema='EventSchema',\n                         type_='event')\n\n\nclass MicrolocationListPost(ResourceList):\n    \"\"\"\n    List and create microlocations\n    \"\"\"\n    def before_post(self, args, kwargs, data):\n        require_relationship(['event'], data)\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ForbiddenException({'source': ''}, 'Co-organizer access is required.')\n\n    methods = ['POST', ]\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation}\n\n\nclass MicrolocationList(ResourceList):\n    \"\"\"\n    List Microlocations\n    \"\"\"\n    def query(self, view_kwargs):\n        query_ = self.session.query(Microlocation)\n        query_ = event_query(self, query_, view_kwargs)\n        if view_kwargs.get('session_id'):\n            session = safe_query(self, Session, 'id', view_kwargs['session_id'], 'session_id')\n            query_ = query_.join(Session).filter(Session.id == session.id)\n        return query_\n\n    view_kwargs = True\n    methods = ['GET']\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation,\n                  'methods': {\n                      'query': query\n                  }}\n\n\nclass MicrolocationDetail(ResourceDetail):\n    \"\"\"\n    Microlocation detail by id\n    \"\"\"\n\n    def before_get_object(self, view_kwargs):\n\n        if view_kwargs.get('session_id') is not None:\n            sessions = safe_query(self, Session, 'id', view_kwargs['session_id'], 'session_id')\n            if sessions.event_id is not None:\n                view_kwargs['id'] = sessions.event_id\n            else:\n                view_kwargs['id'] = None\n\n    decorators = (api.has_permission('is_coorganizer', methods=\"PATCH,DELETE\", fetch=\"event_id\", fetch_as=\"event_id\",\n                                     model=Microlocation),)\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation,\n                  'methods': {'before_get_object': before_get_object}}\n\n\nclass MicrolocationRelationshipRequired(ResourceRelationship):\n    \"\"\"\n    Microlocation Relationship for required entities\n    \"\"\"\n    decorators = (api.has_permission('is_coorganizer', methods=\"PATCH\", fetch=\"event_id\", fetch_as=\"event_id\",\n                                     model=Microlocation),)\n    methods = ['GET', 'PATCH']\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation}\n\n\nclass MicrolocationRelationshipOptional(ResourceRelationship):\n    \"\"\"\n    Microlocation Relationship\n    \"\"\"\n    decorators = (api.has_permission('is_coorganizer', methods=\"PATCH,DELETE\", fetch=\"event_id\", fetch_as=\"event_id\",\n                                     model=Microlocation),)\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation}\n", "path": "app/api/microlocations.py"}], "after_files": [{"content": "from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship\nfrom marshmallow_jsonapi.flask import Schema, Relationship\nfrom marshmallow_jsonapi import fields\n\nfrom app.api.bootstrap import api\nfrom app.api.helpers.utilities import dasherize\nfrom app.models import db\nfrom app.models.microlocation import Microlocation\nfrom app.models.session import Session\nfrom app.api.helpers.db import safe_query\nfrom app.api.helpers.utilities import require_relationship\nfrom app.api.helpers.permission_manager import has_access\nfrom app.api.helpers.exceptions import ForbiddenException\nfrom app.api.helpers.query import event_query\n\n\nclass MicrolocationSchema(Schema):\n    \"\"\"\n    Api schema for Microlocation Model\n    \"\"\"\n\n    class Meta:\n        \"\"\"\n        Meta class for Microlocation Api Schema\n        \"\"\"\n        type_ = 'microlocation'\n        self_view = 'v1.microlocation_detail'\n        self_view_kwargs = {'id': '<id>'}\n        self_view_many = 'v1.microlocation_list_post'\n        inflect = dasherize\n\n    id = fields.Str(dump_only=True)\n    name = fields.Str(required=True)\n    latitude = fields.Float(validate=lambda n: -90 <= n <= 90, allow_none=True)\n    longitude = fields.Float(validate=lambda n: -180 <= n <= 180, allow_none=True)\n    floor = fields.Integer(allow_none=True)\n    room = fields.Str(allow_none=True)\n    sessions = Relationship(attribute='session',\n                            many=True,\n                            self_view='v1.microlocation_session',\n                            self_view_kwargs={'id': '<id>'},\n                            related_view='v1.session_list',\n                            related_view_kwargs={'microlocation_id': '<id>'},\n                            schema='SessionSchema',\n                            type_='session')\n    event = Relationship(attribute='event',\n                         self_view='v1.microlocation_event',\n                         self_view_kwargs={'id': '<id>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'microlocation_id': '<id>'},\n                         schema='EventSchema',\n                         type_='event')\n\n\nclass MicrolocationListPost(ResourceList):\n    \"\"\"\n    List and create microlocations\n    \"\"\"\n    def before_post(self, args, kwargs, data):\n        require_relationship(['event'], data)\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ForbiddenException({'source': ''}, 'Co-organizer access is required.')\n\n    methods = ['POST', ]\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation}\n\n\nclass MicrolocationList(ResourceList):\n    \"\"\"\n    List Microlocations\n    \"\"\"\n    def query(self, view_kwargs):\n        query_ = self.session.query(Microlocation)\n        query_ = event_query(self, query_, view_kwargs)\n        if view_kwargs.get('session_id'):\n            session = safe_query(self, Session, 'id', view_kwargs['session_id'], 'session_id')\n            query_ = query_.join(Session).filter(Session.id == session.id)\n        return query_\n\n    view_kwargs = True\n    methods = ['GET']\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation,\n                  'methods': {\n                      'query': query\n                  }}\n\n\nclass MicrolocationDetail(ResourceDetail):\n    \"\"\"\n    Microlocation detail by id\n    \"\"\"\n\n    def before_get_object(self, view_kwargs):\n\n        if view_kwargs.get('session_id') is not None:\n            sessions = safe_query(self, Session, 'id', view_kwargs['session_id'], 'session_id')\n            if sessions.event_id is not None:\n                view_kwargs['id'] = sessions.event_id\n            else:\n                view_kwargs['id'] = None\n\n    decorators = (api.has_permission('is_coorganizer', methods=\"PATCH,DELETE\", fetch=\"event_id\", fetch_as=\"event_id\",\n                                     model=Microlocation),)\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation,\n                  'methods': {'before_get_object': before_get_object}}\n\n\nclass MicrolocationRelationshipRequired(ResourceRelationship):\n    \"\"\"\n    Microlocation Relationship for required entities\n    \"\"\"\n    decorators = (api.has_permission('is_coorganizer', methods=\"PATCH\", fetch=\"event_id\", fetch_as=\"event_id\",\n                                     model=Microlocation),)\n    methods = ['GET', 'PATCH']\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation}\n\n\nclass MicrolocationRelationshipOptional(ResourceRelationship):\n    \"\"\"\n    Microlocation Relationship\n    \"\"\"\n    decorators = (api.has_permission('is_coorganizer', methods=\"PATCH,DELETE\", fetch=\"event_id\", fetch_as=\"event_id\",\n                                     model=Microlocation),)\n    schema = MicrolocationSchema\n    data_layer = {'session': db.session,\n                  'model': Microlocation}\n", "path": "app/api/microlocations.py"}]}