fix(backend): use to-be-set custom preferences when validating fields, remove constants
This commit is contained in:
parent
6dd3478ff9
commit
5594463a09
4 changed files with 47 additions and 52 deletions
|
@ -7,15 +7,6 @@ import (
|
|||
|
||||
type WordStatus string
|
||||
|
||||
const (
|
||||
StatusUnknown WordStatus = ""
|
||||
StatusFavourite WordStatus = "favourite"
|
||||
StatusOkay WordStatus = "okay"
|
||||
StatusJokingly WordStatus = "jokingly"
|
||||
StatusFriendsOnly WordStatus = "friends_only"
|
||||
StatusAvoid WordStatus = "avoid"
|
||||
)
|
||||
|
||||
func (w *WordStatus) UnmarshalJSON(src []byte) error {
|
||||
if string(src) == "null" {
|
||||
return nil
|
||||
|
@ -41,7 +32,7 @@ func (w *WordStatus) UnmarshalJSON(src []byte) error {
|
|||
}
|
||||
|
||||
func (w WordStatus) Valid(extra CustomPreferences) bool {
|
||||
if w == StatusFavourite || w == StatusOkay || w == StatusJokingly || w == StatusFriendsOnly || w == StatusAvoid {
|
||||
if w == "favourite" || w == "okay" || w == "jokingly" || w == "friends_only" || w == "avoid" {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue