## 주요 변경사항 - Company, Equipment, License, Warehouse Location 모든 화면에 소프트 딜리트 구현 - 관리자 권한으로 삭제된 데이터 조회 가능 (includeInactive 파라미터) - 데이터 무결성 보장을 위한 논리 삭제 시스템 완성 ## 기능 개선 - 각 리스트 컨트롤러에 toggleIncludeInactive() 메서드 추가 - UI에 "비활성 포함" 체크박스 추가 (관리자 전용) - API 데이터소스에 includeInactive 파라미터 지원 ## 문서 정리 - 불필요한 문서 파일 제거 및 재구성 - CLAUDE.md 프로젝트 상태 업데이트 (진행률 80%) - 테스트 결과 문서화 (test20250812v01.md) ## UI 컴포넌트 - Equipment 화면 위젯 모듈화 (custom_dropdown_field, equipment_basic_info_section) - 폼 유효성 검증 강화 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
148 lines
4.9 KiB
Dart
148 lines
4.9 KiB
Dart
import 'package:dio/dio.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:superport/core/config/environment.dart';
|
|
|
|
void main() {
|
|
late Dio dio;
|
|
|
|
setUpAll(() {
|
|
dio = Dio(BaseOptions(
|
|
baseUrl: Environment.apiBaseUrl,
|
|
connectTimeout: const Duration(seconds: 30),
|
|
receiveTimeout: const Duration(seconds: 30),
|
|
));
|
|
});
|
|
|
|
group('API Count Debugging', () {
|
|
test('Check all entity counts from API', () async {
|
|
// 먼저 로그인
|
|
final loginResponse = await dio.post('/auth/login', data: {
|
|
'email': 'admin@superport.kr',
|
|
'password': 'admin123!',
|
|
});
|
|
|
|
final token = loginResponse.data['data']['access_token'];
|
|
dio.options.headers['Authorization'] = 'Bearer $token';
|
|
|
|
print('\n========== API 카운트 디버깅 ==========\n');
|
|
|
|
// 1. 장비 개수 확인
|
|
try {
|
|
final equipmentResponse = await dio.get('/equipment', queryParameters: {
|
|
'page': 1,
|
|
'per_page': 1,
|
|
});
|
|
final equipmentTotal = equipmentResponse.data['pagination']['total'];
|
|
print('✅ 장비: $equipmentTotal개');
|
|
} catch (e) {
|
|
print('❌ 장비 조회 실패: $e');
|
|
}
|
|
|
|
// 2. 입고지 개수 확인
|
|
try {
|
|
final warehouseResponse = await dio.get('/warehouse-locations', queryParameters: {
|
|
'page': 1,
|
|
'per_page': 1,
|
|
});
|
|
final warehouseTotal = warehouseResponse.data['pagination']['total'];
|
|
print('✅ 입고지: $warehouseTotal개');
|
|
} catch (e) {
|
|
print('❌ 입고지 조회 실패: $e');
|
|
}
|
|
|
|
// 3. 회사 개수 확인
|
|
try {
|
|
final companyResponse = await dio.get('/companies', queryParameters: {
|
|
'page': 1,
|
|
'per_page': 1,
|
|
});
|
|
final companyTotal = companyResponse.data['pagination']['total'];
|
|
print('✅ 회사: $companyTotal개');
|
|
|
|
// 회사별 지점 개수 확인
|
|
final allCompaniesResponse = await dio.get('/companies', queryParameters: {
|
|
'page': 1,
|
|
'per_page': 100,
|
|
});
|
|
|
|
int totalBranches = 0;
|
|
final companies = allCompaniesResponse.data['data'] as List;
|
|
for (var company in companies) {
|
|
final branches = company['branches'] as List?;
|
|
if (branches != null) {
|
|
totalBranches += branches.length;
|
|
}
|
|
}
|
|
print(' └─ 지점: $totalBranches개');
|
|
print(' └─ 회사 + 지점 총합: ${companyTotal + totalBranches}개');
|
|
|
|
// 실제 회사 목록 확인
|
|
print('\n 회사 목록 샘플:');
|
|
for (var i = 0; i < companies.length && i < 5; i++) {
|
|
print(' - ${companies[i]['name']} (ID: ${companies[i]['id']})');
|
|
}
|
|
if (companies.length > 5) {
|
|
print(' ... 그 외 ${companies.length - 5}개');
|
|
}
|
|
} catch (e) {
|
|
print('❌ 회사 조회 실패: $e');
|
|
}
|
|
|
|
// 4. 유지보수 개수 확인
|
|
try {
|
|
final licenseResponse = await dio.get('/licenses', queryParameters: {
|
|
'page': 1,
|
|
'per_page': 1,
|
|
});
|
|
final licenseTotal = licenseResponse.data['pagination']['total'];
|
|
print('✅ 유지보수: $licenseTotal개');
|
|
} catch (e) {
|
|
print('❌ 유지보수 조회 실패: $e');
|
|
}
|
|
|
|
print('\n========================================\n');
|
|
|
|
print('\n========== 전체 데이터 조회 ==========\n');
|
|
|
|
// 입고지 전체 데이터 조회해서 실제 개수 확인
|
|
try {
|
|
final warehouseAllResponse = await dio.get('/warehouse-locations', queryParameters: {
|
|
'page': 1,
|
|
'per_page': 100,
|
|
});
|
|
final warehouseData = warehouseAllResponse.data['data'] as List;
|
|
print('입고지 실제 반환된 데이터 개수: ${warehouseData.length}개');
|
|
print('입고지 pagination.total: ${warehouseAllResponse.data['pagination']['total']}');
|
|
|
|
// ID 중복 확인
|
|
final warehouseIds = <int>{};
|
|
final duplicateIds = <int>{};
|
|
for (var warehouse in warehouseData) {
|
|
final id = warehouse['id'] as int;
|
|
if (warehouseIds.contains(id)) {
|
|
duplicateIds.add(id);
|
|
}
|
|
warehouseIds.add(id);
|
|
}
|
|
|
|
if (duplicateIds.isNotEmpty) {
|
|
print('⚠️ 중복된 ID 발견: $duplicateIds');
|
|
} else {
|
|
print('✅ ID 중복 없음');
|
|
}
|
|
|
|
// 각 입고지 정보 출력
|
|
for (var i = 0; i < warehouseData.length && i < 10; i++) {
|
|
print(' - ${warehouseData[i]['name']} (ID: ${warehouseData[i]['id']})');
|
|
}
|
|
if (warehouseData.length > 10) {
|
|
print(' ... 그 외 ${warehouseData.length - 10}개');
|
|
}
|
|
} catch (e) {
|
|
print('❌ 입고지 전체 조회 실패: $e');
|
|
}
|
|
|
|
print('\n========================================\n');
|
|
});
|
|
});
|
|
} |