=priority: load heats
This commit is contained in:
parent
95d3b8ae4a
commit
50a1d74e65
10 changed files with 75 additions and 18 deletions
|
@ -8,6 +8,7 @@ func (w *Webapp) initApi() {
|
|||
|
||||
http_api := w.Engine.Group("/api")
|
||||
http_api.GET("/priority", w.GetPriority)
|
||||
http_api.GET("/load", w.LoadHeats)
|
||||
http_api.POST("/priority", w.SetPriority)
|
||||
http_api.POST("/start", w.StartTimer)
|
||||
|
||||
|
|
BIN
backend/backend
BIN
backend/backend
Binary file not shown.
|
@ -1,6 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
@ -35,6 +37,27 @@ func (w *Webapp) StartTimer(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, w.Stream.Duration)
|
||||
}
|
||||
|
||||
func (w *Webapp) LoadHeats(c *gin.Context) {
|
||||
records, err := w.DB.ReadAll("Heat")
|
||||
if err != nil {
|
||||
fmt.Printf("read error: %+v", err)
|
||||
}
|
||||
|
||||
heats := make([]Heat, 0)
|
||||
for _, record := range records {
|
||||
var heat Heat
|
||||
err = json.Unmarshal([]byte(record), &heat)
|
||||
if err != nil {
|
||||
fmt.Printf("decode error: %+v", err)
|
||||
}
|
||||
heats = append(heats, heat)
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, heats)
|
||||
|
||||
log.Printf("heats: %+v", heats)
|
||||
}
|
||||
|
||||
func (w *Webapp) GetPriority(c *gin.Context) {
|
||||
log.Printf("send priority %s", w.Stream.StatusPriority)
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":"1702469015168"}
|
||||
{"version":"1702477632110"}
|
Binary file not shown.
Binary file not shown.
|
@ -5,17 +5,17 @@
|
|||
<link rel="icon" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<link rel="modulepreload" href="/_app/immutable/entry/start.8c98c732.js">
|
||||
<link rel="modulepreload" href="/_app/immutable/entry/start.f2f23bb5.js">
|
||||
<link rel="modulepreload" href="/_app/immutable/chunks/scheduler.d1a939e8.js">
|
||||
<link rel="modulepreload" href="/_app/immutable/chunks/singletons.505cc11c.js">
|
||||
<link rel="modulepreload" href="/_app/immutable/entry/app.fd492588.js">
|
||||
<link rel="modulepreload" href="/_app/immutable/chunks/index.c2132433.js">
|
||||
<link rel="modulepreload" href="/_app/immutable/chunks/singletons.f3cb4e26.js">
|
||||
<link rel="modulepreload" href="/_app/immutable/entry/app.c3a1467b.js">
|
||||
<link rel="modulepreload" href="/_app/immutable/chunks/index.994dd985.js">
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">
|
||||
<script>
|
||||
{
|
||||
__sveltekit_r51frl = {
|
||||
__sveltekit_1cx8eia = {
|
||||
base: "",
|
||||
env: {}
|
||||
};
|
||||
|
@ -23,8 +23,8 @@
|
|||
const element = document.currentScript.parentElement;
|
||||
|
||||
Promise.all([
|
||||
import("/_app/immutable/entry/start.8c98c732.js"),
|
||||
import("/_app/immutable/entry/app.fd492588.js")
|
||||
import("/_app/immutable/entry/start.f2f23bb5.js"),
|
||||
import("/_app/immutable/entry/app.c3a1467b.js")
|
||||
]).then(([kit, app]) => {
|
||||
kit.start(app, element);
|
||||
});
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue