Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing
/
D_Team_Khuloud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
leeseohyeon
2020-06-10 02:20:05 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
463ac179695132987067828125d94c29ee2e59d3
463ac179
1 parent
2b1c4d68
파일 삭제 수정
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
6 deletions
backend/routes/file/deleteFile.js
backend/routes/modules/awsconfig.json
backend/routes/modules/s3/s3.js
backend/routes/file/deleteFile.js
View file @
463ac17
...
...
@@ -24,16 +24,19 @@ router.get('/:name', function (req, res) {
res
.
send
({
erorr
:
'db delete error'
});
}
else
{
connection
.
query
(
sql2
,
[
file_name
,
'/trashcan'
+
curPath
,
user_id
],
function
(
err
)
{
//connection.query(sql2, [file_name, '/trashcan'+curPath, user_id], function (err) {
connection
.
query
(
sql2
,
[
file_name
,
'/trashcan/'
,
user_id
],
function
(
err
)
{
if
(
err
)
{
console
.
log
(
'insert in trashcan db error'
);
res
.
send
({
error
:
'db insert error'
});
}
else
{
// /drive/user_id/sourceFile --> /drive/user_id/trashcan/sourceFile
S3
.
moveFile
2
(
S3
.
BUCKET_NAME
,
user_id
,
sourceFile
,
targetPath
,
function
(
result
)
{
S3
.
moveFile
4
(
S3
.
BUCKET_NAME
,
user_id
,
sourceFile
,
targetPath
,
function
(
result
)
{
if
(
result
)
{
res
.
send
(
"move to trashcan success"
);
res
.
send
({
message
:
"move to trashcan success"
});
}
else
{
res
.
send
({
err
:
"no such file"
})
}
})
}
...
...
backend/routes/modules/awsconfig.json
View file @
463ac17
{
"accessKeyId"
:
"ASIAZQ5XTMMF
W4UZW2VT
"
,
"secretAccessKey"
:
"
xW8+UlKZwlWoFapKbCIWLylzm7Fu/NEp9I3Zm8ol
"
,
"sessionToken"
:
"FwoGZXIvYXdzE
Jr//////////wEaDCrmrozcBSyKdyzlniLDASuoWRbM8DUd4DsQqVjvJJVsuyegnxLuKZbs2nQvfAOA8X2mB5vakuykW6uNXXeyiY2keatkH5ksP07CEShFR/uoCuKHxqfV+5hglcylIeJvx4ruEvgdfyBw+u+emsSNPMYjqdc9zDgS7DZ1g9qPwUluEY+VIOhgURT15h3onCDIM7enhr4ba8iU+Nbx2ANjdTy3TGzwHnwupMZvAp8iGUt3yxlbopfIm6WtgjE2znMYGrz5/9V/S6hXCsNRVzTainyugCjc2Pn2BTItOpW51eRX99P1onvwOCN5Rh7psaflX4n+bGBhWIBuUh+jlFimntPBaKzmrB3V
"
,
"accessKeyId"
:
"ASIAZQ5XTMMF
3ZUR2BUN
"
,
"secretAccessKey"
:
"
eWtyyVMNd0bRvfEWHr2/8QS9Pz7kx8CfE+s1e9kZ
"
,
"sessionToken"
:
"FwoGZXIvYXdzE
LP//////////wEaDNHd6noZfvBmcxG92CLDAeuqzY82tmA4/ZQ0KRZhj/qwO15RUafkJfnFkRcRVd1BFkLDMkUAM79KYlfEwFyav9yPbz1fPg8nh3QYWcdFRrr02jFSPs2aFuzVYDWhSjY8t7ulft7ug7C4SmARQ7WAvJ8gON8PNFy0SmMyfl+dXomcBrKx8miw+vgsbtbnVIoBal6vaARMi60DDBNR9gOTi/ocWWhQdeoMIKfnnrhywJ+b8REcJdaUC4gYBmowFLa8hlDu9LzZFlocEe22Hs8bEm/0HCjWgv/2BTItyAqTUVvzyHPGtxvoOA5f8fB30ZbU7ISzRcIVpPOGgTTDJXAXE7gZmDSQX2+U
"
,
"region"
:
"us-east-1"
}
...
...
backend/routes/modules/s3/s3.js
View file @
463ac17
...
...
@@ -337,6 +337,32 @@ var S3 = {
})
},
// 파일 삭제 때 쓰임
moveFile4
:
function
(
bucketName
,
userId
,
sourceFile
,
targetPath
,
callback
)
{
// sourceFile => folder1/folder2/test.txt
var
paths
=
sourceFile
.
split
(
'/'
);
var
filename
=
paths
[
paths
.
length
-
1
];
//var targetFile = targetPath + '/' + sourceFile;
targetFile
=
targetPath
+
'/'
+
filename
;
S3
.
copyFile2
(
bucketName
,
userId
,
sourceFile
,
targetFile
,
function
(
res
)
{
if
(
!
res
)
{
console
.
log
(
"Move Error on Copying File2"
);
callback
(
false
);
}
else
{
S3
.
deleteFile
(
bucketName
,
userId
,
sourceFile
,
function
(
res
)
{
if
(
!
res
)
{
console
.
log
(
"Move Error on Deleting File"
);
callback
(
false
);
}
else
{
console
.
log
(
"Move Success"
);
callback
(
true
);
}
})
}
})
},
renameFile
:
function
(
bucketName
,
userId
,
sourceFile
,
modiFile
,
targetPath
,
callback
){
// sourceFile = test.txt
// modiFile = test2.txt
...
...
Please
register
or
login
to post a comment