leeseohyeon

merge file

......@@ -114,9 +114,9 @@
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"aws-sdk": {
"version": "2.683.0",
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.683.0.tgz",
"integrity": "sha512-mi1175pJMbQhCWhBEQ5ccQ3SDE+SJzbapuAQtcb7tdLLV7dPKf4zQXhpqK1uG0dysm8NhsNtgxwA2diYOKWlTg==",
"version": "2.685.0",
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.685.0.tgz",
"integrity": "sha512-mAOj7b4PuXRxIZkNdSkBWZ28lS2wYUY7O9u33nH9a7BawlttMNbxOgE/wDCPMrTLfj+RLQx0jvoIYj8BKCTRFw==",
"requires": {
"buffer": "4.9.1",
"events": "1.1.1",
......
......@@ -6,6 +6,7 @@ const moment = require("moment");
const BUCKET_NAME = "hong-s3-cloud";
let curPath = "";
let user_id = "";
let parentPath = "";
const s3 = new AWS.S3({
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
......@@ -17,16 +18,37 @@ router.get('/show', function(req, res, next) {
console.log(req.query);
user_id = req.query.id;
curPath = req.query.cur;
if (curPath == '/') {
parentPath = '/';
} else {
let pathSplit = curPath.split('/')
console.log(pathSplit);
parentPath = '/';
for (let i = 1; i < pathSplit.length - 2; i++) {
parentPath += pathSplit[i];
parentPath += '/';
}
}
folders = {}
let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;';
connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) {
if (rows.length != 0) {
res.status(200).send({
folders: rows,
cur: curPath
})
if (err) {
console.log('select error');
res.status(404).send()
} else {
res.send({ error: "Does not exist" });
if (rows.length != 0) {
res.status(200).send({
folders: rows,
cur: curPath,
parentPath: parentPath
})
} else {
res.status(200).send({
folders: rows,
cur: curPath,
parentPath: parentPath
})
}
}
});
});
......@@ -69,8 +91,7 @@ router.post('/makefolder', function(req, res, next) {
connection.query(checkfolder, [cur, user_id], function(err, rows, fields) {
if (rows.length != 0) {
res.status(200).send({
folders: rows,
cur: curPath
folders: rows
})
} else {
res.send({ error: "Does not exist" });
......
......@@ -27,6 +27,7 @@ function makeFolder(folderData) {
return axios.post('/api/folder/makefolder', folderData);
}
<<<<<<< HEAD
function file(userData){
return axios.get('/api/file', userData, {
params: {
......@@ -44,3 +45,6 @@ function dropbox(userData){
}
// export { registerUser, loginUser, dropbox, makeFolder };
=======
export { registerUser, loginUser, folder, makeFolder };
>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36
......
......@@ -17,7 +17,7 @@
<v-list-item
v-for="item in this.$store.getters.folderL"
:key="item.title"
@click="$router.push({name: 'Folder'})"
@click="moveF(item.folder_name)"
>
<v-list-item-avatar>
<v-icon>mdi-folder</v-icon>
......@@ -29,6 +29,9 @@
<v-btn icon>
<v-icon color="grey lighten-1">mdi-information</v-icon>
</v-btn>
<v-btn icon>
<v-icon color="grey lighten-1">mdi-delete</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
<v-divider inset></v-divider>
......@@ -47,6 +50,9 @@
<v-btn icon>
<v-icon color="grey lighten-1">mdi-information</v-icon>
</v-btn>
<v-btn icon>
<v-icon color="grey lighten-1">mdi-delted</v-icon>
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list>
......@@ -101,7 +107,11 @@
<v-container>
<div>
<v-icon>mdi-folder</v-icon>
<<<<<<< HEAD
<v-text-field placeholder="name" id="foldername" type="text" v-model="foldername" ></v-text-field>
=======
<v-text-field placeholder="name" id="foldername" type="text" v-model="foldername"></v-text-field>
>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36
</div>
</v-container>
<v-card-actions>
......@@ -120,12 +130,11 @@
</v-dialog>
</div>
</template>
<script>
import { folder, makeFolder } from '../api/index';
export default {
data() {
return {
return {
foldername:'',
folders: [],
files: [],
......@@ -138,11 +147,19 @@ import { folder, makeFolder } from '../api/index';
try {
const curData = {
id : this.$store.state.id,
cur: this.$store.state.cur
cur: '/'
}
<<<<<<< HEAD
const response = await dropbox(userData);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setFile', response.data.files);
=======
const response = await folder(curData);
console.log(response.data);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setCur', response.data.cur);
this.$store.commit('setParent', response.data.parentPath);
>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36
} catch (error) {
console.log("에러");
console.log(error.response.data);
......@@ -159,10 +176,10 @@ import { folder, makeFolder } from '../api/index';
cur : this.$store.state.cur,
folder_name : this.foldername
};
const response = await makeFolder(folderData);
console.log(response.data)
console.log("폴더 생성 완료");
this.$store.commit('setFolder', response.data.folders);
const response = await makeFolder(folderData);
console.log(response.data)
console.log("폴더 생성 완료");
this.$store.commit('setFolder', response.data.folders);
} catch (error) {
console.log("에러");
console.log(error.response.data);
......@@ -170,8 +187,29 @@ import { folder, makeFolder } from '../api/index';
this.initFolderName();
this.dialog = false;
}
<<<<<<< HEAD
}
}
=======
},
async moveF(move_folder_name){
try {
const curData = {
id : this.$store.state.id,
cur: this.$store.state.cur + move_folder_name + '/'
}
const response = await folder(curData);
console.log(response.data);
this.$store.commit('setFolder', response.data.folders);
this.$store.commit('setCur', response.data.cur);
this.$store.commit('setParent', response.data.parentPath);
} catch (error) {
console.log("에러");
console.log(error.response.data);
}
}
}
>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36
}
</script>
</script>
\ No newline at end of file
......
<template>
<div>
<v-list>
<v-icon>mdi-folder</v-icon>
<v-header>Folders</v-header>
<v-list-item
v-for="item in items"
:key="item.files">
</v-list-item>
</v-list>
</div>
</template>
<script>
export default {
props:{
}
}
</script>
<style>
</style>
\ No newline at end of file
......@@ -67,10 +67,14 @@ export default new VueRouter ({
name:'Feedback',
component: () => import('../views/Feedback.vue')
},
<<<<<<< HEAD
{
path: '/folder',
name: 'Folder',
component: () => import('../views/FolderPage.vue')
},
=======
>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36
]
})
......
......@@ -9,6 +9,10 @@ export default new Vuex.Store({
folders: {},
files: {},
cur: '/',
<<<<<<< HEAD
=======
parent: '/'
>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36
},
mutations: {
setId(state, userid) {
......@@ -25,6 +29,9 @@ export default new Vuex.Store({
},
setCur(state, cur) {
state.cur = cur;
},
setParent(state, parent) {
state.parent = parent;
}
},
getters: {
......@@ -42,6 +49,7 @@ export default new Vuex.Store({
},
cur(state) {
return state.cur;
<<<<<<< HEAD
},
setFolder(state, folderlist){
state.folders = folderlist;
......@@ -50,4 +58,11 @@ export default new Vuex.Store({
state.files = filelist;
},
},
=======
},
parent(state) {
return state.parent;
}
}
>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36
})
\ No newline at end of file
......
<template>
<div>
<FolderList></FolderList>
</div>
</template>
<script>
import FolderList from '../components/FolderList'
export default {
components: {
FolderList,
}
}
</script>
<style>
</style>
\ No newline at end of file