feat(!): use strings for WordStatus enum instead of ints

This commit is contained in:
Sam 2023-03-29 23:59:51 +02:00
parent 11ef4d548a
commit 96376516b0
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
3 changed files with 56 additions and 20 deletions

View file

@ -42,8 +42,8 @@ func (f Field) Validate() string {
return fmt.Sprintf("entries.%d: max length is %d characters, length is %d", i, FieldEntryMaxLength, length)
}
if entry.Status == StatusUnknown || entry.Status >= wordStatusMax {
return fmt.Sprintf("entries.%d: status is invalid, must be between 1 and %d, is %d", i, wordStatusMax-1, entry.Status)
if !entry.Status.Valid() {
return fmt.Sprintf("entries.%d: status is invalid", i)
}
}