mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Jump to 0.3.1
This commit is contained in:
parent
f7f8c901f4
commit
10c9811fc5
49 changed files with 2336 additions and 448 deletions
13
lib/temp.js
13
lib/temp.js
|
@ -4,6 +4,7 @@ var mongoose = require('mongoose');
|
|||
|
||||
//core
|
||||
var config = require("../config.js");
|
||||
var logger = require("./logger.js");
|
||||
|
||||
// create a temp model
|
||||
var model = mongoose.model('temp', {
|
||||
|
@ -33,13 +34,13 @@ function findTemp(id, callback) {
|
|||
id: id
|
||||
}, function (err, temp) {
|
||||
if (err) {
|
||||
console.log('find temp failed: ' + err);
|
||||
logger.error('find temp failed: ' + err);
|
||||
callback(err, null);
|
||||
}
|
||||
if (!err && temp) {
|
||||
callback(null, temp);
|
||||
} else {
|
||||
console.log('find temp failed: ' + err);
|
||||
logger.error('find temp failed: ' + err);
|
||||
callback(err, null);
|
||||
};
|
||||
});
|
||||
|
@ -53,10 +54,10 @@ function newTemp(id, data, callback) {
|
|||
});
|
||||
temp.save(function (err) {
|
||||
if (err) {
|
||||
console.log('new temp failed: ' + err);
|
||||
logger.error('new temp failed: ' + err);
|
||||
callback(err, null);
|
||||
} else {
|
||||
console.log("new temp success: " + temp.id);
|
||||
logger.info("new temp success: " + temp.id);
|
||||
callback(null, temp);
|
||||
};
|
||||
});
|
||||
|
@ -67,14 +68,14 @@ function removeTemp(id, callback) {
|
|||
if(!err && temp) {
|
||||
temp.remove(function(err) {
|
||||
if(err) {
|
||||
console.log('remove temp failed: ' + err);
|
||||
logger.error('remove temp failed: ' + err);
|
||||
callback(err, null);
|
||||
} else {
|
||||
callback(null, null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log('remove temp failed: ' + err);
|
||||
logger.error('remove temp failed: ' + err);
|
||||
callback(err, null);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue