Merge branch 'asmodeus' of git.aiterp.net:lucifer/new-server into asmodeus
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ type DriverKind string
|
||||
|
||||
var (
|
||||
DTHue DriverKind = "Hue"
|
||||
DTNanoLeaf DriverKind = "NanoLeaf"
|
||||
DTNanoLeaf DriverKind = "Nanoleaf"
|
||||
)
|
||||
|
||||
var ValidDriverKinds = []DriverKind{
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ColorPreset struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Value ColorValue `json:"value"`
|
||||
}
|
||||
|
||||
type ColorPresetRepository interface {
|
||||
Find(ctx context.Context, id int) (ColorPreset, error)
|
||||
FetchAll(ctx context.Context) ([]ColorPreset, error)
|
||||
Save(ctx context.Context, preset *ColorPreset) error
|
||||
Delete(ctx context.Context, preset *ColorPreset) error
|
||||
}
|
||||
|
||||
func (c *ColorPreset) Validate() {
|
||||
c.Name = strings.Trim(c.Name, " \t\n")
|
||||
if len(c.Name) == 0 {
|
||||
c.Name = c.Value.String()
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ var ErrBadInput = errors.New("bad input")
|
||||
var ErrBadColor = errors.New("bad color")
|
||||
var ErrInternal = errors.New("internal")
|
||||
var ErrUnknownColorFormat = errors.New("unknown color format")
|
||||
var ErrUnknownDriver = errors.New("unknown driver")
|
||||
|
||||
var ErrMissingToken = errors.New("driver is missing authentication information")
|
||||
var ErrIncorrectToken = errors.New("driver is not accepting authentication information")
|
||||
|
||||
Reference in New Issue
Block a user