김재형

Merge branch 'develop' into feature/frontend

......@@ -299,7 +299,8 @@ class ItemViewSet(viewsets.ViewSet):
return Response({'message': 'item is not existed.'}, status=status.HTTP_204_NO_CONTENT)
if child.is_folder == True:
return Response({'message': 'item is folder'}, status=status.HTTP_204_NO_CONTENT)
copiedName = child.name + "_복사본_" + str(datetime.now().strftime('%Y-%m-%d %H:%M'))
name = child.name.split(".")
copiedName = name[0]+ "_복사본_" + str(datetime.now().strftime('%Y-%m-%d %H:%M'))+"." + name[-1]
copiedItem = Item(is_folder=False, name=copiedName, path=child.path, parent=parent_id,
user_id=child.user_id, size=child.size, status=child.status)
copiedItem.save()
......@@ -398,6 +399,7 @@ 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)
......@@ -407,7 +409,7 @@ class ItemViewSet(viewsets.ViewSet):
presigned_post = s3.generate_presigned_post(
s3_bucket,
file_name,
file_id,
{
"acl": "private",
"Content-Type": file_type,
......@@ -434,7 +436,7 @@ class ItemViewSet(viewsets.ViewSet):
data = {
"signed_url": presigned_post,
'url': '%s/%s' % (presigned_post["url"], file_name),
'url': '%s/%s' % (presigned_post["url"], file_id),
'item': res
}
......