新增单词管理后台,分类有单词时禁止删除,支持 Docker 一键部署

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 22:17:08 +08:00
parent 71a6bc4aa4
commit 50190afab0
24 changed files with 5250 additions and 7 deletions
+4
View File
@@ -5,6 +5,7 @@ import (
"errors"
"net/http"
"github.com/fish/language/backend/internal/services"
"github.com/jackc/pgx/v5"
)
@@ -30,6 +31,9 @@ func MapError(err error) (status int, code int, message string) {
if errors.Is(err, pgx.ErrNoRows) {
return http.StatusNotFound, 10001, "resource not found"
}
if errors.Is(err, services.ErrCategoryNotEmpty) {
return http.StatusConflict, 10005, "category has words and cannot be deleted"
}
return http.StatusInternalServerError, 10000, "internal server error"
}