Skip to content

Commit

Permalink
fix: Removing is_ticketing_enabled from event models (fossasia#6634)
Browse files Browse the repository at this point in the history
  • Loading branch information
kushthedude authored and codedsun committed Dec 22, 2019
1 parent 3cb56af commit 1b0cf55
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 39 deletions.
4 changes: 2 additions & 2 deletions app/api/events.py
Expand Up @@ -56,8 +56,8 @@ def validate_event(user, modules, data):
if not user.can_create_event():
raise ForbiddenException({'source': ''},
"Please verify your Email")
elif data.get('is_ticketing_enabled', True) and not modules.ticket_include:
raise ForbiddenException({'source': '/data/attributes/is-ticketing-enabled'},
elif not modules.ticket_include:
raise ForbiddenException({'source': ''},
"Ticketing is not enabled in the system")
if data.get('can_pay_by_paypal', False) or data.get('can_pay_by_cheque', False) or \
data.get('can_pay_by_bank', False) or data.get('can_pay_by_stripe', False):
Expand Down
1 change: 0 additions & 1 deletion app/api/schema/events.py
Expand Up @@ -72,7 +72,6 @@ def validate_timezone(self, data, original_data):
ticket_url = fields.Url(allow_none=True)
code_of_conduct = fields.Str(allow_none=True)
schedule_published_on = fields.DateTime(allow_none=True)
is_ticketing_enabled = fields.Bool(default=False)
is_featured = fields.Bool(default=False)
is_ticket_form_enabled = fields.Bool(default=True)
payment_country = fields.Str(allow_none=True)
Expand Down
3 changes: 0 additions & 3 deletions app/api/tickets.py
Expand Up @@ -41,9 +41,6 @@ def before_post(self, args, kwargs, data):
deleted_at=None)) > 0:
raise ConflictException({'pointer': '/data/attributes/name'}, "Ticket already exists")

if get_count(db.session.query(Event).filter_by(id=int(data['event']), is_ticketing_enabled=False)) > 0:
raise MethodNotAllowed({'parameter': 'event_id'}, "Ticketing is disabled for this Event")

def before_create_object(self, data, view_kwargs):
"""
before create method to check if paid ticket has a paymentMethod enabled
Expand Down
33 changes: 0 additions & 33 deletions docs/api/blueprint/event/events.apib
Expand Up @@ -25,7 +25,6 @@ These endpoints help you to create the basic event structure. To add other parts
| `sub-topic` | Sub-topic of the event | string | - |
| `ticket-url` | The ticketing URL of the event | string | - |
| `code-of-conduct` | Event's code of conduct | string | - |
| `is-ticketing-enabled` | Does the event use Open Event ticketing system | boolean (default: `true`) | - |
| `thumbnail-image-url` | URL of the uploaded thumbnail | string | - |
| `large-image-url` | URL of the large uploaded banner image | string | - |
| `original-image-url` | URL of the original image | string | - |
Expand Down Expand Up @@ -272,7 +271,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "example",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"can-pay-by-omise": false,
"description": "example",
Expand Down Expand Up @@ -346,7 +344,6 @@ Create a new event using a `name`, `starts-at`, `ends-at`, `timezone` and an opt
"average-rating": null,
"ticket-url": "http://example.com",
"code-of-conduct": "example",
"is-ticketing-enabled": "false",
"payment-country": "US",
"payment-currency": "USD",
"paypal-email": "example@example.com",
Expand Down Expand Up @@ -573,7 +570,6 @@ Create a new event using a `name`, `starts-at`, `ends-at`, `timezone` and an opt
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "example",
"is-ticketing-enabled": false,
"can-pay-by-cheque": false,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -828,7 +824,6 @@ Get a single event.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "example",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -905,7 +900,6 @@ All other fields are optional. Add attributes you want to modify.
"average-rating": null,
"ticket-url": "http://example1.com",
"code-of-conduct": "example1",
"is-ticketing-enabled": "false",
"payment-country": "US",
"payment-currency": "USD",
"paypal-email": "example1@example1.com",
Expand Down Expand Up @@ -1133,7 +1127,6 @@ All other fields are optional. Add attributes you want to modify.
"latitude": 12.23456789,
"starts-at": "2016-12-14T18:29:59.123456+00:00",
"searchable-location-name": "example1",
"is-ticketing-enabled": false,
"can-pay-by-cheque": false,
"description": "example1",
"pentabarf-url": null,
Expand Down Expand Up @@ -1394,7 +1387,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -1631,7 +1623,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -1859,7 +1850,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -2096,7 +2086,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -2325,7 +2314,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -2553,7 +2541,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -2779,7 +2766,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"can-pay-by-omise": false,
"description": "example",
Expand Down Expand Up @@ -3007,7 +2993,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -3233,7 +3218,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -3461,7 +3445,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -3688,7 +3671,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -3914,7 +3896,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -4142,7 +4123,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -4369,7 +4349,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -4596,7 +4575,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -4823,7 +4801,6 @@ Get a list of events.
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"is-event-online": false,
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -5050,7 +5027,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -5276,7 +5252,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -5503,7 +5478,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -5731,7 +5705,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -5957,7 +5930,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -6185,7 +6157,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -6412,7 +6383,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -6637,7 +6607,6 @@ Get a list of events.
"latitude": 1.23456789,
"starts-at": "2016-12-13T23:59:59.123456+00:00",
"searchable-location-name": "Draft",
"is-ticketing-enabled": true,
"can-pay-by-cheque": true,
"description": "example",
"pentabarf-url": null,
Expand Down Expand Up @@ -6899,7 +6868,6 @@ Get a list of events.
"latitude": null,
"starts-at": "2002-05-30T04:00:10+00:00",
"searchable-location-name": null,
"is-ticketing-enabled": true,
"can-pay-by-cheque": false,
"description": "",
"pentabarf-url": null,
Expand Down Expand Up @@ -7158,7 +7126,6 @@ Get a list of events.
"latitude": null,
"starts-at": "2002-05-30T04:00:10+00:00",
"searchable-location-name": null,
"is-ticketing-enabled": true,
"can-pay-by-omise": false,
"can-pay-by-cheque": false,
"description": "",
Expand Down
4 changes: 4 additions & 0 deletions tests/hook_main.py
Expand Up @@ -336,6 +336,8 @@ def event_post(transaction):
:return:
"""
with stash['app'].app_context():
module = ModuleFactory()
db.session.add(module)
RoleFactory(name=OWNER) # TODO: Change to get_or_create in event after_created
db.session.commit()

Expand All @@ -361,6 +363,8 @@ def event_patch(transaction):
:return:
"""
with stash['app'].app_context():
module = ModuleFactory()
db.session.add(module)
event = EventFactoryBasic()
db.session.add(event)
db.session.commit()
Expand Down

0 comments on commit 1b0cf55

Please sign in to comment.