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