Skip to content

Commit

Permalink
Merge pull request #92 from edly-io/manan/EDLY-6981-Currency
Browse files Browse the repository at this point in the history
Added Seats Field to CourseRun Search API
  • Loading branch information
manan-memon authored Sep 18, 2024
2 parents a5fdfe5 + bb42b51 commit 2868fd9
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 2868fd9

Please sign in to comment.