chore: update book enabled status wiring

This commit is contained in:
2026-04-27 11:41:35 +08:00
parent 93bde0a6b6
commit 67c33d06be
25 changed files with 336 additions and 122 deletions

View File

@@ -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
}