вернул обычную схему в запрос для поиска избранных треков

This commit is contained in:
Mike0001-droid 2024-06-10 17:42:19 +05:00
parent 9a4f11969f
commit f24de374f8
1 changed files with 2 additions and 7 deletions

View File

@ -33,15 +33,10 @@ class SongViewSet(GenericViewSet):
return Response(serializer.data)
@action(
detail=False,
methods=['get'],
url_path='check_is_favorite/(?P<azura_id>[a-zA-Z0-9_]+)',
url_name='check_is_favorite',
)
@action(detail=False, methods=['GET'], schema=DeleteSongSchema())
def check_is_favorite(self, request):
try:
song_obj = Song.objects.get(azura_id=request.data.get('azura_id'))
song_obj = Song.objects.get(azura_id=request.data.get('song_id'))
favorite_songs = FavoriteSong.objects.get(user=request.user, song=song_obj)
except ObjectDoesNotExist:
return Response({"error": 'Объекта не существует'}, status=status.HTTP_404_NOT_FOUND)