feat(backend): add custom preferences

This commit is contained in:
Sam 2023-04-19 12:00:21 +02:00 committed by Gitea
parent e8ea642260
commit 2c71741d7c
8 changed files with 39 additions and 34 deletions

View file

@ -24,7 +24,7 @@ type Field struct {
}
// Validate validates this field. If it is invalid, a non-empty string is returned as error message.
func (f Field) Validate() string {
func (f Field) Validate(custom CustomPreferences) string {
if f.Name == "" {
return "name cannot be empty"
}
@ -42,7 +42,7 @@ func (f Field) Validate() string {
return fmt.Sprintf("entries.%d: max length is %d characters, length is %d", i, FieldEntryMaxLength, length)
}
if !entry.Status.Valid() {
if !entry.Status.Valid(custom) {
return fmt.Sprintf("entries.%d: status is invalid", i)
}
}