prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  allow mutiple station for same location
  <!--
  (Thanks for sending a pull request! Please make sure you click the link above to view the contribution guidelines, then fill out the blanks below.)
  -->
  <!-- Add the issue number that is fixed by this PR (In the form Fixes #123) -->
  
  Fixes #8958 
  
  #### Short description of what this resolves:
  - fix issue to allow mutiple station for same location
  
  #### Changes proposed in this pull request:
  
  - allow mutiple station for same location
  
  #### Checklist
  
  - [x] I have read the [Contribution & Best practices Guide](https://blog.fossasia.org/open-source-developer-guide-and-best-practices-at-fossasia) and my PR follows them.
  - [x] My branch is up-to-date with the Upstream `development` branch.
  - [ ] The unit tests pass locally with my changes <!-- use `nosetests tests/` to run all the tests -->
  - [ ] I have added tests that prove my fix is effective or that my feature works
  - [ ] I have added necessary documentation (if appropriate)
  <!-- If an existing function does not have a docstring, please add one -->
  - [ ] All the functions created/modified in this PR contain relevant docstrings.
  
  
  --- 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/station.py`
  Content:
  ```
  1 from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
  2 from flask_rest_jsonapi.exceptions import ObjectNotFound
  3 
  4 from app.api.helpers.db import safe_query_kwargs
  5 from app.api.helpers.permission_manager import has_access
  6 from app.api.helpers.permissions import jwt_required
  7 from app.api.helpers.utilities import require_relationship
  8 from app.api.schema.station import StationSchema
  9 from app.models import db
  10 from app.models.event import Event
  11 from app.models.microlocation import Microlocation
  12 from app.models.station import Station
  13 
  14 
  15 class StationList(ResourceList):
  16     """Create and List Station"""
  17 
  18     def query(self, view_kwargs):
  19         """
  20         query method for different view_kwargs
  21         :param view_kwargs:
  22         :return:
  23         """
  24         query_ = self.session.query(Station)
  25         if view_kwargs.get('event_id'):
  26             event = safe_query_kwargs(Event, view_kwargs, 'event_id')
  27             query_ = query_.filter_by(event_id=event.id)
  28 
  29         elif view_kwargs.get('microlocation_id'):
  30             event = safe_query_kwargs(Microlocation, view_kwargs, 'microlocation_id')
  31             query_ = query_.filter_by(microlocation_id=event.id)
  32 
  33         return query_
  34 
  35     view_kwargs = True
  36     schema = StationSchema
  37     data_layer = {
  38         'session': db.session,
  39         'model': Station,
  40         'methods': {'query': query},
  41     }
  42 
  43 
  44 class StationDetail(ResourceDetail):
  45     """Station detail by id"""
  46 
  47     @staticmethod
  48     def before_patch(args, kwargs, data):
  49         """
  50         before patch method
  51         :param args:
  52         :param kwargs:
  53         :param data:
  54         :return:
  55         """
  56         require_relationship(['event'], data)
  57         if not has_access('is_coorganizer', event_id=data['event']):
  58             raise ObjectNotFound(
  59                 {'parameter': 'event'},
  60                 f"Event: {data['event']} not found {args} {kwargs}",
  61             )
  62 
  63         if data.get('microlocation'):
  64             require_relationship(['microlocation'], data)
  65         else:
  66             if data['station_type'] in ('check in', 'check out', 'daily'):
  67                 raise ObjectNotFound(
  68                     {'parameter': 'microlocation'},
  69                     "Microlocation: microlocation_id is missing from your request.",
  70                 )
  71 
  72     schema = StationSchema
  73     data_layer = {
  74         'session': db.session,
  75         'model': Station,
  76     }
  77 
  78 
  79 class StationRelationship(ResourceRelationship):
  80     """Station Relationship (Required)"""
  81 
  82     decorators = (jwt_required,)
  83     methods = ['GET', 'PATCH']
  84     schema = StationSchema
  85     data_layer = {'session': db.session, 'model': Station}
  86 
  87 
  88 class StationListPost(ResourceList):
  89     """Create and List Station"""
  90 
  91     @staticmethod
  92     def before_post(args, kwargs, data):
  93         """
  94         method to check for required relationship with event and microlocation
  95         :param data:
  96         :param args:
  97         :param kwargs:
  98         :return:
  99         """
  100         require_relationship(['event'], data)
  101         if not has_access('is_coorganizer', event_id=data['event']):
  102             raise ObjectNotFound(
  103                 {'parameter': 'event'},
  104                 f"Event: {data['event']} not found {args} {kwargs}",
  105             )
  106 
  107         if data.get('microlocation'):
  108             require_relationship(['microlocation'], data)
  109         else:
  110             if data['station_type'] in ('check in', 'check out', 'daily'):
  111                 raise ObjectNotFound(
  112                     {'parameter': 'microlocation'},
  113                     "Microlocation: missing from your request.",
  114                 )
  115 
  116     schema = StationSchema
  117     methods = [
  118         'POST',
  119     ]
  120     data_layer = {
  121         'session': db.session,
  122         'model': Station,
  123     }
  124
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/app/api/station.py b/app/api/station.py
  --- a/app/api/station.py
  +++ b/app/api/station.py
  @@ -63,7 +63,7 @@
           if data.get('microlocation'):
               require_relationship(['microlocation'], data)
           else:
  -            if data['station_type'] in ('check in', 'check out', 'daily'):
  +            if data['station_type'] in ('check in', 'check out'):
                   raise ObjectNotFound(
                       {'parameter': 'microlocation'},
                       "Microlocation: microlocation_id is missing from your request.",
  @@ -107,7 +107,7 @@
           if data.get('microlocation'):
               require_relationship(['microlocation'], data)
           else:
  -            if data['station_type'] in ('check in', 'check out', 'daily'):
  +            if data['station_type'] in ('check in', 'check out'):
                   raise ObjectNotFound(
                       {'parameter': 'microlocation'},
                       "Microlocation: missing from your request.",
  
verification_info: {"golden_diff": "diff --git a/app/api/station.py b/app/api/station.py\n--- a/app/api/station.py\n+++ b/app/api/station.py\n@@ -63,7 +63,7 @@\n         if data.get('microlocation'):\n             require_relationship(['microlocation'], data)\n         else:\n-            if data['station_type'] in ('check in', 'check out', 'daily'):\n+            if data['station_type'] in ('check in', 'check out'):\n                 raise ObjectNotFound(\n                     {'parameter': 'microlocation'},\n                     \"Microlocation: microlocation_id is missing from your request.\",\n@@ -107,7 +107,7 @@\n         if data.get('microlocation'):\n             require_relationship(['microlocation'], data)\n         else:\n-            if data['station_type'] in ('check in', 'check out', 'daily'):\n+            if data['station_type'] in ('check in', 'check out'):\n                 raise ObjectNotFound(\n                     {'parameter': 'microlocation'},\n                     \"Microlocation: missing from your request.\",\n", "issue": "allow mutiple station for same location\n<!--\r\n(Thanks for sending a pull request! Please make sure you click the link above to view the contribution guidelines, then fill out the blanks below.)\r\n-->\r\n<!-- Add the issue number that is fixed by this PR (In the form Fixes #123) -->\r\n\r\nFixes #8958 \r\n\r\n#### Short description of what this resolves:\r\n- fix issue to allow mutiple station for same location\r\n\r\n#### Changes proposed in this pull request:\r\n\r\n- allow mutiple station for same location\r\n\r\n#### Checklist\r\n\r\n- [x] I have read the [Contribution & Best practices Guide](https://blog.fossasia.org/open-source-developer-guide-and-best-practices-at-fossasia) and my PR follows them.\r\n- [x] My branch is up-to-date with the Upstream `development` branch.\r\n- [ ] The unit tests pass locally with my changes <!-- use `nosetests tests/` to run all the tests -->\r\n- [ ] I have added tests that prove my fix is effective or that my feature works\r\n- [ ] I have added necessary documentation (if appropriate)\r\n<!-- If an existing function does not have a docstring, please add one -->\r\n- [ ] All the functions created/modified in this PR contain relevant docstrings.\r\n\n", "before_files": [{"content": "from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship\nfrom flask_rest_jsonapi.exceptions import ObjectNotFound\n\nfrom app.api.helpers.db import safe_query_kwargs\nfrom app.api.helpers.permission_manager import has_access\nfrom app.api.helpers.permissions import jwt_required\nfrom app.api.helpers.utilities import require_relationship\nfrom app.api.schema.station import StationSchema\nfrom app.models import db\nfrom app.models.event import Event\nfrom app.models.microlocation import Microlocation\nfrom app.models.station import Station\n\n\nclass StationList(ResourceList):\n    \"\"\"Create and List Station\"\"\"\n\n    def query(self, view_kwargs):\n        \"\"\"\n        query method for different view_kwargs\n        :param view_kwargs:\n        :return:\n        \"\"\"\n        query_ = self.session.query(Station)\n        if view_kwargs.get('event_id'):\n            event = safe_query_kwargs(Event, view_kwargs, 'event_id')\n            query_ = query_.filter_by(event_id=event.id)\n\n        elif view_kwargs.get('microlocation_id'):\n            event = safe_query_kwargs(Microlocation, view_kwargs, 'microlocation_id')\n            query_ = query_.filter_by(microlocation_id=event.id)\n\n        return query_\n\n    view_kwargs = True\n    schema = StationSchema\n    data_layer = {\n        'session': db.session,\n        'model': Station,\n        'methods': {'query': query},\n    }\n\n\nclass StationDetail(ResourceDetail):\n    \"\"\"Station detail by id\"\"\"\n\n    @staticmethod\n    def before_patch(args, kwargs, data):\n        \"\"\"\n        before patch method\n        :param args:\n        :param kwargs:\n        :param data:\n        :return:\n        \"\"\"\n        require_relationship(['event'], data)\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ObjectNotFound(\n                {'parameter': 'event'},\n                f\"Event: {data['event']} not found {args} {kwargs}\",\n            )\n\n        if data.get('microlocation'):\n            require_relationship(['microlocation'], data)\n        else:\n            if data['station_type'] in ('check in', 'check out', 'daily'):\n                raise ObjectNotFound(\n                    {'parameter': 'microlocation'},\n                    \"Microlocation: microlocation_id is missing from your request.\",\n                )\n\n    schema = StationSchema\n    data_layer = {\n        'session': db.session,\n        'model': Station,\n    }\n\n\nclass StationRelationship(ResourceRelationship):\n    \"\"\"Station Relationship (Required)\"\"\"\n\n    decorators = (jwt_required,)\n    methods = ['GET', 'PATCH']\n    schema = StationSchema\n    data_layer = {'session': db.session, 'model': Station}\n\n\nclass StationListPost(ResourceList):\n    \"\"\"Create and List Station\"\"\"\n\n    @staticmethod\n    def before_post(args, kwargs, data):\n        \"\"\"\n        method to check for required relationship with event and microlocation\n        :param data:\n        :param args:\n        :param kwargs:\n        :return:\n        \"\"\"\n        require_relationship(['event'], data)\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ObjectNotFound(\n                {'parameter': 'event'},\n                f\"Event: {data['event']} not found {args} {kwargs}\",\n            )\n\n        if data.get('microlocation'):\n            require_relationship(['microlocation'], data)\n        else:\n            if data['station_type'] in ('check in', 'check out', 'daily'):\n                raise ObjectNotFound(\n                    {'parameter': 'microlocation'},\n                    \"Microlocation: missing from your request.\",\n                )\n\n    schema = StationSchema\n    methods = [\n        'POST',\n    ]\n    data_layer = {\n        'session': db.session,\n        'model': Station,\n    }\n", "path": "app/api/station.py"}], "after_files": [{"content": "from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship\nfrom flask_rest_jsonapi.exceptions import ObjectNotFound\n\nfrom app.api.helpers.db import safe_query_kwargs\nfrom app.api.helpers.permission_manager import has_access\nfrom app.api.helpers.permissions import jwt_required\nfrom app.api.helpers.utilities import require_relationship\nfrom app.api.schema.station import StationSchema\nfrom app.models import db\nfrom app.models.event import Event\nfrom app.models.microlocation import Microlocation\nfrom app.models.station import Station\n\n\nclass StationList(ResourceList):\n    \"\"\"Create and List Station\"\"\"\n\n    def query(self, view_kwargs):\n        \"\"\"\n        query method for different view_kwargs\n        :param view_kwargs:\n        :return:\n        \"\"\"\n        query_ = self.session.query(Station)\n        if view_kwargs.get('event_id'):\n            event = safe_query_kwargs(Event, view_kwargs, 'event_id')\n            query_ = query_.filter_by(event_id=event.id)\n\n        elif view_kwargs.get('microlocation_id'):\n            event = safe_query_kwargs(Microlocation, view_kwargs, 'microlocation_id')\n            query_ = query_.filter_by(microlocation_id=event.id)\n\n        return query_\n\n    view_kwargs = True\n    schema = StationSchema\n    data_layer = {\n        'session': db.session,\n        'model': Station,\n        'methods': {'query': query},\n    }\n\n\nclass StationDetail(ResourceDetail):\n    \"\"\"Station detail by id\"\"\"\n\n    @staticmethod\n    def before_patch(args, kwargs, data):\n        \"\"\"\n        before patch method\n        :param args:\n        :param kwargs:\n        :param data:\n        :return:\n        \"\"\"\n        require_relationship(['event'], data)\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ObjectNotFound(\n                {'parameter': 'event'},\n                f\"Event: {data['event']} not found {args} {kwargs}\",\n            )\n\n        if data.get('microlocation'):\n            require_relationship(['microlocation'], data)\n        else:\n            if data['station_type'] in ('check in', 'check out'):\n                raise ObjectNotFound(\n                    {'parameter': 'microlocation'},\n                    \"Microlocation: microlocation_id is missing from your request.\",\n                )\n\n    schema = StationSchema\n    data_layer = {\n        'session': db.session,\n        'model': Station,\n    }\n\n\nclass StationRelationship(ResourceRelationship):\n    \"\"\"Station Relationship (Required)\"\"\"\n\n    decorators = (jwt_required,)\n    methods = ['GET', 'PATCH']\n    schema = StationSchema\n    data_layer = {'session': db.session, 'model': Station}\n\n\nclass StationListPost(ResourceList):\n    \"\"\"Create and List Station\"\"\"\n\n    @staticmethod\n    def before_post(args, kwargs, data):\n        \"\"\"\n        method to check for required relationship with event and microlocation\n        :param data:\n        :param args:\n        :param kwargs:\n        :return:\n        \"\"\"\n        require_relationship(['event'], data)\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ObjectNotFound(\n                {'parameter': 'event'},\n                f\"Event: {data['event']} not found {args} {kwargs}\",\n            )\n\n        if data.get('microlocation'):\n            require_relationship(['microlocation'], data)\n        else:\n            if data['station_type'] in ('check in', 'check out'):\n                raise ObjectNotFound(\n                    {'parameter': 'microlocation'},\n                    \"Microlocation: missing from your request.\",\n                )\n\n    schema = StationSchema\n    methods = [\n        'POST',\n    ]\n    data_layer = {\n        'session': db.session,\n        'model': Station,\n    }\n", "path": "app/api/station.py"}]}