refactor: привести кодовую базу в соответствие с канонами bible
- 400 → 422 для всех ошибок валидации входных данных (handlers: export, quote, sync, vendor_spec, partnumber_books, pricelist) - SQL-запросы вынесены из handlers в localdb (partnumber_books, pricelist, support_bundle); ValidateMariaDBConnection перенесён в internal/db/validate.go - List-ответы унифицированы: ключ items, поля total_count/page/per_page/total_pages (component, pricelist, partnumber_books); шаблоны обновлены - Молчаливые ошибки заменены на slog.Warn/Error (support_bundle, vendor_spec, component, configuration, local_configuration, localdb) - N+1 запросы устранены: batch-запросы в export.go и vendor_workspace_import.go - fmt.Println → slog в cmd/ (qfs, migrate, migrate_ops_projects, migrate_project_updated_at) - Заголовки recovery/verify добавлены во все 28 SQL-миграций - Добавлены bible-local/runtime-flows.md и bible-local/decisions/ - Обновлён субмодуль bible до v0.2.0-13 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -128,8 +128,8 @@ func TestExportCSV_InvalidRequest(t *testing.T) {
|
||||
handler.ExportCSV(c)
|
||||
|
||||
// Should return 400 Bad Request
|
||||
if w.Code != http.StatusBadRequest {
|
||||
t.Errorf("Expected status 400, got %d", w.Code)
|
||||
if w.Code != http.StatusUnprocessableEntity {
|
||||
t.Errorf("Expected status 422, got %d", w.Code)
|
||||
}
|
||||
|
||||
// Should return JSON error
|
||||
@@ -162,8 +162,8 @@ func TestExportCSV_EmptyItems(t *testing.T) {
|
||||
handler.ExportCSV(c)
|
||||
|
||||
// Should return 400 Bad Request (validation error from gin binding)
|
||||
if w.Code != http.StatusBadRequest {
|
||||
t.Logf("Status code: %d (expected 400 for empty items)", w.Code)
|
||||
if w.Code != http.StatusUnprocessableEntity {
|
||||
t.Logf("Status code: %d (expected 422 for empty items)", w.Code)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,8 +294,8 @@ func TestExportConfigCSV_EmptyItems(t *testing.T) {
|
||||
handler.ExportConfigCSV(c)
|
||||
|
||||
// Should return 400 Bad Request
|
||||
if w.Code != http.StatusBadRequest {
|
||||
t.Errorf("Expected status 400, got %d", w.Code)
|
||||
if w.Code != http.StatusUnprocessableEntity {
|
||||
t.Errorf("Expected status 422, got %d", w.Code)
|
||||
}
|
||||
|
||||
// Should return JSON error
|
||||
|
||||
Reference in New Issue
Block a user