김재형

Merge branch 'feature/frontend' into develop

......@@ -195,7 +195,7 @@ class ItemViewSet(viewsets.ViewSet):
s3_bucket = AWS_STORAGE_BUCKET_NAME
item = Item.objects.filter(item_id=pk)
object_name = item.get().name
object_name = str(item.get().item_id)
data = serializers.serialize("json", item)
json_data = json.loads(data)
......@@ -399,12 +399,13 @@ class ItemViewSet(viewsets.ViewSet):
# 파일 객체 생성
file_name = request.POST.get('name', '')
file_size = request.POST.get('size', '')
file_id = request.POST.get('item_id', '')
file_parent = pk
file_type = mimetypes.guess_type(file_name)[0]
upload_item = Item(name=file_name, size=file_size, user_id=1, file_type=file_type, parent=file_parent)
upload_item.save()
file_id = str(upload_item.item_id)
date_long = datetime.utcnow().strftime('%Y%m%dT000000Z')
presigned_post = s3.generate_presigned_post(
......@@ -478,7 +479,6 @@ class SharedItemViewSet(viewsets.ModelViewSet):
return Response({'message': 'This file is already shared'}, status=status.HTTP_200_OK)
sharedfile = SharedItem(item_id=pk, password=password, expires=expires)
sharedfile.save()
sharedfile = SharedItem.objects.get(item_id=pk)
# sf = serializers.serialize("json", sharedfile)
item = Item.objects.filter(item_id=pk)
......@@ -488,7 +488,7 @@ class SharedItemViewSet(viewsets.ModelViewSet):
print(json_data)
res = json_data[0]['fields']
res['id'] = json_data[0]['pk']
return Response({"shared": sharedfile.created_time, 'data': res}, status=status.HTTP_200_OK)
return Response({"shared": sharedfile.pk, 'data': res}, status=status.HTTP_200_OK)
item = ItemViewSet.as_view({
......