chore: update book enabled status wiring
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/model/book"
|
||||
commonModel "github.com/flipped-aurora/gin-vue-admin/server/model/common"
|
||||
)
|
||||
|
||||
func validateBook(item book.Book) error {
|
||||
@@ -59,20 +58,12 @@ var validBookPublishStatuses = map[string]bool{
|
||||
book.BookPublishStatusOnShelf: true,
|
||||
}
|
||||
|
||||
var validBookAuthorStatuses = map[string]bool{
|
||||
commonModel.CommonEnabledStatusEnabled: true,
|
||||
commonModel.CommonEnabledStatusDisabled: true,
|
||||
}
|
||||
|
||||
var validBookCommentStatuses = map[string]bool{
|
||||
book.BookCommentStatusNormal: true,
|
||||
book.BookCommentStatusHidden: true,
|
||||
}
|
||||
|
||||
func validateBookAuthor(item book.BookAuthor) error {
|
||||
if item.AuthorStatus != "" && !validBookAuthorStatuses[item.AuthorStatus] {
|
||||
return errors.New("authorStatus不是有效值")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user