Showing
8 changed files
with
102 additions
and
64 deletions
... | @@ -114,9 +114,9 @@ | ... | @@ -114,9 +114,9 @@ |
114 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" | 114 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" |
115 | }, | 115 | }, |
116 | "aws-sdk": { | 116 | "aws-sdk": { |
117 | - "version": "2.683.0", | 117 | + "version": "2.685.0", |
118 | - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.683.0.tgz", | 118 | + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.685.0.tgz", |
119 | - "integrity": "sha512-mi1175pJMbQhCWhBEQ5ccQ3SDE+SJzbapuAQtcb7tdLLV7dPKf4zQXhpqK1uG0dysm8NhsNtgxwA2diYOKWlTg==", | 119 | + "integrity": "sha512-mAOj7b4PuXRxIZkNdSkBWZ28lS2wYUY7O9u33nH9a7BawlttMNbxOgE/wDCPMrTLfj+RLQx0jvoIYj8BKCTRFw==", |
120 | "requires": { | 120 | "requires": { |
121 | "buffer": "4.9.1", | 121 | "buffer": "4.9.1", |
122 | "events": "1.1.1", | 122 | "events": "1.1.1", | ... | ... |
... | @@ -6,6 +6,7 @@ const moment = require("moment"); | ... | @@ -6,6 +6,7 @@ const moment = require("moment"); |
6 | const BUCKET_NAME = "hong-s3-cloud"; | 6 | const BUCKET_NAME = "hong-s3-cloud"; |
7 | let curPath = ""; | 7 | let curPath = ""; |
8 | let user_id = ""; | 8 | let user_id = ""; |
9 | +let parentPath = ""; | ||
9 | 10 | ||
10 | const s3 = new AWS.S3({ | 11 | const s3 = new AWS.S3({ |
11 | accessKeyId: process.env.AWS_ACCESS_KEY_ID, | 12 | accessKeyId: process.env.AWS_ACCESS_KEY_ID, |
... | @@ -17,16 +18,37 @@ router.get('/show', function(req, res, next) { | ... | @@ -17,16 +18,37 @@ router.get('/show', function(req, res, next) { |
17 | console.log(req.query); | 18 | console.log(req.query); |
18 | user_id = req.query.id; | 19 | user_id = req.query.id; |
19 | curPath = req.query.cur; | 20 | curPath = req.query.cur; |
21 | + if (curPath == '/') { | ||
22 | + parentPath = '/'; | ||
23 | + } else { | ||
24 | + let pathSplit = curPath.split('/') | ||
25 | + console.log(pathSplit); | ||
26 | + parentPath = '/'; | ||
27 | + for (let i = 1; i < pathSplit.length - 2; i++) { | ||
28 | + parentPath += pathSplit[i]; | ||
29 | + parentPath += '/'; | ||
30 | + } | ||
31 | + } | ||
20 | folders = {} | 32 | folders = {} |
21 | let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; | 33 | let checkfolder = 'SELECT * FROM folders WHERE location = ? AND user_id = ?;'; |
22 | connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) { | 34 | connection.query(checkfolder, [curPath, user_id], function(err, rows, fields) { |
23 | - if (rows.length != 0) { | 35 | + if (err) { |
24 | - res.status(200).send({ | 36 | + console.log('select error'); |
25 | - folders: rows, | 37 | + res.status(404).send() |
26 | - cur: curPath | ||
27 | - }) | ||
28 | } else { | 38 | } else { |
29 | - res.send({ error: "Does not exist" }); | 39 | + if (rows.length != 0) { |
40 | + res.status(200).send({ | ||
41 | + folders: rows, | ||
42 | + cur: curPath, | ||
43 | + parentPath: parentPath | ||
44 | + }) | ||
45 | + } else { | ||
46 | + res.status(200).send({ | ||
47 | + folders: rows, | ||
48 | + cur: curPath, | ||
49 | + parentPath: parentPath | ||
50 | + }) | ||
51 | + } | ||
30 | } | 52 | } |
31 | }); | 53 | }); |
32 | }); | 54 | }); |
... | @@ -69,8 +91,7 @@ router.post('/makefolder', function(req, res, next) { | ... | @@ -69,8 +91,7 @@ router.post('/makefolder', function(req, res, next) { |
69 | connection.query(checkfolder, [cur, user_id], function(err, rows, fields) { | 91 | connection.query(checkfolder, [cur, user_id], function(err, rows, fields) { |
70 | if (rows.length != 0) { | 92 | if (rows.length != 0) { |
71 | res.status(200).send({ | 93 | res.status(200).send({ |
72 | - folders: rows, | 94 | + folders: rows |
73 | - cur: curPath | ||
74 | }) | 95 | }) |
75 | } else { | 96 | } else { |
76 | res.send({ error: "Does not exist" }); | 97 | res.send({ error: "Does not exist" }); | ... | ... |
... | @@ -27,6 +27,7 @@ function makeFolder(folderData) { | ... | @@ -27,6 +27,7 @@ function makeFolder(folderData) { |
27 | return axios.post('/api/folder/makefolder', folderData); | 27 | return axios.post('/api/folder/makefolder', folderData); |
28 | } | 28 | } |
29 | 29 | ||
30 | +<<<<<<< HEAD | ||
30 | function file(userData){ | 31 | function file(userData){ |
31 | return axios.get('/api/file', userData, { | 32 | return axios.get('/api/file', userData, { |
32 | params: { | 33 | params: { |
... | @@ -44,3 +45,6 @@ function dropbox(userData){ | ... | @@ -44,3 +45,6 @@ function dropbox(userData){ |
44 | } | 45 | } |
45 | 46 | ||
46 | // export { registerUser, loginUser, dropbox, makeFolder }; | 47 | // export { registerUser, loginUser, dropbox, makeFolder }; |
48 | +======= | ||
49 | +export { registerUser, loginUser, folder, makeFolder }; | ||
50 | +>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36 | ... | ... |
... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
17 | <v-list-item | 17 | <v-list-item |
18 | v-for="item in this.$store.getters.folderL" | 18 | v-for="item in this.$store.getters.folderL" |
19 | :key="item.title" | 19 | :key="item.title" |
20 | - @click="$router.push({name: 'Folder'})" | 20 | + @click="moveF(item.folder_name)" |
21 | > | 21 | > |
22 | <v-list-item-avatar> | 22 | <v-list-item-avatar> |
23 | <v-icon>mdi-folder</v-icon> | 23 | <v-icon>mdi-folder</v-icon> |
... | @@ -29,6 +29,9 @@ | ... | @@ -29,6 +29,9 @@ |
29 | <v-btn icon> | 29 | <v-btn icon> |
30 | <v-icon color="grey lighten-1">mdi-information</v-icon> | 30 | <v-icon color="grey lighten-1">mdi-information</v-icon> |
31 | </v-btn> | 31 | </v-btn> |
32 | + <v-btn icon> | ||
33 | + <v-icon color="grey lighten-1">mdi-delete</v-icon> | ||
34 | + </v-btn> | ||
32 | </v-list-item-action> | 35 | </v-list-item-action> |
33 | </v-list-item> | 36 | </v-list-item> |
34 | <v-divider inset></v-divider> | 37 | <v-divider inset></v-divider> |
... | @@ -47,6 +50,9 @@ | ... | @@ -47,6 +50,9 @@ |
47 | <v-btn icon> | 50 | <v-btn icon> |
48 | <v-icon color="grey lighten-1">mdi-information</v-icon> | 51 | <v-icon color="grey lighten-1">mdi-information</v-icon> |
49 | </v-btn> | 52 | </v-btn> |
53 | + <v-btn icon> | ||
54 | + <v-icon color="grey lighten-1">mdi-delted</v-icon> | ||
55 | + </v-btn> | ||
50 | </v-list-item-action> | 56 | </v-list-item-action> |
51 | </v-list-item> | 57 | </v-list-item> |
52 | </v-list> | 58 | </v-list> |
... | @@ -101,7 +107,11 @@ | ... | @@ -101,7 +107,11 @@ |
101 | <v-container> | 107 | <v-container> |
102 | <div> | 108 | <div> |
103 | <v-icon>mdi-folder</v-icon> | 109 | <v-icon>mdi-folder</v-icon> |
110 | +<<<<<<< HEAD | ||
104 | <v-text-field placeholder="name" id="foldername" type="text" v-model="foldername" ></v-text-field> | 111 | <v-text-field placeholder="name" id="foldername" type="text" v-model="foldername" ></v-text-field> |
112 | +======= | ||
113 | + <v-text-field placeholder="name" id="foldername" type="text" v-model="foldername"></v-text-field> | ||
114 | +>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36 | ||
105 | </div> | 115 | </div> |
106 | </v-container> | 116 | </v-container> |
107 | <v-card-actions> | 117 | <v-card-actions> |
... | @@ -120,12 +130,11 @@ | ... | @@ -120,12 +130,11 @@ |
120 | </v-dialog> | 130 | </v-dialog> |
121 | </div> | 131 | </div> |
122 | </template> | 132 | </template> |
123 | - | ||
124 | <script> | 133 | <script> |
125 | import { folder, makeFolder } from '../api/index'; | 134 | import { folder, makeFolder } from '../api/index'; |
126 | export default { | 135 | export default { |
127 | data() { | 136 | data() { |
128 | - return { | 137 | + return { |
129 | foldername:'', | 138 | foldername:'', |
130 | folders: [], | 139 | folders: [], |
131 | files: [], | 140 | files: [], |
... | @@ -138,11 +147,19 @@ import { folder, makeFolder } from '../api/index'; | ... | @@ -138,11 +147,19 @@ import { folder, makeFolder } from '../api/index'; |
138 | try { | 147 | try { |
139 | const curData = { | 148 | const curData = { |
140 | id : this.$store.state.id, | 149 | id : this.$store.state.id, |
141 | - cur: this.$store.state.cur | 150 | + cur: '/' |
142 | } | 151 | } |
152 | +<<<<<<< HEAD | ||
143 | const response = await dropbox(userData); | 153 | const response = await dropbox(userData); |
144 | this.$store.commit('setFolder', response.data.folders); | 154 | this.$store.commit('setFolder', response.data.folders); |
145 | this.$store.commit('setFile', response.data.files); | 155 | this.$store.commit('setFile', response.data.files); |
156 | +======= | ||
157 | + const response = await folder(curData); | ||
158 | + console.log(response.data); | ||
159 | + this.$store.commit('setFolder', response.data.folders); | ||
160 | + this.$store.commit('setCur', response.data.cur); | ||
161 | + this.$store.commit('setParent', response.data.parentPath); | ||
162 | +>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36 | ||
146 | } catch (error) { | 163 | } catch (error) { |
147 | console.log("에러"); | 164 | console.log("에러"); |
148 | console.log(error.response.data); | 165 | console.log(error.response.data); |
... | @@ -159,10 +176,10 @@ import { folder, makeFolder } from '../api/index'; | ... | @@ -159,10 +176,10 @@ import { folder, makeFolder } from '../api/index'; |
159 | cur : this.$store.state.cur, | 176 | cur : this.$store.state.cur, |
160 | folder_name : this.foldername | 177 | folder_name : this.foldername |
161 | }; | 178 | }; |
162 | - const response = await makeFolder(folderData); | 179 | + const response = await makeFolder(folderData); |
163 | - console.log(response.data) | 180 | + console.log(response.data) |
164 | - console.log("폴더 생성 완료"); | 181 | + console.log("폴더 생성 완료"); |
165 | - this.$store.commit('setFolder', response.data.folders); | 182 | + this.$store.commit('setFolder', response.data.folders); |
166 | } catch (error) { | 183 | } catch (error) { |
167 | console.log("에러"); | 184 | console.log("에러"); |
168 | console.log(error.response.data); | 185 | console.log(error.response.data); |
... | @@ -170,8 +187,29 @@ import { folder, makeFolder } from '../api/index'; | ... | @@ -170,8 +187,29 @@ import { folder, makeFolder } from '../api/index'; |
170 | this.initFolderName(); | 187 | this.initFolderName(); |
171 | this.dialog = false; | 188 | this.dialog = false; |
172 | } | 189 | } |
190 | +<<<<<<< HEAD | ||
173 | } | 191 | } |
174 | 192 | ||
175 | } | 193 | } |
194 | +======= | ||
195 | + }, | ||
196 | + async moveF(move_folder_name){ | ||
197 | + try { | ||
198 | + const curData = { | ||
199 | + id : this.$store.state.id, | ||
200 | + cur: this.$store.state.cur + move_folder_name + '/' | ||
201 | + } | ||
202 | + const response = await folder(curData); | ||
203 | + console.log(response.data); | ||
204 | + this.$store.commit('setFolder', response.data.folders); | ||
205 | + this.$store.commit('setCur', response.data.cur); | ||
206 | + this.$store.commit('setParent', response.data.parentPath); | ||
207 | + } catch (error) { | ||
208 | + console.log("에러"); | ||
209 | + console.log(error.response.data); | ||
210 | + } | ||
211 | + } | ||
212 | + } | ||
213 | +>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36 | ||
176 | } | 214 | } |
177 | -</script> | 215 | +</script> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -<template> | ||
2 | - <div> | ||
3 | - <v-list> | ||
4 | - <v-icon>mdi-folder</v-icon> | ||
5 | - <v-header>Folders</v-header> | ||
6 | - <v-list-item | ||
7 | - v-for="item in items" | ||
8 | - :key="item.files"> | ||
9 | - | ||
10 | - </v-list-item> | ||
11 | - </v-list> | ||
12 | - </div> | ||
13 | -</template> | ||
14 | - | ||
15 | -<script> | ||
16 | -export default { | ||
17 | - props:{ | ||
18 | - | ||
19 | - } | ||
20 | -} | ||
21 | -</script> | ||
22 | - | ||
23 | -<style> | ||
24 | - | ||
25 | -</style> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -67,10 +67,14 @@ export default new VueRouter ({ | ... | @@ -67,10 +67,14 @@ export default new VueRouter ({ |
67 | name:'Feedback', | 67 | name:'Feedback', |
68 | component: () => import('../views/Feedback.vue') | 68 | component: () => import('../views/Feedback.vue') |
69 | }, | 69 | }, |
70 | +<<<<<<< HEAD | ||
70 | { | 71 | { |
71 | path: '/folder', | 72 | path: '/folder', |
72 | name: 'Folder', | 73 | name: 'Folder', |
73 | component: () => import('../views/FolderPage.vue') | 74 | component: () => import('../views/FolderPage.vue') |
74 | }, | 75 | }, |
76 | +======= | ||
77 | + | ||
78 | +>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36 | ||
75 | ] | 79 | ] |
76 | }) | 80 | }) | ... | ... |
... | @@ -9,6 +9,10 @@ export default new Vuex.Store({ | ... | @@ -9,6 +9,10 @@ export default new Vuex.Store({ |
9 | folders: {}, | 9 | folders: {}, |
10 | files: {}, | 10 | files: {}, |
11 | cur: '/', | 11 | cur: '/', |
12 | +<<<<<<< HEAD | ||
13 | +======= | ||
14 | + parent: '/' | ||
15 | +>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36 | ||
12 | }, | 16 | }, |
13 | mutations: { | 17 | mutations: { |
14 | setId(state, userid) { | 18 | setId(state, userid) { |
... | @@ -25,6 +29,9 @@ export default new Vuex.Store({ | ... | @@ -25,6 +29,9 @@ export default new Vuex.Store({ |
25 | }, | 29 | }, |
26 | setCur(state, cur) { | 30 | setCur(state, cur) { |
27 | state.cur = cur; | 31 | state.cur = cur; |
32 | + }, | ||
33 | + setParent(state, parent) { | ||
34 | + state.parent = parent; | ||
28 | } | 35 | } |
29 | }, | 36 | }, |
30 | getters: { | 37 | getters: { |
... | @@ -42,6 +49,7 @@ export default new Vuex.Store({ | ... | @@ -42,6 +49,7 @@ export default new Vuex.Store({ |
42 | }, | 49 | }, |
43 | cur(state) { | 50 | cur(state) { |
44 | return state.cur; | 51 | return state.cur; |
52 | +<<<<<<< HEAD | ||
45 | }, | 53 | }, |
46 | setFolder(state, folderlist){ | 54 | setFolder(state, folderlist){ |
47 | state.folders = folderlist; | 55 | state.folders = folderlist; |
... | @@ -50,4 +58,11 @@ export default new Vuex.Store({ | ... | @@ -50,4 +58,11 @@ export default new Vuex.Store({ |
50 | state.files = filelist; | 58 | state.files = filelist; |
51 | }, | 59 | }, |
52 | }, | 60 | }, |
61 | +======= | ||
62 | + }, | ||
63 | + parent(state) { | ||
64 | + return state.parent; | ||
65 | + } | ||
66 | + } | ||
67 | +>>>>>>> ec5658f978ed2a5a94bba39bcb9aecf9edc70c36 | ||
53 | }) | 68 | }) |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
front-end/src/views/FolderPage.vue
deleted
100644 → 0
1 | -<template> | ||
2 | - <div> | ||
3 | - <FolderList></FolderList> | ||
4 | - </div> | ||
5 | -</template> | ||
6 | - | ||
7 | -<script> | ||
8 | -import FolderList from '../components/FolderList' | ||
9 | - | ||
10 | -export default { | ||
11 | - components: { | ||
12 | - FolderList, | ||
13 | - } | ||
14 | -} | ||
15 | -</script> | ||
16 | - | ||
17 | -<style> | ||
18 | - | ||
19 | -</style> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment