added handling for development server file system
This commit is contained in:
parent
c271052be3
commit
4be6210134
|
@ -95,18 +95,14 @@ var FormSchema = new Schema({
|
||||||
|
|
||||||
},
|
},
|
||||||
font: String,
|
font: String,
|
||||||
<<<<<<< HEAD
|
|
||||||
backgroundImage: { type: Schema.Types.Mixed }
|
backgroundImage: { type: Schema.Types.Mixed }
|
||||||
=======
|
|
||||||
backgroundImage: type: Schema.Types.Mixed
|
|
||||||
>>>>>>> 33243bea2a1f74f8f417b240f5ad068c1d05c6bd
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//Delete template PDF of current Form
|
//Delete template PDF of current Form
|
||||||
FormSchema.pre('remove', function (next) {
|
FormSchema.pre('remove', function (next) {
|
||||||
if(this.pdf){
|
if(this.pdf && process.env.NODE_ENV === 'development'){
|
||||||
//Delete template form
|
//Delete template form
|
||||||
fs.unlink(this.pdf.path, function(err){
|
fs.unlink(this.pdf.path, function(err){
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
|
@ -106,6 +106,7 @@ UserSchema.virtual('displayName').get(function () {
|
||||||
|
|
||||||
//Create folder for user's pdfs
|
//Create folder for user's pdfs
|
||||||
UserSchema.pre('save', function (next) {
|
UserSchema.pre('save', function (next) {
|
||||||
|
if(process.env.NODE_ENV === 'development'){
|
||||||
if(!this.username || this.username !== this.email){
|
if(!this.username || this.username !== this.email){
|
||||||
this.username = this.email;
|
this.username = this.email;
|
||||||
}
|
}
|
||||||
|
@ -123,6 +124,8 @@ UserSchema.pre('save', function (next) {
|
||||||
}else{
|
}else{
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue