1111from app .api .schema .base import SoftDeletionSchema
1212from app .models .session import Session
1313from utils .common import use_defaults
14+ from app .api .helpers .validations import validate_complex_fields_json
1415
1516
1617@use_defaults ()
@@ -29,7 +30,7 @@ class Meta:
2930 inflect = dasherize
3031
3132 @validates_schema (pass_original = True )
32- def validate_date (self , data , original_data ):
33+ def validate_fields (self , data , original_data ):
3334 if 'id' in original_data ['data' ]:
3435 try :
3536 session = Session .query .filter_by (id = original_data ['data' ]['id' ]).one ()
@@ -66,6 +67,8 @@ def validate_date(self, data, original_data):
6667 if not has_access ('is_coorganizer' , event_id = data ['event' ]):
6768 return ForbiddenException ({'source' : '' }, 'Co-organizer access is required.' )
6869
70+ validate_complex_fields_json (self , data , original_data )
71+
6972 id = fields .Str (dump_only = True )
7073 title = fields .Str (required = True )
7174 subtitle = fields .Str (allow_none = True )
@@ -90,6 +93,7 @@ def validate_date(self, data, original_data):
9093 last_modified_at = fields .DateTime (dump_only = True )
9194 send_email = fields .Boolean (load_only = True , allow_none = True )
9295 average_rating = fields .Float (dump_only = True )
96+ complex_field_values = fields .Dict (allow_none = True )
9397 microlocation = Relationship (attribute = 'microlocation' ,
9498 self_view = 'v1.session_microlocation' ,
9599 self_view_kwargs = {'id' : '<id>' },
0 commit comments