✏️ Fix: [#99] 포폴, 플젝 대표/퍼블리싱 수정 및 노코드툴 스키마 수정
This commit is contained in:
@@ -54,12 +54,15 @@ class PortfolioSetRepresentAPIView(APIView):
|
||||
portfolio = get_object_or_404(Portfolio, id=pk)
|
||||
if user != portfolio.owner:
|
||||
return Response({"message": "Not owner"}, status=status.HTTP_403_FORBIDDEN)
|
||||
if before_represent := Portfolio.objects.filter(owner=user, is_represent=True).first():
|
||||
before_represent.is_represent = False
|
||||
before_represent.save()
|
||||
portfolio.is_represent = True
|
||||
|
||||
is_representing = request.data.get("representing", False)
|
||||
if is_representing:
|
||||
if before_represent := Portfolio.objects.filter(owner=user, is_represent=True).first():
|
||||
before_represent.is_represent = False
|
||||
before_represent.save()
|
||||
portfolio.is_represent = is_representing
|
||||
portfolio.save()
|
||||
return Response({"message": "change represent success"}, status=status.HTTP_200_OK)
|
||||
return Response({"is_represented": is_representing}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
class PortfolioSetPublishAPIView(APIView):
|
||||
@@ -69,9 +72,10 @@ class PortfolioSetPublishAPIView(APIView):
|
||||
portfolio = get_object_or_404(Portfolio, id=pk)
|
||||
if user != portfolio.owner:
|
||||
return Response({"message": "Not owner"}, status=status.HTTP_403_FORBIDDEN)
|
||||
portfolio.is_published = True
|
||||
is_publishing = request.data.get("publishing", False)
|
||||
portfolio.is_published = is_publishing
|
||||
portfolio.save()
|
||||
return Response({"message": "publish success"}, status=status.HTTP_200_OK)
|
||||
return Response({"is_published": is_publishing}, status=status.HTTP_200_OK)
|
||||
|
||||
class PortfolioChangeState(APIView):
|
||||
@transaction.atomic
|
||||
|
||||
Reference in New Issue
Block a user