place/api/write/write.go

34 lines
542 B
Go
Raw Normal View History

2024-06-12 18:44:12 +00:00
package write
2024-06-13 11:25:18 +00:00
import (
"errors"
"git.tek.govt.hu/dowerx/place/api/structs"
"git.tek.govt.hu/dowerx/place/storage"
"github.com/gin-gonic/gin"
)
2024-06-12 18:44:12 +00:00
func Pixel(c *gin.Context) {
2024-06-13 11:25:18 +00:00
// TODO: apply timeout using cookies
var info struct {
structs.Color
structs.Coordinates
}
if c.ShouldBind(&info) != nil {
c.AbortWithStatus(400)
return
}
2024-06-12 18:44:12 +00:00
2024-06-13 11:25:18 +00:00
if err := storage.SetPixel(info.X, info.Y, &info); err != nil {
c.AbortWithError(500, err)
return
}
c.Status(200)
2024-06-12 18:44:12 +00:00
}
func Bitmap(c *gin.Context) {
2024-06-13 11:25:18 +00:00
panic(errors.New("unimplomented"))
2024-06-12 18:44:12 +00:00
}