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
Hong
2020-06-08 04:11:34 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fb061036eadd74361e5e426960f41a68049a2972
fb061036
1 parent
8edf7012
파일이동
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
backend/routes/folders.js
backend/routes/folders.js
View file @
fb06103
...
...
@@ -152,9 +152,9 @@ router.post('/move', function(req, res, next) {
user_id
=
req
.
body
.
id
;
let
cur
=
req
.
body
.
cur
;
curPath
=
user_id
+
cur
;
let
name
=
req
.
body
.
folder_
name
;
let
name
=
req
.
body
.
name
;
let
newPath
=
user_id
+
req
.
body
.
newPath
;
if
(
req
.
body
.
isfolder
)
{
if
(
req
.
body
.
isfolder
==
'true'
)
{
let
checkfolder
=
'SELECT * FROM folders WHERE location = ? AND folder_name = ? AND user_id = ?;'
;
connection
.
query
(
checkfolder
,
[
cur
,
name
,
user_id
],
function
(
err1
,
rows
,
fields
)
{
console
.
log
(
rows
);
...
...
@@ -200,22 +200,22 @@ router.post('/move', function(req, res, next) {
}
});
}
else
{
console
.
log
(
"Does not exist"
);
console
.
log
(
"Does not exist
folder
"
);
res
.
status
(
304
).
send
({
error
:
"Does not exist"
});
}
});
}
else
{
let
checkfile
=
'SELECT * FROM files WHERE location = ? AND file_name = ? AND user_id = ?'
;
connection
.
query
(
checkfile
,
[
cur
Path
,
name
,
user_id
],
function
(
err1
,
rows
,
fields
)
{
let
checkfile
=
'SELECT * FROM files WHERE location = ? AND file_name = ? AND user_id = ?
;
'
;
connection
.
query
(
checkfile
,
[
cur
,
name
,
user_id
],
function
(
err1
,
rows
,
fields
)
{
if
(
rows
.
length
!=
0
)
{
let
copy_params
=
{
Bucket
:
BUCKET_NAME
,
CopySource
:
BUCKET_NAME
+
'/drive/'
+
curPath
+
fil
e
,
Key
:
'drive/'
+
newPath
+
fil
e
CopySource
:
BUCKET_NAME
+
'/drive/'
+
curPath
+
nam
e
,
Key
:
'drive/'
+
newPath
+
nam
e
};
let
del_params
=
{
Bucket
:
BUCKET_NAME
,
Key
:
'drive/'
+
curPath
+
fil
e
Key
:
'drive/'
+
curPath
+
nam
e
};
s3
.
copyObject
(
copy_params
,
function
(
err
,
data
)
{
if
(
err
)
{
...
...
@@ -227,7 +227,7 @@ router.post('/move', function(req, res, next) {
console
.
log
(
err
,
data
);
res
.
status
(
304
).
send
({
error
:
"delete error"
});
}
else
{
let
values
=
[
newPath
,
cur
,
name
,
user_id
];
let
values
=
[
req
.
body
.
newPath
,
cur
,
name
,
user_id
];
let
updatesql
=
'UPDATE files SET location = ? WHERE location = ? AND file_name = ? AND user_id = ?;'
;
connection
.
query
(
updatesql
,
values
,
function
(
err3
,
result
,
field
)
{
if
(
err3
)
{
...
...
@@ -246,6 +246,7 @@ router.post('/move', function(req, res, next) {
}
});
}
else
{
console
.
log
(
"Does not exist file"
);
res
.
status
(
304
).
send
({
error
:
"Does not exist"
});
}
});
...
...
Please
register
or
login
to post a comment