update
Took 14 minutes
This commit is contained in:
parent
937f825e82
commit
119cf57850
@ -10,4 +10,5 @@ export enum RequestType {
|
||||
CHECK = "CHECK",
|
||||
UPDATE = "UPDATE",
|
||||
INFO = "INFO",
|
||||
CLEAR_DB = "CLEAR_DB"
|
||||
}
|
@ -17,6 +17,8 @@ import {ArduinoProxy} from "../../ArduinoProxy";
|
||||
import {ContainerHelper} from "../../ContainerHelper";
|
||||
import * as os from "os";
|
||||
import {promisify} from "util";
|
||||
import Drink from "../../database/Drink";
|
||||
|
||||
const exec = promisify(require('child_process').exec)
|
||||
|
||||
const express = require('express');
|
||||
@ -344,7 +346,21 @@ router.ws('/', async (ws, req, next) => {
|
||||
"contact": "tobi@gaminggeneration.de"
|
||||
}
|
||||
|
||||
return WebSocketHandler.answerRequest(msg.data["type"] as RequestType, data);
|
||||
WebSocketHandler.answerRequest(msg.data["type"] as RequestType, data);
|
||||
break;
|
||||
}
|
||||
|
||||
case RequestType.CLEAR_DB: {
|
||||
await Drink.deleteMany({});
|
||||
await Ingredient.deleteMany({});
|
||||
for( let c of (await Container.find()) )
|
||||
{
|
||||
c.content = undefined;
|
||||
c.save();
|
||||
}
|
||||
|
||||
await iTender.refreshDrinks();
|
||||
WebSocketHandler.answerRequest(msg.data["type"] as RequestType, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user