Repository: fossasia/open-event-server

Issue:
Remove deprecated Attendee Creation Endpoint
Now attendee creation is controlled through create order API, and hence the Attendee Creation Endpoint must be removed


Discussion:
@iamareebjamal Can I work on this
To be done when everything is tested on web and migrated in Android
@iamareebjamal This issue is good to go now, right?
No, Android apps haven't been updated yet 
Is this issue available, if yes then can I work on this issue @iamareebjamal @mariobehling 
@iamareebjamal is this issue active? :sweat_smile: 
https://github.com/fossasia/open-event-server/issues/7105#issuecomment-674539683
I wann work on thid issue. please assign this to me and since im new to this repo so please guide me through
We don't assign issues to external contributors. Please comment that you're working on the issue after checking that no one else is, and then send a pull request for it. Thank You!
external contributors means

working on this

Resolving patch:
diff --git a/app/api/attendees.py b/app/api/attendees.py
--- a/app/api/attendees.py
+++ b/app/api/attendees.py
@@ -11,7 +11,6 @@
 from app.api.helpers.permission_manager import has_access
 from app.api.helpers.permissions import jwt_required
 from app.api.helpers.query import event_query
-from app.api.helpers.utilities import require_relationship
 from app.api.schema.attendees import AttendeeSchema
 from app.models import db
 from app.models.order import Order
@@ -51,67 +50,6 @@ def get_sold_and_reserved_tickets_count(ticket_id):
     )
 
 
-class AttendeeListPost(ResourceList):
-    """
-    List and create Attendees through direct URL
-    """
-
-    def before_post(self, args, kwargs, data):
-        """
-        Before post method to check for required relationship and proper permissions
-        :param args:
-        :param kwargs:
-        :param data:
-        :return:
-        """
-        require_relationship(['ticket', 'event'], data)
-
-        ticket = (
-            db.session.query(Ticket)
-            .filter_by(id=int(data['ticket']), deleted_at=None)
-            .first()
-        )
-        if ticket is None:
-            raise UnprocessableEntityError(
-                {'pointer': '/data/relationships/ticket'}, "Invalid Ticket"
-            )
-        if ticket.event_id != int(data['event']):
-            raise UnprocessableEntityError(
-                {'pointer': '/data/relationships/ticket'},
-                "Ticket belongs to a different Event",
-            )
-        # Check if the ticket is already sold out or not.
-        ticket.raise_if_unavailable()
-
-        if 'device_name_checkin' in data and data['device_name_checkin'] is not None:
-            if 'is_checked_in' not in data or not data['is_checked_in']:
-                raise UnprocessableEntityError(
-                    {'pointer': '/data/attributes/device_name_checkin'},
-                    "Attendee needs to be checked in first",
-                )
-            if 'checkin_times' not in data or data['checkin_times'] is None:
-                raise UnprocessableEntityError(
-                    {'pointer': '/data/attributes/device_name_checkin'},
-                    "Check in Times missing",
-                )
-            if len(data['checkin_times'].split(",")) != len(
-                data['device_name_checkin'].split(",")
-            ):
-                raise UnprocessableEntityError(
-                    {'pointer': '/data/attributes/device_name_checkin'},
-                    "Check in Times missing for the corresponding device name",
-                )
-
-        if 'checkin_times' in data:
-            if 'device_name_checkin' not in data or data['device_name_checkin'] is None:
-                data['device_name_checkin'] = '-'
-
-    decorators = (jwt_required,)
-    methods = ['POST']
-    schema = AttendeeSchema
-    data_layer = {'session': db.session, 'model': TicketHolder}
-
-
 class AttendeeList(ResourceList):
     """
     List Attendees
diff --git a/app/api/routes.py b/app/api/routes.py
--- a/app/api/routes.py
+++ b/app/api/routes.py
@@ -21,7 +21,6 @@
 from app.api.attendees import (
     AttendeeDetail,
     AttendeeList,
-    AttendeeListPost,
     AttendeeRelationshipOptional,
     AttendeeRelationshipRequired,
 )
@@ -1501,7 +1500,6 @@
 )
 
 # attendees
-api.route(AttendeeListPost, 'attendee_list_post', '/attendees')
 api.route(
     AttendeeList,
     'attendee_list',
diff --git a/app/api/schema/tickets.py b/app/api/schema/tickets.py
--- a/app/api/schema/tickets.py
+++ b/app/api/schema/tickets.py
@@ -179,8 +179,6 @@ class Meta:
     attendees = Relationship(
         self_view='v1.ticket_attendees',
         self_view_kwargs={'id': '<id>'},
-        related_view='v1.attendee_list_post',
-        related_view_kwargs={'ticket_id': '<id>'},
         schema='AttendeeSchema',
         many=True,
         type_='attendee',


Test patch:
diff --git a/tests/all/integration/api/attendee/test_attendee_access_api.py b/tests/all/integration/api/attendee/test_attendee_access_api.py
--- a/tests/all/integration/api/attendee/test_attendee_access_api.py
+++ b/tests/all/integration/api/attendee/test_attendee_access_api.py
@@ -23,7 +23,7 @@ def test_get_attendees_error(db, client, user, jwt, admin_user, admin_jwt):
 
     response = client.get('/v1/attendees', content_type='application/vnd.api+json')
 
-    assert response.status_code == 405
+    assert response.status_code == 404
 
     response = client.get(
         '/v1/attendees',
@@ -31,7 +31,7 @@ def test_get_attendees_error(db, client, user, jwt, admin_user, admin_jwt):
         headers=jwt,
     )
 
-    assert response.status_code == 405
+    assert response.status_code == 404
 
     get_minimal_attendee(db, user, owner=True)
 
@@ -41,7 +41,7 @@ def test_get_attendees_error(db, client, user, jwt, admin_user, admin_jwt):
         headers=jwt,
     )
 
-    assert response.status_code == 405
+    assert response.status_code == 404
 
     get_minimal_attendee(db, admin_user, owner=True)
 
@@ -51,7 +51,7 @@ def test_get_attendees_error(db, client, user, jwt, admin_user, admin_jwt):
         headers=admin_jwt,
     )
 
-    assert response.status_code == 405
+    assert response.status_code == 404
 
 
 def test_get_event_attendees_owner(db, client, user, jwt):