leeseohyeon

db에 파일 위치 분리

...@@ -8,8 +8,7 @@ var S3 = require('../modules/s3/s3'); ...@@ -8,8 +8,7 @@ var S3 = require('../modules/s3/s3');
8 8
9 // /file/delete/:name 9 // /file/delete/:name
10 router.get('/:name', function (req, res) { 10 router.get('/:name', function (req, res) {
11 - //var user_id = req.session.user_id; 11 + var user_id = req.session.user_id;
12 - var user_id = 'shlee';
13 12
14 var sourceFile = req.params.name; 13 var sourceFile = req.params.name;
15 var targetPath = 'trashcan'; 14 var targetPath = 'trashcan';
......
...@@ -11,8 +11,7 @@ var S3 = require('../modules/s3/s3'); ...@@ -11,8 +11,7 @@ var S3 = require('../modules/s3/s3');
11 // /file/download/:name 11 // /file/download/:name
12 router.get('/:name', function (req, res) { 12 router.get('/:name', function (req, res) {
13 var file_name = req.params.name; 13 var file_name = req.params.name;
14 - //var user_id = req.session.user_id; 14 + var user_id = req.session.user_id;
15 - var user_id = 'shlee';
16 15
17 var sourceFile = file_name; 16 var sourceFile = file_name;
18 var tempDownloadDir = __dirname + '/../modules/s3/download/' + user_id + '/' + file_name; 17 var tempDownloadDir = __dirname + '/../modules/s3/download/' + user_id + '/' + file_name;
......
...@@ -7,7 +7,7 @@ var S3 = require('../modules/s3/s3'); ...@@ -7,7 +7,7 @@ var S3 = require('../modules/s3/s3');
7 7
8 8
9 router.get('/', function (req, res) { 9 router.get('/', function (req, res) {
10 - var user_id = req.query.user_id; 10 + var user_id = req.session.user_id;
11 11
12 var sql = 'SELECT * FROM files WHERE user_id = (?) ORDER BY date DESC'; 12 var sql = 'SELECT * FROM files WHERE user_id = (?) ORDER BY date DESC';
13 connection.query(sql, user_id, function (err, result) { 13 connection.query(sql, user_id, function (err, result) {
...@@ -22,7 +22,7 @@ router.get('/', function (req, res) { ...@@ -22,7 +22,7 @@ router.get('/', function (req, res) {
22 // /file/:name 22 // /file/:name
23 router.get('/:name', function (req, res) { 23 router.get('/:name', function (req, res) {
24 var file_name = req.params.name; 24 var file_name = req.params.name;
25 - var user_id = req.query.user_id; 25 + var user_id = req.session.user_id;
26 26
27 var s3 = new AWS.S3(); 27 var s3 = new AWS.S3();
28 28
......
...@@ -11,8 +11,7 @@ var S3 = require('../modules/s3/s3'); ...@@ -11,8 +11,7 @@ var S3 = require('../modules/s3/s3');
11 11
12 // /file/upload 12 // /file/upload
13 router.post('/', function (req, res) { 13 router.post('/', function (req, res) {
14 - //var user_id = req.body.user_id; 14 + var user_id = req.session.user_id;
15 - var user_id = 'shlee';
16 15
17 var sourceFiles = []; 16 var sourceFiles = [];
18 var errFiles = []; 17 var errFiles = [];
......