Repository: fossasia/open-event-server

Issue:
Attributes not provided for relationships in order schema
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->
Attributes aren't provided for relationships in Order schema.

**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
They should be added.

**Additional context**
<!-- Add any other context about the problem here. -->
Parent #4852 


Discussion:

Resolving patch:
diff --git a/app/api/orders.py b/app/api/orders.py
--- a/app/api/orders.py
+++ b/app/api/orders.py
@@ -190,6 +190,7 @@ def before_update_object(self, order, data, view_kwargs):
         :param view_kwargs:
         :return:
         """
+        # Admin can update all the fields while Co-organizer can update only the status
         if not has_access('is_admin'):
             for element in data:
                 if element != 'status':
diff --git a/app/api/schema/orders.py b/app/api/schema/orders.py
--- a/app/api/schema/orders.py
+++ b/app/api/schema/orders.py
@@ -67,7 +67,8 @@ def initial_values(self, data):
                              many=True,
                              type_='attendee')
 
-    tickets = Relationship(self_view='v1.order_ticket',
+    tickets = Relationship(attribute='tickets',
+                           self_view='v1.order_ticket',
                            self_view_kwargs={'order_identifier': '<identifier>'},
                            related_view='v1.ticket_list',
                            related_view_kwargs={'order_identifier': '<identifier>'},
@@ -75,28 +76,32 @@ def initial_values(self, data):
                            many=True,
                            type_="ticket")
 
-    user = Relationship(self_view='v1.order_user',
+    user = Relationship(attribute='user',
+                        self_view='v1.order_user',
                         self_view_kwargs={'order_identifier': '<identifier>'},
                         related_view='v1.user_detail',
                         related_view_kwargs={'id': '<user_id>'},
                         schema='UserSchemaPublic',
                         type_="user")
 
-    event = Relationship(self_view='v1.order_event',
+    event = Relationship(attribute='event',
+                         self_view='v1.order_event',
                          self_view_kwargs={'order_identifier': '<identifier>'},
                          related_view='v1.event_detail',
                          related_view_kwargs={'id': '<event_id>'},
                          schema='EventSchemaPublic',
                          type_="event")
 
-    marketer = Relationship(self_view='v1.order_marketer',
+    marketer = Relationship(attribute='marketer',
+                            self_view='v1.order_marketer',
                             self_view_kwargs={'order_identifier': '<identifier>'},
                             related_view='v1.user_detail',
                             related_view_kwargs={'id': '<marketer_id>'},
                             schema='UserSchemaPublic',
                             type_="user")
 
-    discount_code = Relationship(self_view='v1.order_discount',
+    discount_code = Relationship(attribute='discount_code',
+                                 self_view='v1.order_discount',
                                  self_view_kwargs={'order_identifier': '<identifier>'},
                                  related_view='v1.discount_code_detail',
                                  related_view_kwargs={'id': '<discount_code_id>'},


Test patch: