We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Ticket-tag: remove GET for /ticket-tags 
Parent issue #4101.
Related issue: #4119.

Make `/ticket-tags` POST only.

--- 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/ticket_tags.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 from sqlalchemy.orm.exc import NoResultFound
5 from flask_rest_jsonapi.exceptions import ObjectNotFound
6 
7 from app.api.helpers.utilities import dasherize
8 from app.api.helpers.permissions import jwt_required
9 from app.models import db
10 from app.models.ticket import Ticket, TicketTag, ticket_tags_table
11 from app.models.event import Event
12 from app.api.helpers.db import safe_query
13 from app.api.helpers.utilities import require_relationship
14 from app.api.helpers.exceptions import ForbiddenException
15 from app.api.helpers.permission_manager import has_access
16 
17 
18 class TicketTagSchema(Schema):
19     """
20     Api schema for TicketTag Model
21     """
22 
23     class Meta:
24         """
25         Meta class for TicketTag Api Schema
26         """
27         type_ = 'ticket-tag'
28         self_view = 'v1.ticket_tag_detail'
29         self_view_kwargs = {'id': '<id>'}
30         inflect = dasherize
31 
32     id = fields.Str(dump_only=True)
33     name = fields.Str(allow_none=True)
34     tickets = Relationship(attribute='tickets',
35                            self_view='v1.ticket_tag_ticket',
36                            self_view_kwargs={'id': '<id>'},
37                            related_view='v1.ticket_list',
38                            related_view_kwargs={'ticket_tag_id': '<id>'},
39                            schema='TicketSchema',
40                            many=True,
41                            type_='ticket')
42     event = Relationship(attribute='event',
43                          self_view='v1.ticket_tag_event',
44                          self_view_kwargs={'id': '<id>'},
45                          related_view='v1.event_detail',
46                          related_view_kwargs={'ticket_tag_id': '<id>'},
47                          schema='EventSchema',
48                          type_='event')
49 
50 
51 class TicketTagListPost(ResourceList):
52     """
53     List and create TicketTag
54     """
55     def before_post(self, args, kwargs, data):
56         """
57         before post method for checking required relationship
58         :param args:
59         :param kwargs:
60         :param data:
61         :return:
62         """
63         require_relationship(['event'], data)
64 
65         if not has_access('is_coorganizer', event_id=data['event']):
66             raise ForbiddenException({'source': ''}, 'Co-organizer access is required.')
67 
68     def after_create_object(self, obj, data, view_kwargs):
69         """
70         method to add ticket tags and ticket in association table
71         :param obj:
72         :param data:
73         :param view_kwargs:
74         :return:
75         """
76         if 'tickets' in data:
77             ticket_ids = data['tickets']
78             for ticket_id in ticket_ids:
79                 try:
80                     ticket = Ticket.query.filter_by(id=ticket_id).one()
81                 except NoResultFound:
82                     raise ObjectNotFound({'parameter': 'ticket_id'},
83                                          "Ticket: {} not found".format(ticket_id))
84                 else:
85                     ticket.tags.append(obj)
86                     self.session.commit()
87 
88     schema = TicketTagSchema
89     data_layer = {'session': db.session,
90                   'model': TicketTag,
91                   'methods': {
92                     'after_create_object': after_create_object
93                   }}
94 
95 
96 class TicketTagList(ResourceList):
97     """
98     List TicketTags based on event_id or ticket_id
99     """
100     def query(self, view_kwargs):
101         """
102         method to query Ticket tags based on different params
103         :param view_kwargs:
104         :return:
105         """
106         query_ = self.session.query(TicketTag)
107         if view_kwargs.get('ticket_id'):
108             ticket = safe_query(self, Ticket, 'id', view_kwargs['ticket_id'], 'ticket_id')
109             query_ = query_.join(ticket_tags_table).filter_by(ticket_id=ticket.id)
110         if view_kwargs.get('event_id'):
111             event = safe_query(self, Event, 'id', view_kwargs['event_id'], 'event_id')
112             query_ = query_.join(Event).filter(Event.id == event.id)
113         elif view_kwargs.get('event_identifier'):
114             event = safe_query(self, Event, 'identifier', view_kwargs['event_identifier'], 'event_identifier')
115             query_ = query_.join(Event).filter(Event.id == event.id)
116         return query_
117 
118     view_kwargs = True
119     schema = TicketTagSchema
120     methods = ['GET', ]
121     data_layer = {'session': db.session,
122                   'model': TicketTag,
123                   'methods': {
124                       'query': query
125                   }}
126 
127 
128 class TicketTagDetail(ResourceDetail):
129     """
130     TicketTag detail by id
131     """
132     decorators = (jwt_required,)
133     schema = TicketTagSchema
134     data_layer = {'session': db.session,
135                   'model': TicketTag}
136 
137 
138 class TicketTagRelationshipRequired(ResourceRelationship):
139     """
140     TicketTag Relationship
141     """
142     decorators = (jwt_required,)
143     methods = ['GET', 'PATCH']
144     schema = TicketTagSchema
145     data_layer = {'session': db.session,
146                   'model': TicketTag}
147 
148 
149 class TicketTagRelationshipOptional(ResourceRelationship):
150     """
151     TicketTag Relationship
152     """
153     decorators = (jwt_required,)
154     schema = TicketTagSchema
155     data_layer = {'session': db.session,
156                   'model': TicketTag}
157
```
--- 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/ticket_tags.py b/app/api/ticket_tags.py
--- a/app/api/ticket_tags.py
+++ b/app/api/ticket_tags.py
@@ -1,8 +1,6 @@
 from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship
 from marshmallow_jsonapi.flask import Schema, Relationship
 from marshmallow_jsonapi import fields
-from sqlalchemy.orm.exc import NoResultFound
-from flask_rest_jsonapi.exceptions import ObjectNotFound
 
 from app.api.helpers.utilities import dasherize
 from app.api.helpers.permissions import jwt_required
@@ -65,32 +63,10 @@
         if not has_access('is_coorganizer', event_id=data['event']):
             raise ForbiddenException({'source': ''}, 'Co-organizer access is required.')
 
-    def after_create_object(self, obj, data, view_kwargs):
-        """
-        method to add ticket tags and ticket in association table
-        :param obj:
-        :param data:
-        :param view_kwargs:
-        :return:
-        """
-        if 'tickets' in data:
-            ticket_ids = data['tickets']
-            for ticket_id in ticket_ids:
-                try:
-                    ticket = Ticket.query.filter_by(id=ticket_id).one()
-                except NoResultFound:
-                    raise ObjectNotFound({'parameter': 'ticket_id'},
-                                         "Ticket: {} not found".format(ticket_id))
-                else:
-                    ticket.tags.append(obj)
-                    self.session.commit()
-
     schema = TicketTagSchema
+    methods = ['POST', ]
     data_layer = {'session': db.session,
-                  'model': TicketTag,
-                  'methods': {
-                    'after_create_object': after_create_object
-                  }}
+                  'model': TicketTag}
 
 
 class TicketTagList(ResourceList):

{"golden_diff": "diff --git a/app/api/ticket_tags.py b/app/api/ticket_tags.py\n--- a/app/api/ticket_tags.py\n+++ b/app/api/ticket_tags.py\n@@ -1,8 +1,6 @@\n from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship\n from marshmallow_jsonapi.flask import Schema, Relationship\n from marshmallow_jsonapi import fields\n-from sqlalchemy.orm.exc import NoResultFound\n-from flask_rest_jsonapi.exceptions import ObjectNotFound\n \n from app.api.helpers.utilities import dasherize\n from app.api.helpers.permissions import jwt_required\n@@ -65,32 +63,10 @@\n         if not has_access('is_coorganizer', event_id=data['event']):\n             raise ForbiddenException({'source': ''}, 'Co-organizer access is required.')\n \n-    def after_create_object(self, obj, data, view_kwargs):\n-        \"\"\"\n-        method to add ticket tags and ticket in association table\n-        :param obj:\n-        :param data:\n-        :param view_kwargs:\n-        :return:\n-        \"\"\"\n-        if 'tickets' in data:\n-            ticket_ids = data['tickets']\n-            for ticket_id in ticket_ids:\n-                try:\n-                    ticket = Ticket.query.filter_by(id=ticket_id).one()\n-                except NoResultFound:\n-                    raise ObjectNotFound({'parameter': 'ticket_id'},\n-                                         \"Ticket: {} not found\".format(ticket_id))\n-                else:\n-                    ticket.tags.append(obj)\n-                    self.session.commit()\n-\n     schema = TicketTagSchema\n+    methods = ['POST', ]\n     data_layer = {'session': db.session,\n-                  'model': TicketTag,\n-                  'methods': {\n-                    'after_create_object': after_create_object\n-                  }}\n+                  'model': TicketTag}\n \n \n class TicketTagList(ResourceList):\n", "issue": "Ticket-tag: remove GET for /ticket-tags \nParent issue #4101.\r\nRelated issue: #4119.\r\n\r\nMake `/ticket-tags` POST only.\n", "before_files": [{"content": "from flask_rest_jsonapi import ResourceDetail, ResourceList, ResourceRelationship\nfrom marshmallow_jsonapi.flask import Schema, Relationship\nfrom marshmallow_jsonapi import fields\nfrom sqlalchemy.orm.exc import NoResultFound\nfrom flask_rest_jsonapi.exceptions import ObjectNotFound\n\nfrom app.api.helpers.utilities import dasherize\nfrom app.api.helpers.permissions import jwt_required\nfrom app.models import db\nfrom app.models.ticket import Ticket, TicketTag, ticket_tags_table\nfrom app.models.event import Event\nfrom app.api.helpers.db import safe_query\nfrom app.api.helpers.utilities import require_relationship\nfrom app.api.helpers.exceptions import ForbiddenException\nfrom app.api.helpers.permission_manager import has_access\n\n\nclass TicketTagSchema(Schema):\n    \"\"\"\n    Api schema for TicketTag Model\n    \"\"\"\n\n    class Meta:\n        \"\"\"\n        Meta class for TicketTag Api Schema\n        \"\"\"\n        type_ = 'ticket-tag'\n        self_view = 'v1.ticket_tag_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    id = fields.Str(dump_only=True)\n    name = fields.Str(allow_none=True)\n    tickets = Relationship(attribute='tickets',\n                           self_view='v1.ticket_tag_ticket',\n                           self_view_kwargs={'id': '<id>'},\n                           related_view='v1.ticket_list',\n                           related_view_kwargs={'ticket_tag_id': '<id>'},\n                           schema='TicketSchema',\n                           many=True,\n                           type_='ticket')\n    event = Relationship(attribute='event',\n                         self_view='v1.ticket_tag_event',\n                         self_view_kwargs={'id': '<id>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'ticket_tag_id': '<id>'},\n                         schema='EventSchema',\n                         type_='event')\n\n\nclass TicketTagListPost(ResourceList):\n    \"\"\"\n    List and create TicketTag\n    \"\"\"\n    def before_post(self, args, kwargs, data):\n        \"\"\"\n        before post method for checking required relationship\n        :param args:\n        :param kwargs:\n        :param data:\n        :return:\n        \"\"\"\n        require_relationship(['event'], data)\n\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ForbiddenException({'source': ''}, 'Co-organizer access is required.')\n\n    def after_create_object(self, obj, data, view_kwargs):\n        \"\"\"\n        method to add ticket tags and ticket in association table\n        :param obj:\n        :param data:\n        :param view_kwargs:\n        :return:\n        \"\"\"\n        if 'tickets' in data:\n            ticket_ids = data['tickets']\n            for ticket_id in ticket_ids:\n                try:\n                    ticket = Ticket.query.filter_by(id=ticket_id).one()\n                except NoResultFound:\n                    raise ObjectNotFound({'parameter': 'ticket_id'},\n                                         \"Ticket: {} not found\".format(ticket_id))\n                else:\n                    ticket.tags.append(obj)\n                    self.session.commit()\n\n    schema = TicketTagSchema\n    data_layer = {'session': db.session,\n                  'model': TicketTag,\n                  'methods': {\n                    'after_create_object': after_create_object\n                  }}\n\n\nclass TicketTagList(ResourceList):\n    \"\"\"\n    List TicketTags based on event_id or ticket_id\n    \"\"\"\n    def query(self, view_kwargs):\n        \"\"\"\n        method to query Ticket tags based on different params\n        :param view_kwargs:\n        :return:\n        \"\"\"\n        query_ = self.session.query(TicketTag)\n        if view_kwargs.get('ticket_id'):\n            ticket = safe_query(self, Ticket, 'id', view_kwargs['ticket_id'], 'ticket_id')\n            query_ = query_.join(ticket_tags_table).filter_by(ticket_id=ticket.id)\n        if view_kwargs.get('event_id'):\n            event = safe_query(self, Event, 'id', view_kwargs['event_id'], 'event_id')\n            query_ = query_.join(Event).filter(Event.id == event.id)\n        elif view_kwargs.get('event_identifier'):\n            event = safe_query(self, Event, 'identifier', view_kwargs['event_identifier'], 'event_identifier')\n            query_ = query_.join(Event).filter(Event.id == event.id)\n        return query_\n\n    view_kwargs = True\n    schema = TicketTagSchema\n    methods = ['GET', ]\n    data_layer = {'session': db.session,\n                  'model': TicketTag,\n                  'methods': {\n                      'query': query\n                  }}\n\n\nclass TicketTagDetail(ResourceDetail):\n    \"\"\"\n    TicketTag detail by id\n    \"\"\"\n    decorators = (jwt_required,)\n    schema = TicketTagSchema\n    data_layer = {'session': db.session,\n                  'model': TicketTag}\n\n\nclass TicketTagRelationshipRequired(ResourceRelationship):\n    \"\"\"\n    TicketTag Relationship\n    \"\"\"\n    decorators = (jwt_required,)\n    methods = ['GET', 'PATCH']\n    schema = TicketTagSchema\n    data_layer = {'session': db.session,\n                  'model': TicketTag}\n\n\nclass TicketTagRelationshipOptional(ResourceRelationship):\n    \"\"\"\n    TicketTag Relationship\n    \"\"\"\n    decorators = (jwt_required,)\n    schema = TicketTagSchema\n    data_layer = {'session': db.session,\n                  'model': TicketTag}\n", "path": "app/api/ticket_tags.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.helpers.utilities import dasherize\nfrom app.api.helpers.permissions import jwt_required\nfrom app.models import db\nfrom app.models.ticket import Ticket, TicketTag, ticket_tags_table\nfrom app.models.event import Event\nfrom app.api.helpers.db import safe_query\nfrom app.api.helpers.utilities import require_relationship\nfrom app.api.helpers.exceptions import ForbiddenException\nfrom app.api.helpers.permission_manager import has_access\n\n\nclass TicketTagSchema(Schema):\n    \"\"\"\n    Api schema for TicketTag Model\n    \"\"\"\n\n    class Meta:\n        \"\"\"\n        Meta class for TicketTag Api Schema\n        \"\"\"\n        type_ = 'ticket-tag'\n        self_view = 'v1.ticket_tag_detail'\n        self_view_kwargs = {'id': '<id>'}\n        inflect = dasherize\n\n    id = fields.Str(dump_only=True)\n    name = fields.Str(allow_none=True)\n    tickets = Relationship(attribute='tickets',\n                           self_view='v1.ticket_tag_ticket',\n                           self_view_kwargs={'id': '<id>'},\n                           related_view='v1.ticket_list',\n                           related_view_kwargs={'ticket_tag_id': '<id>'},\n                           schema='TicketSchema',\n                           many=True,\n                           type_='ticket')\n    event = Relationship(attribute='event',\n                         self_view='v1.ticket_tag_event',\n                         self_view_kwargs={'id': '<id>'},\n                         related_view='v1.event_detail',\n                         related_view_kwargs={'ticket_tag_id': '<id>'},\n                         schema='EventSchema',\n                         type_='event')\n\n\nclass TicketTagListPost(ResourceList):\n    \"\"\"\n    List and create TicketTag\n    \"\"\"\n    def before_post(self, args, kwargs, data):\n        \"\"\"\n        before post method for checking required relationship\n        :param args:\n        :param kwargs:\n        :param data:\n        :return:\n        \"\"\"\n        require_relationship(['event'], data)\n\n        if not has_access('is_coorganizer', event_id=data['event']):\n            raise ForbiddenException({'source': ''}, 'Co-organizer access is required.')\n\n    schema = TicketTagSchema\n    methods = ['POST', ]\n    data_layer = {'session': db.session,\n                  'model': TicketTag}\n\n\nclass TicketTagList(ResourceList):\n    \"\"\"\n    List TicketTags based on event_id or ticket_id\n    \"\"\"\n    def query(self, view_kwargs):\n        \"\"\"\n        method to query Ticket tags based on different params\n        :param view_kwargs:\n        :return:\n        \"\"\"\n        query_ = self.session.query(TicketTag)\n        if view_kwargs.get('ticket_id'):\n            ticket = safe_query(self, Ticket, 'id', view_kwargs['ticket_id'], 'ticket_id')\n            query_ = query_.join(ticket_tags_table).filter_by(ticket_id=ticket.id)\n        if view_kwargs.get('event_id'):\n            event = safe_query(self, Event, 'id', view_kwargs['event_id'], 'event_id')\n            query_ = query_.join(Event).filter(Event.id == event.id)\n        elif view_kwargs.get('event_identifier'):\n            event = safe_query(self, Event, 'identifier', view_kwargs['event_identifier'], 'event_identifier')\n            query_ = query_.join(Event).filter(Event.id == event.id)\n        return query_\n\n    view_kwargs = True\n    schema = TicketTagSchema\n    methods = ['GET', ]\n    data_layer = {'session': db.session,\n                  'model': TicketTag,\n                  'methods': {\n                      'query': query\n                  }}\n\n\nclass TicketTagDetail(ResourceDetail):\n    \"\"\"\n    TicketTag detail by id\n    \"\"\"\n    decorators = (jwt_required,)\n    schema = TicketTagSchema\n    data_layer = {'session': db.session,\n                  'model': TicketTag}\n\n\nclass TicketTagRelationshipRequired(ResourceRelationship):\n    \"\"\"\n    TicketTag Relationship\n    \"\"\"\n    decorators = (jwt_required,)\n    methods = ['GET', 'PATCH']\n    schema = TicketTagSchema\n    data_layer = {'session': db.session,\n                  'model': TicketTag}\n\n\nclass TicketTagRelationshipOptional(ResourceRelationship):\n    \"\"\"\n    TicketTag Relationship\n    \"\"\"\n    decorators = (jwt_required,)\n    schema = TicketTagSchema\n    data_layer = {'session': db.session,\n                  'model': TicketTag}\n", "path": "app/api/ticket_tags.py"}]}