diff --git a/models/ChuckFileSaveMongo.js b/models/ChuckFileSaveMongo.js new file mode 100644 index 0000000..7c97913 --- /dev/null +++ b/models/ChuckFileSaveMongo.js @@ -0,0 +1,31 @@ +var mongoose = require('mongoose'); +var Schema = mongoose.Schema; + +var ChunkFileSaveMongo = new Schema({ + uid: { + type: String, + unique: false + }, + fieldname: { + type: String, + unique: false + }, + files_id: { + type: String, + unique: false + }, + n: { + type: String, + unique: false + }, + data: { + type: String, + unique: false + }, + id: { + type: String, + unique: false + } +}); + +module.exports = mongoose.model('ChunkFileSaveMongo', ChunkFileSaveMongo, 'fs.chunks'); diff --git a/models/ChunkFileSaveMongo.js b/models/ChunkFileSaveMongo.js new file mode 100644 index 0000000..eefb6b2 --- /dev/null +++ b/models/ChunkFileSaveMongo.js @@ -0,0 +1,30 @@ +var mongoose = require('mongoose'); +var Schema = mongoose.Schema; + +var ChunkFileSaveMongo = new Schema({ + uid: { + type: String, + unique: false + }, + fieldname: { + type: String, + unique: false + }, + files_id: { + type: String, + unique: false + }, + n: { + type: String, + unique: false + }, + data: [{ + type: String + }], + id: { + type: String, + unique: false + } +}); + +module.exports = mongoose.model('ChunkFileSaveMongo', ChunkFileSaveMongo, 'fs.chunks'); diff --git a/models/FileSaveMongo.js b/models/FileSaveMongo.js new file mode 100644 index 0000000..2236ac6 --- /dev/null +++ b/models/FileSaveMongo.js @@ -0,0 +1,63 @@ +var mongoose = require('mongoose'); +var Schema = mongoose.Schema; + +var FileSaveMongoShema = new Schema({ + uid: { + type: String, + unique: false + }, + fieldname: { + type: String, + unique: false + }, + originalname: { + type: String, + unique: false + }, + encoding: { + type: String, + unique: false + }, + mimetype: { + type: String, + unique: false + }, + id: { + type: String, + unique: false + }, + filename: { + type: String, + unique: false + }, + metadata: { + type: String, + unique: false + }, + bucketName: { + type: String, + unique: false + }, + chunkSize: { + type: String, + unique: false + }, + size: { + type: String, + unique: false + }, + md5: { + type: String, + unique: false + }, + uploadDate: { + type: String, + unique: false + }, + contentType: { + type: String, + unique: false + } +}); + +module.exports = mongoose.model('FileSaveMongo', FileSaveMongoShema, 'fs.files'); diff --git a/routes/api.js b/routes/api.js index 8140cb4..ce1f29e 100644 --- a/routes/api.js +++ b/routes/api.js @@ -111,15 +111,15 @@ router.post('/createFolder', function(req, res, next) { /* DELETE FILE */ router.post('/deleteFileMongo', function(req, res, next) { - console.log('nana : ' + JSON.stringify(req.body)); + console.log(JSON.stringify(req.body)); FileMongo.remove({_id : req.body._id, name: req.body.name, owner: req.body.owner}, function (err, post) { if (err){ - console.log('nana err : ' + err); + console.log('err deleteF ileMongo : ' + err); return next(err); } //Delete file multer dans Public - console.log('this.getStringExtention(req.body) : ' + getStringExtention(req.body)); + //console.log('this.getStringExtention(req.body) : ' + getStringExtention(req.body)); fs.unlink('./public/' + req.body._id + getStringExtention(req.body)); res.json(post); @@ -259,7 +259,7 @@ router.post('/signin', function(req, res) { // check if password matches user.comparePassword(req.body.password, function (err, isMatch) { if (isMatch && !err) { - console.log('req.user.username log : ' + JSON.stringify(user)); + console.log('user logged : ' + JSON.stringify(user)); // if user is found and password is right create a token var token = jwt.sign(user.toJSON(), config.secret); // return the information including token as JSON diff --git a/src/app/book/book.component.html b/src/app/book/book.component.html index e8a84a5..8497094 100644 --- a/src/app/book/book.component.html +++ b/src/app/book/book.component.html @@ -4,6 +4,7 @@
Espace utilisé : {{sizeFile.toString() === '0' ? '0' : (sizeFile/ ( 1024 * 1024 ) | number : '1.2-2')}} / 30 Mo
Path : {{mainFolder.path}}
Vous êtes dans le dossier : {{mainFolder.name}}
diff --git a/src/app/book/book.component.ts b/src/app/book/book.component.ts index 2c9a64a..374a4e1 100644 --- a/src/app/book/book.component.ts +++ b/src/app/book/book.component.ts @@ -25,7 +25,7 @@ export class BookComponent implements OnInit, OnDestroy { @Output() setAllUserAppFolder = new EventEmitter