Files
superport/doc/server_side_database_error.md
JiWoong Sul f08b7fec79 fix: API 응답 파싱 오류 수정 및 에러 처리 개선
주요 변경사항:
- 창고 관리 API 응답 구조와 DTO 불일치 수정
  - WarehouseLocationDto에 code, manager_phone 필드 추가
  - RemoteDataSource에서 API 응답을 DTO 구조에 맞게 변환
- 회사 관리 API 응답 파싱 오류 수정
  - CompanyResponse의 필수 필드를 nullable로 변경
  - PaginatedResponse 구조 매핑 로직 개선
- 에러 처리 및 로깅 개선
  - Service Layer에 상세 에러 로깅 추가
  - Controller에서 에러 타입별 처리
- 새로운 유틸리티 추가
  - ResponseInterceptor: API 응답 정규화
  - DebugLogger: 디버깅 도구
  - HealthCheckService: 서버 상태 확인
- 문서화
  - API 통합 테스트 가이드
  - 에러 분석 보고서
  - 리팩토링 계획서
2025-07-31 19:15:39 +09:00

43 lines
1.7 KiB
Markdown

# Server-Side Database Error Report
## Issue
The `/api/dashboard/overview/stats` endpoint is returning a 500 error due to a database query issue.
## Error Details
```json
{
"success": false,
"error": {
"code": "DATABASE_ERROR",
"message": "Database error: Query Error: error returned from database: operator does not exist: character varying = equipment_status"
}
}
```
## Root Cause
The PostgreSQL database is still using the `equipment_status` ENUM type in SQL queries, but the API is now sending string values. This causes a type mismatch error when the database tries to compare `varchar` (string) with `equipment_status` (enum).
## Required Backend Fix
The backend team needs to:
1. Update all SQL queries that reference `equipment_status` to use string comparisons instead of enum comparisons
2. Or complete the database migration to convert the `equipment_status` column from ENUM to VARCHAR
## Affected Endpoints
- `/api/dashboard/overview/stats` - Currently failing with 500 error
## Frontend Status
The frontend has been updated to handle the new string-based status codes:
- Created `equipment_status_converter.dart` to convert between server codes (available, inuse, maintenance, disposed) and client codes (I, O, T, R, D, L, E)
- Updated all models to use the converter
- Other API endpoints are being tested for similar issues
## Test Results
- Authentication: ✅ Working
- Token Refresh: ✅ Working
- Recent Activities: ✅ Working
- Expiring Licenses: ✅ Working
- Overview Stats: ❌ Server-side database error
- Equipment Status Distribution: 🔄 To be tested
- Equipment List: 🔄 To be tested
- Warehouse List: 🔄 To be tested
- Company List: 🔄 To be tested