feat: remove state message retrieval and associated SQLite storage
This commit is contained in:
@@ -10,7 +10,6 @@ import (
|
||||
"time"
|
||||
|
||||
"git.piskot.si/SeminarM2/lambdaiot-core/internal/mqtt"
|
||||
"git.piskot.si/SeminarM2/lambdaiot-core/internal/storage"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
"github.com/google/uuid"
|
||||
@@ -502,29 +501,6 @@ func Protected(c *gin.Context) {
|
||||
c.JSON(http.StatusUnauthorized, gin.H{"error": "no claims"})
|
||||
}
|
||||
|
||||
// GetMessages returns the last 100 state messages with optional pagination
|
||||
// query parameter: ?page=N (0-based)
|
||||
func GetMessages(c *gin.Context) {
|
||||
page := 0
|
||||
if p := c.Query("page"); p != "" {
|
||||
if n, err := strconv.Atoi(p); err == nil && n >= 0 {
|
||||
page = n
|
||||
}
|
||||
}
|
||||
limit := 100
|
||||
offset := page * limit
|
||||
if storage.Default == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "storage not initialized"})
|
||||
return
|
||||
}
|
||||
msgs, err := storage.Default.QueryMessages(limit, offset)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"messages": msgs})
|
||||
}
|
||||
|
||||
// Actor CRUD
|
||||
func (h *Handler) CreateActor(c *gin.Context) {
|
||||
var req struct {
|
||||
|
||||
Reference in New Issue
Block a user