Repository: fossasia/open-event-server

Issue:
Change endpoints for tax & event-copyright
**I'm submitting a ...**  (check one with "x")
- [x] bug report
- [ ] feature request
- [ ] support request => Please do not submit support requests here, instead ask your query in out Gitter channel at https://gitter.im/fossasia/open-event-orga-server

The FE expects the pluralised endpoints for tax & event-copyright. currently they are singular which leads to `ERROR 404`. Required for https://github.com/fossasia/open-event-frontend/pull/661


Discussion:
@shubham-padia @enigmaeth @poush @magdalenesuo Please take this up it is a blocker for fossasia/open-event-frontend#661

Resolving patch:
diff --git a/app/api/__init__.py b/app/api/__init__.py
--- a/app/api/__init__.py
+++ b/app/api/__init__.py
@@ -301,10 +301,10 @@
 # event_copyright
 api.route(EventCopyrightListPost, 'event_copyright_list_post', '/event-copyrights')
 api.route(EventCopyrightDetail, 'event_copyright_detail',
-          '/event-copyright/<int:id>', '/events/<int:event_id>/event-copyright',
+          '/event-copyrights/<int:id>', '/events/<int:event_id>/event-copyright',
           '/events/<event_identifier>/event-copyright')
 api.route(EventCopyrightRelationshipRequired, 'copyright_event',
-          '/event-copyright/<int:id>/relationships/event')
+          '/event-copyrights/<int:id>/relationships/event')
 
 # custom_placeholder
 api.route(CustomPlaceholderList, 'custom_placeholder_list',
@@ -315,10 +315,10 @@
           '/custom-placeholders/<int:id>/relationships/event-sub-topic')
 
 # tax
-api.route(TaxListPost, 'tax_list_post', '/tax')
-api.route(TaxList, 'tax_list', '/tax', '/events/<int:event_id>/tax', '/events/<identifier>/tax')
-api.route(TaxDetail, 'tax_detail', '/tax/<int:id>', '/events/<int:event_id>/tax')
-api.route(TaxRelationship, 'tax_event', '/tax/<int:id>/relationships/event')
+api.route(TaxListPost, 'tax_list_post', '/taxes')
+api.route(TaxList, 'tax_list', '/taxes', '/events/<int:event_id>/tax', '/events/<identifier>/tax')
+api.route(TaxDetail, 'tax_detail', '/taxes/<int:id>', '/events/<int:event_id>/tax')
+api.route(TaxRelationship, 'tax_event', '/taxes/<int:id>/relationships/event')
 
 # event invoices
 api.route(EventInvoiceList, 'event_invoice_list', '/event-invoices', '/events/<int:event_id>/event-invoices',


Test patch:
diff --git a/tests/hook_main.py b/tests/hook_main.py
--- a/tests/hook_main.py
+++ b/tests/hook_main.py
@@ -679,7 +679,7 @@ def copyright_post(transaction):
 @hooks.before("Copyright > Event Copyright Details > Event Copyright Details")
 def copyright_get_detail(transaction):
     """
-    GET /event-copyright/1
+    GET /event-copyrights/1
     :param transaction:
     :return:
     """
@@ -692,7 +692,7 @@ def copyright_get_detail(transaction):
 @hooks.before("Copyright > Event Copyright Details > Update Event Copyright")
 def copyright_patch(transaction):
     """
-    PATCH /event-copyright/1
+    PATCH /event-copyrights/1
     :param transaction:
     :return:
     """
@@ -705,7 +705,7 @@ def copyright_patch(transaction):
 @hooks.before("Copyright > Event Copyright Details > Delete Event Copyright")
 def copyright_delete(transaction):
     """
-    DELETE /event-copyright/1
+    DELETE /event-copyrights/1
     :param transaction:
     :return:
     """
@@ -1382,7 +1382,7 @@ def sponsor_delete(transaction):
 @hooks.before("Tax > Tax Collection > Create Tax")
 def tax_post(transaction):
     """
-    GET /tax/1
+    GET /taxes/1
     :param transaction:
     :return:
     """
@@ -1395,7 +1395,7 @@ def tax_post(transaction):
 @hooks.before("Tax > Tax Details > Tax Details")
 def tax_get_detail(transaction):
     """
-    PATCH /tax/1
+    PATCH /taxes/1
     :param transaction:
     :return:
     """
@@ -1408,7 +1408,7 @@ def tax_get_detail(transaction):
 @hooks.before("Tax > Tax Details > Update Tax")
 def tax_patch(transaction):
     """
-    PATCH /tax/1
+    PATCH /taxes/1
     :param transaction:
     :return:
     """
@@ -1421,7 +1421,7 @@ def tax_patch(transaction):
 @hooks.before("Tax > Tax Details > Delete Tax")
 def tax_delete(transaction):
     """
-    DELETE /tax/1
+    DELETE /taxes/1
     :param transaction:
     :return:
     """