최동원

Merge branch 'share,favorite' of http://khuhub.khu.ac.kr/2020-1-CloudComputing/D…

…_Team_Khuloud into share,favorite
......@@ -140,8 +140,8 @@ router.post('/makefolder', function(req, res, next) {
console.log('insert error');
res.status(400).send({ err: err });
} else {
let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;';
connection.query(checkfolder, [cur, user_id], function(err, rows, fields) {
let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;';
connection.query(checkfolder, [cur, user_id, 'trashcan'], function(err, rows, fields) {
console.log(rows);
res.status(200).send({
folders: rows
......@@ -198,8 +198,8 @@ router.post('/delfolder', function(req, res, next) {
console.log("updatesql error");
res.status(304).send({ error: "updatesql error" });
} else {
let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;';
connection.query(resultsql, [cur, user_id], function(err, rows, fields) {
let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;';
connection.query(resultsql, [cur, user_id, 'trashcan'], function(err, rows, fields) {
res.status(200).send({
folders: rows
});
......@@ -268,8 +268,8 @@ router.post('/move', function(req, res, next) {
console.log("updatesql error");
res.status(304).send({ error: "updatesql error" });
} else {
let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;';
connection.query(resultsql, [cur, user_id], function(err, rows, fields) {
let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ? AND folder_name != ?;';
connection.query(resultsql, [cur, user_id, 'trashcan'], function(err, rows, fields) {
res.status(200).send({
folders: rows
});
......@@ -317,10 +317,10 @@ router.post('/move', function(req, res, next) {
if (err3) {
res.status(304).send({ error: "updatesql error" });
} else {
let resultsql = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;';
let resultsql = 'SELECT * FROM files WHERE location = ? AND user_id = ?;';
connection.query(resultsql, [cur, user_id], function(err, rows, fields) {
res.status(200).send({
folders: rows
files: rows
});
});
}
......@@ -407,8 +407,8 @@ router.get('/search', function(req, res, next) {
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) {
let checkfolder = 'SELECT * FROM folders WHERE folder_name LIKE ' + target + ' AND user_id = ? AND folder_name != ?;';
connection.query(checkfolder, [user_id, 'trashcan'], function(err, folder, fields) {
console.log(folder);
folders.push(folder)
let checkfile = 'SELECT * FROM files WHERE file_name LIKE ' + target + ' AND user_id = ?;';
......
......@@ -69,7 +69,7 @@
</v-list>
</v-menu>
<v-menu
v-model="showMenu"
v-model="showMenuF"
:position-x="x"
:position-y="y"
absolute
......@@ -111,6 +111,9 @@ export default {
return {
curfName: {},
showMenu: false,
search: '',
x: 0,
y: 0,
cfilename: {},
showMenuF: false,
x: 0,
......@@ -129,6 +132,7 @@ export default {
try {
const id = this.$store.state.id;
const response = await showTrashcan(id);
console.log(response.data);
this.$store.commit('settrashFolderList', response.data.folders);
this.$store.commit('settrashFileList', response.data.files);
} catch (error) {
......
......@@ -4,89 +4,89 @@ import Vuex from 'vuex';
Vue.use(Vuex);
export default new Vuex.Store({
state: {
id: '',
folders: [],
files: [],
cur: '/',
parent: '/',
recentList: [],
favFolderList: [],
favFileList: [],
trashFolderList: [],
trashFileList: [],
},
mutations: {
setId(state, userid) {
state.id = userid;
},
clearid(state) {
state.id = '';
},
setFolder(state, folderlist) {
state.folders = folderlist;
},
setFile(state, filelist) {
state.files = filelist;
},
setCur(state, cur) {
state.cur = cur;
},
setParent(state, parent) {
state.parent = parent;
},
setRecentList(state, list) {
state.recentList = list;
},
setfavFolderList(state, fflist) {
state.favFolderList = fflist;
},
setfavFileList(state, fflist) {
state.favFileList = fflist;
},
settrashFolderList(state, tflist) {
state.trashFolderList = tflist;
},
settrashFileList(state, tflist) {
state.trashFileList = tflist;
},
},
getters: {
isLogin(state) {
return state.id !== '';
},
userID(state) {
return state.id;
},
folderL(state) {
return state.folders;
},
fileL(state) {
return state.files;
},
recentL(state) {
return state.recentList;
},
cur(state) {
return state.cur;
},
setFolder(state, folderlist) {
state.folders = folderlist;
},
setFile(state, filelist) {
state.files = filelist;
},
favFolderL(state) {
return state.favFolderList;
},
favFileL(state) {
return state.favFileList;
},
trashFolderL(state) {
return state.trashFolderList;
},
trashFileL(state) {
return state.trashFolderList;
},
},
});
state: {
id: '',
folders: [],
files: [],
cur: '/',
parent: '/',
recentList: [],
favFolderList: [],
favFileList: [],
trashFolderList: [],
trashFileList: [],
},
mutations: {
setId(state, userid) {
state.id = userid;
},
clearid(state) {
state.id = '';
},
setFolder(state, folderlist) {
state.folders = folderlist;
},
setFile(state, filelist) {
state.files = filelist;
},
setCur(state, cur) {
state.cur = cur;
},
setParent(state, parent) {
state.parent = parent;
},
setRecentList(state, list) {
state.recentList = list;
},
setfavFolderList(state, fflist) {
state.favFolderList = fflist;
},
setfavFileList(state, fflist) {
state.favFileList = fflist;
},
settrashFolderList(state, tflist) {
state.trashFolderList = tflist;
},
settrashFileList(state, tflist) {
state.trashFileList = tflist;
},
},
getters: {
isLogin(state) {
return state.id !== '';
},
userID(state) {
return state.id;
},
folderL(state) {
return state.folders;
},
fileL(state) {
return state.files;
},
recentL(state) {
return state.recentList;
},
cur(state) {
return state.cur;
},
setFolder(state, folderlist) {
state.folders = folderlist;
},
setFile(state, filelist) {
state.files = filelist;
},
favFolderL(state) {
return state.favFolderList;
},
favFileL(state) {
return state.favFileList;
},
trashFolderL(state) {
return state.trashFolderList;
},
trashFileL(state) {
return state.trashFileList;
},
},
});
\ No newline at end of file
......