[WIKI-804] fix: refactor image uploader (#8210)

* fix: refactor uploader

* fix: props

* fix: sites fix
This commit is contained in:
M. Palanikannan 2025-12-05 13:20:15 +05:30 committed by GitHub
parent 392c8cf2e1
commit 82c970ac4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 63 additions and 56 deletions

View file

@ -11,11 +11,12 @@ from rest_framework import status
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
# Module imports
from .base import BaseAPIView
from plane.bgtasks.storage_metadata_task import get_asset_object_metadata
from plane.db.models import DeployBoard, FileAsset
from plane.settings.storage import S3Storage
from plane.bgtasks.storage_metadata_task import get_asset_object_metadata
# Module imports
from .base import BaseAPIView
class EntityAssetEndpoint(BaseAPIView):
@ -167,7 +168,7 @@ class EntityAssetEndpoint(BaseAPIView):
class AssetRestoreEndpoint(BaseAPIView):
"""Endpoint to restore a deleted assets."""
def post(self, request, anchor, asset_id):
def post(self, request, anchor, pk):
# Get the deploy board
deploy_board = DeployBoard.objects.filter(anchor=anchor, entity_name="project").first()
# Check if the project is published
@ -175,7 +176,7 @@ class AssetRestoreEndpoint(BaseAPIView):
return Response({"error": "Project is not published"}, status=status.HTTP_404_NOT_FOUND)
# Get the asset
asset = FileAsset.all_objects.get(id=asset_id, workspace=deploy_board.workspace)
asset = FileAsset.all_objects.get(id=pk, workspace=deploy_board.workspace)
asset.is_deleted = False
asset.deleted_at = None
asset.save(update_fields=["is_deleted", "deleted_at"])