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-07 01:25:15 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f26d53e95fb836a6c3977523f7dba45e5d1ca8eb
f26d53e9
1 parent
7fbfa105
검색추가
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
backend/routes/folders.js
backend/routes/folders.js
View file @
f26d53e
...
...
@@ -315,20 +315,28 @@ router.post('/modify', function(req, res, next) {
});
router
.
post
(
'/search/:target'
,
function
(
req
,
res
,
next
)
{
user_id
=
req
.
params
.
id
;
let
cur
=
req
.
params
.
cur
;
folders
=
{}
let
checkfolder
=
'SELECT * FROM folders WHERE location = ? AND user_id = ?;'
;
connection
.
query
(
checkfolder
,
[
cur
,
user_id
],
function
(
err
,
rows
,
fields
)
{
if
(
rows
.
length
!=
0
)
{
router
.
get
(
'/search'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
req
.
query
);
user_id
=
req
.
query
.
id
;
let
target
=
connection
.
escape
(
'%'
+
req
.
query
.
target
+
'%'
);
console
.
log
(
target
);
let
folders
=
[]
let
files
=
[]
let
checkfolder
=
'SELECT * FROM folders WHERE folder_name LIKE '
+
target
+
' AND user_id = ?;'
;
connection
.
query
(
checkfolder
,
[
user_id
],
function
(
err
,
folder
,
fields
)
{
console
.
log
(
folder
);
folders
.
push
(
folder
)
let
checkfile
=
'SELECT * FROM files WHERE file_name LIKE '
+
target
+
' AND user_id = ?;'
;
connection
.
query
(
checkfile
,
[
user_id
],
function
(
err
,
file
,
fields
)
{
console
.
log
(
file
);
files
.
push
(
file
)
res
.
status
(
200
).
send
({
folders
:
folders
folders
:
folders
,
files
:
files
})
}
else
{
res
.
send
({
error
:
"Does not exist"
});
}
});
});
});
module
.
exports
=
router
;
\ No newline at end of file
...
...
Please
register
or
login
to post a comment