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-09 23:14:32 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1a7d5e56c35790b3397b4ecda2733998d461fac9
1a7d5e56
1 parent
19fc1500
.
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
27 deletions
backend/routes/folders.js
backend/routes/folders.js
View file @
1a7d5e5
...
...
@@ -43,42 +43,68 @@ const s3 = new AWS.S3();
router
.
get
(
'/show'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
req
.
query
);
user_id
=
req
.
query
.
user_
id
;
user_id
=
req
.
query
.
id
;
folder_id
=
req
.
query
.
folder_id
;
let
checkfolder
=
'SELECT * FROM folders WHERE folder_id = ? AND user_id = ?;'
;
connection
.
query
(
checkfolder
,
[
curPath
,
user_id
],
function
(
err
,
rows
)
{
if
(
err
)
{
console
.
log
(
'select1 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
let
location
=
rows
[
0
].
location
+
rows
[
0
].
folder_name
+
'/'
;
if
(
rows
.
length
==
0
)
{
console
.
log
(
'does not exist'
);
res
.
status
(
400
).
send
({
err
:
'does not exist'
});
if
(
folder_id
==
-
1
)
{
let
location
=
'/'
;
let
gerFolder
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
gerFolder
,
[
location
,
user_id
],
function
(
err
,
folder
)
{
if
(
err
)
{
console
.
log
(
'select2 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
let
gerF
older
=
'SELECT * FROM folder
s WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
gerF
older
,
[
location
,
user_id
],
function
(
err
,
folder
)
{
let
gerF
ile
=
'SELECT * FROM file
s WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
gerF
ile
,
[
location
,
user_id
],
function
(
err
,
file
)
{
if
(
err
)
{
console
.
log
(
'select
2
error'
);
console
.
log
(
'select
3
error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
let
gerFile
=
'SELECT * FROM files WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
gerFile
,
[
location
,
user_id
],
function
(
err
,
folder
)
{
if
(
err
)
{
console
.
log
(
'select3 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
res
.
status
(
200
).
send
({
folders
:
folder
,
files
:
file
});
}
res
.
status
(
200
).
send
({
folders
:
folder
,
files
:
file
,
cur
:
location
});
}
});
}
}
});
});
}
else
{
let
checkfolder
=
'SELECT * FROM folders WHERE folder_id = ? AND user_id = ?;'
;
connection
.
query
(
checkfolder
,
[
curPath
,
user_id
],
function
(
err
,
rows
)
{
if
(
err
)
{
console
.
log
(
'select1 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
if
(
rows
.
length
==
0
)
{
console
.
log
(
'does not exist'
);
res
.
status
(
400
).
send
({
err
:
'does not exist'
});
}
else
{
let
location
=
rows
[
0
].
location
+
rows
[
0
].
folder_name
+
'/'
;
let
gerFolder
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
gerFolder
,
[
location
,
user_id
],
function
(
err
,
folder
)
{
if
(
err
)
{
console
.
log
(
'select2 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
let
gerFile
=
'SELECT * FROM files WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
gerFile
,
[
location
,
user_id
],
function
(
err
,
file
)
{
if
(
err
)
{
console
.
log
(
'select3 error'
);
res
.
status
(
400
).
send
({
err
:
err
});
}
else
{
res
.
status
(
200
).
send
({
folders
:
folder
,
files
:
file
,
cur
:
location
});
}
});
}
});
}
}
});
}
});
router
.
post
(
'/makefolder'
,
function
(
req
,
res
,
next
)
{
...
...
Please
register
or
login
to post a comment