✏️ Fix: [#99] 포폴, 플젝 대표/퍼블리싱 수정 및 노코드툴 스키마 수정

This commit is contained in:
sm4640
2025-12-29 21:30:50 +09:00
parent 196498d879
commit 0d129d14fd
2 changed files with 22 additions and 14 deletions

View File

@@ -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)
is_representing = request.data.get("representing", False)
if is_representing:
if before_represent := Portfolio.objects.filter(owner=user, is_represent=True).first(): if before_represent := Portfolio.objects.filter(owner=user, is_represent=True).first():
before_represent.is_represent = False before_represent.is_represent = False
before_represent.save() before_represent.save()
portfolio.is_represent = True 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

View File

@@ -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)
is_representing = request.data.get("representing", False)
if is_representing:
if before_represent := Project.objects.filter(owner=user, is_represent=True).first(): if before_represent := Project.objects.filter(owner=user, is_represent=True).first():
before_represent.is_represent = False before_represent.is_represent = False
before_represent.save() before_represent.save()
project.is_represent = True 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