fixes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
choelzl 2021-07-16 11:58:43 +02:00
parent 24e99bb41d
commit f42e57a3b3
Signed by: sora
GPG Key ID: A362EA0491E2EEA0
3 changed files with 10 additions and 20 deletions

View File

@ -40,17 +40,9 @@ function compileSassProduction(sassFile) {
const cssPath = path.join(__dirname, 'public/css/'); const cssPath = path.join(__dirname, 'public/css/');
const fullCssPath = path.join(cssPath, cssFile); const fullCssPath = path.join(cssPath, cssFile);
return compileSass(fullSassPath).then(css => { return compileSass(fullSassPath).then(css =>
return new Promise((resolve, reject) => { mkdirp(cssPath).then(() =>
mkdirp(cssPath, error => { new Promise((resolve, reject) => {
if (error) {
return reject(error);
}
resolve();
});
}).then(() => {
return new Promise((resolve, reject) => {
fs.writeFile(fullCssPath, css, error => { fs.writeFile(fullCssPath, css, error => {
if (error) { if (error) {
return reject(error); return reject(error);
@ -58,9 +50,9 @@ function compileSassProduction(sassFile) {
resolve(cssFile); resolve(cssFile);
}); });
}); })
}).catch(console.error); )
}); ).catch(console.error);;
} }
function compileSassMain() { function compileSassMain() {

View File

@ -18,6 +18,7 @@
"fastify": "latest", "fastify": "latest",
"fastify-leveldb": "latest", "fastify-leveldb": "latest",
"fastify-static": "^2.5.0", "fastify-static": "^2.5.0",
"mkdirp": "^1.0.4",
"node-sass": "^6.0.0" "node-sass": "^6.0.0"
} }
} }

View File

@ -24,8 +24,7 @@ module.exports = (fastify, opts, done) => {
if(req.params.id == undefined){ if(req.params.id == undefined){
reply.code(400).send({error:"No ID query parameter"}); reply.code(400).send({error:"No ID query parameter"});
} else { } else {
const { level } = fastify fastify.level.get(req.params.id, (err, val) => {
level.get(req.params.id, (err, val) => {
if(err){ if(err){
console.warn(err); console.warn(err);
reply.send({name:"New Journey", main:[]}); reply.send({name:"New Journey", main:[]});
@ -40,8 +39,7 @@ module.exports = (fastify, opts, done) => {
if(req.params.id == undefined){ if(req.params.id == undefined){
reply.code(400).send({error:"No ID query parameter"}); reply.code(400).send({error:"No ID query parameter"});
} else { } else {
const { level } = fastify fastify.level.put(req.params.id, JSON.stringify(req.body), (err) => {
level.put(req.params.id, JSON.stringify(req.body), (err) => {
if(err){ if(err){
console.warn(err); console.warn(err);
reply.code(500).send({error:"Error with DB"}); reply.code(500).send({error:"Error with DB"});
@ -56,8 +54,7 @@ module.exports = (fastify, opts, done) => {
if(req.params.id == undefined){ if(req.params.id == undefined){
reply.code(400).send({error:"No ID query parameter"}); reply.code(400).send({error:"No ID query parameter"});
} else { } else {
const { level } = fastify fastify.level.delete(req.params.id,(err) => {
level.delete(req.params.id,(err) => {
if(err){ if(err){
console.warn(err); console.warn(err);
reply.code(500).send({error:"Error with DB"}); reply.code(500).send({error:"Error with DB"});