You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
622 B
27 lines
622 B
package models
|
|
|
|
import (
|
|
"context"
|
|
"git.aiterp.net/lucifer/new-server/internal/color"
|
|
"strings"
|
|
)
|
|
|
|
type ColorPreset struct {
|
|
ID int `json:"id"`
|
|
Name string `json:"name"`
|
|
Value color.Color `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()
|
|
}
|
|
}
|