added handling for development server file system

This commit is contained in:
David Baldwynn 2015-07-29 17:32:46 -07:00
parent c271052be3
commit 4be6210134
2 changed files with 20 additions and 21 deletions

View file

@ -95,18 +95,14 @@ var FormSchema = new Schema({
},
font: String,
<<<<<<< HEAD
backgroundImage: { type: Schema.Types.Mixed }
=======
backgroundImage: type: Schema.Types.Mixed
>>>>>>> 33243bea2a1f74f8f417b240f5ad068c1d05c6bd
}
});
//Delete template PDF of current Form
FormSchema.pre('remove', function (next) {
if(this.pdf){
if(this.pdf && process.env.NODE_ENV === 'development'){
//Delete template form
fs.unlink(this.pdf.path, function(err){
if (err) throw err;

View file

@ -106,6 +106,7 @@ UserSchema.virtual('displayName').get(function () {
//Create folder for user's pdfs
UserSchema.pre('save', function (next) {
if(process.env.NODE_ENV === 'development'){
if(!this.username || this.username !== this.email){
this.username = this.email;
}
@ -123,6 +124,8 @@ UserSchema.pre('save', function (next) {
}else{
next();
}
}
next();
});
/**