|
11 | 11 | from app.api.helpers.permission_manager import has_access |
12 | 12 | from app.api.helpers.permissions import jwt_required |
13 | 13 | from app.api.helpers.query import event_query |
14 | | -from app.api.helpers.utilities import require_relationship |
15 | 14 | from app.api.schema.attendees import AttendeeSchema |
16 | 15 | from app.models import db |
17 | 16 | from app.models.order import Order |
@@ -51,67 +50,6 @@ def get_sold_and_reserved_tickets_count(ticket_id): |
51 | 50 | ) |
52 | 51 |
|
53 | 52 |
|
54 | | -class AttendeeListPost(ResourceList): |
55 | | - """ |
56 | | - List and create Attendees through direct URL |
57 | | - """ |
58 | | - |
59 | | - def before_post(self, args, kwargs, data): |
60 | | - """ |
61 | | - Before post method to check for required relationship and proper permissions |
62 | | - :param args: |
63 | | - :param kwargs: |
64 | | - :param data: |
65 | | - :return: |
66 | | - """ |
67 | | - require_relationship(['ticket', 'event'], data) |
68 | | - |
69 | | - ticket = ( |
70 | | - db.session.query(Ticket) |
71 | | - .filter_by(id=int(data['ticket']), deleted_at=None) |
72 | | - .first() |
73 | | - ) |
74 | | - if ticket is None: |
75 | | - raise UnprocessableEntityError( |
76 | | - {'pointer': '/data/relationships/ticket'}, "Invalid Ticket" |
77 | | - ) |
78 | | - if ticket.event_id != int(data['event']): |
79 | | - raise UnprocessableEntityError( |
80 | | - {'pointer': '/data/relationships/ticket'}, |
81 | | - "Ticket belongs to a different Event", |
82 | | - ) |
83 | | - # Check if the ticket is already sold out or not. |
84 | | - ticket.raise_if_unavailable() |
85 | | - |
86 | | - if 'device_name_checkin' in data and data['device_name_checkin'] is not None: |
87 | | - if 'is_checked_in' not in data or not data['is_checked_in']: |
88 | | - raise UnprocessableEntityError( |
89 | | - {'pointer': '/data/attributes/device_name_checkin'}, |
90 | | - "Attendee needs to be checked in first", |
91 | | - ) |
92 | | - if 'checkin_times' not in data or data['checkin_times'] is None: |
93 | | - raise UnprocessableEntityError( |
94 | | - {'pointer': '/data/attributes/device_name_checkin'}, |
95 | | - "Check in Times missing", |
96 | | - ) |
97 | | - if len(data['checkin_times'].split(",")) != len( |
98 | | - data['device_name_checkin'].split(",") |
99 | | - ): |
100 | | - raise UnprocessableEntityError( |
101 | | - {'pointer': '/data/attributes/device_name_checkin'}, |
102 | | - "Check in Times missing for the corresponding device name", |
103 | | - ) |
104 | | - |
105 | | - if 'checkin_times' in data: |
106 | | - if 'device_name_checkin' not in data or data['device_name_checkin'] is None: |
107 | | - data['device_name_checkin'] = '-' |
108 | | - |
109 | | - decorators = (jwt_required,) |
110 | | - methods = ['POST'] |
111 | | - schema = AttendeeSchema |
112 | | - data_layer = {'session': db.session, 'model': TicketHolder} |
113 | | - |
114 | | - |
115 | 53 | class AttendeeList(ResourceList): |
116 | 54 | """ |
117 | 55 | List Attendees |
|
0 commit comments