Skip to content

Commit

Permalink
Added Seats Field to CourseRun Search API
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulmanann committed Sep 12, 2024
1 parent a5fdfe5 commit bb42b51
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions course_discovery/apps/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,7 @@ class CourseRunSearchSerializer(HaystackSerializer):
first_enrollable_paid_seat_price = serializers.SerializerMethodField()
type = serializers.SerializerMethodField()
is_enrollable = serializers.SerializerMethodField()
seats = serializers.SerializerMethodField()

def get_availability(self, result):
return result.object.availability
Expand All @@ -2221,6 +2222,10 @@ def get_type(self, result):

def get_is_enrollable(self, result):
return result.object.is_enrollable

def get_seats(self, result):
seats = result.object.seats.all()
return SeatSerializer(seats, many=True).data

class Meta:
field_aliases = COMMON_SEARCH_FIELD_ALIASES
Expand Down Expand Up @@ -2254,6 +2259,7 @@ class Meta:
'program_types',
'published',
'seat_types',
'seats',
'short_description',
'staff_uuids',
'start',
Expand Down

0 comments on commit bb42b51

Please sign in to comment.