feat(approvals): Approval Flow v2 프런트엔드 전면 개편
- 환경/라우터 모듈에 approval_flow_v2 토글을 추가하고 FeatureFlags 초기화를 연결 (.env*, lib/core/**) - ApiClient 빌더·ApiRoutes 확장과 ApprovalRepositoryRemote 리팩터링으로 include·액션 시그니처를 정합화 - ApprovalFlow·ApprovalDraft 엔티티/레포/유즈케이스를 도입해 서버 초안과 단계 액션(승인·회수·재상신)을 지원 - Approval 컨트롤러·히스토리·템플릿 페이지와 공유 위젯을 재작성해 감사 로그·회수 UX·템플릿 CRUD를 반영 - Inbound/Outbound/Rental 컨트롤러·페이지에 결재 섹션을 삽입하고 대시보드 pending 카드 요약을 갱신 - SuperportDialog·FormField 등 공통 위젯을 보강하고 승인 위젯 가이드를 추가해 UI 가이드를 정리 - 결재/재고 테스트 픽스처와 단위·위젯·통합 테스트를 확장하고 flutter_test_config로 스테이징 호스트를 허용 - Approval Flow 레포트/플랜 문서를 업데이트하고 ApprovalFlow_System_Integration_and_ChangePlan.md를 추가 - 실행: flutter analyze, flutter test
This commit is contained in:
15
test/helpers/fixture_loader.dart
Normal file
15
test/helpers/fixture_loader.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
/// test/fixtures 디렉터리의 JSON 파일을 읽어 Map으로 반환한다.
|
||||
Map<String, dynamic> loadJsonFixture(String relativePath) {
|
||||
final file = File('test/fixtures/$relativePath');
|
||||
final contents = file.readAsStringSync();
|
||||
return json.decode(contents) as Map<String, dynamic>;
|
||||
}
|
||||
|
||||
/// test/fixtures 디렉터리의 텍스트 파일을 그대로 읽어온다.
|
||||
String readFixture(String relativePath) {
|
||||
final file = File('test/fixtures/$relativePath');
|
||||
return file.readAsStringSync();
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import 'package:superport_v2/features/inventory/lookups/domain/repositories/inve
|
||||
import 'package:superport_v2/features/inventory/transactions/domain/entities/stock_transaction.dart';
|
||||
import 'package:superport_v2/features/inventory/transactions/domain/entities/stock_transaction_input.dart';
|
||||
import 'package:superport_v2/features/inventory/transactions/domain/repositories/stock_transaction_repository.dart';
|
||||
import 'package:superport_v2/features/masters/product/domain/entities/product.dart';
|
||||
import 'package:superport_v2/features/masters/product/domain/repositories/product_repository.dart';
|
||||
import 'package:superport_v2/features/masters/warehouse/domain/entities/warehouse.dart';
|
||||
import 'package:superport_v2/features/masters/warehouse/domain/repositories/warehouse_repository.dart';
|
||||
|
||||
@@ -26,9 +28,13 @@ const int _statusRentalFinishedId = 33;
|
||||
StockTransactionListFilter? lastTransactionListFilter;
|
||||
|
||||
class InventoryTestStubConfig {
|
||||
const InventoryTestStubConfig({this.submitFailure});
|
||||
const InventoryTestStubConfig({
|
||||
this.submitFailure,
|
||||
this.registerProductRepository = false,
|
||||
});
|
||||
|
||||
final ApiException? submitFailure;
|
||||
final bool registerProductRepository;
|
||||
}
|
||||
|
||||
InventoryTestStubConfig _stubConfig = const InventoryTestStubConfig();
|
||||
@@ -55,6 +61,10 @@ void registerInventoryTestStubs([
|
||||
LookupItem(id: _statusRentalReturnWaitId, name: '반납대기'),
|
||||
LookupItem(id: _statusRentalFinishedId, name: '완료'),
|
||||
],
|
||||
approvalStatuses: [
|
||||
LookupItem(id: 401, name: '승인대기', isDefault: true),
|
||||
LookupItem(id: 402, name: '승인완료'),
|
||||
],
|
||||
);
|
||||
|
||||
final transactions = _buildTransactions();
|
||||
@@ -73,7 +83,6 @@ void registerInventoryTestStubs([
|
||||
Warehouse(id: 3, warehouseCode: 'WH-003', warehouseName: '대전 물류'),
|
||||
];
|
||||
final warehouseRepository = _StubWarehouseRepository(warehouses: warehouses);
|
||||
|
||||
final getIt = GetIt.I;
|
||||
if (getIt.isRegistered<InventoryLookupRepository>()) {
|
||||
getIt.unregister<InventoryLookupRepository>();
|
||||
@@ -95,17 +104,52 @@ void registerInventoryTestStubs([
|
||||
getIt.registerSingleton<TransactionLineRepository>(lineRepository);
|
||||
getIt.registerSingleton<TransactionCustomerRepository>(customerRepository);
|
||||
getIt.registerSingleton<WarehouseRepository>(warehouseRepository);
|
||||
if (config.registerProductRepository) {
|
||||
final products = [
|
||||
Product(
|
||||
id: 501,
|
||||
productCode: 'XR-5000',
|
||||
productName: 'XR-5000',
|
||||
vendor: ProductVendor(
|
||||
id: 11,
|
||||
vendorCode: 'VN-11',
|
||||
vendorName: 'X-Ray Co.',
|
||||
),
|
||||
uom: ProductUom(id: 21, uomName: 'EA'),
|
||||
),
|
||||
Product(
|
||||
id: 502,
|
||||
productCode: 'Eco-200',
|
||||
productName: 'Eco-200',
|
||||
vendor: ProductVendor(
|
||||
id: 12,
|
||||
vendorCode: 'VN-12',
|
||||
vendorName: 'Eco Supplies',
|
||||
),
|
||||
uom: ProductUom(id: 22, uomName: 'EA'),
|
||||
),
|
||||
];
|
||||
if (getIt.isRegistered<ProductRepository>()) {
|
||||
getIt.unregister<ProductRepository>();
|
||||
}
|
||||
getIt.registerSingleton<ProductRepository>(
|
||||
_StubProductRepository(products: products),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _StubInventoryLookupRepository implements InventoryLookupRepository {
|
||||
_StubInventoryLookupRepository({
|
||||
required List<LookupItem> transactionTypes,
|
||||
required List<LookupItem> statuses,
|
||||
required List<LookupItem> approvalStatuses,
|
||||
}) : _transactionTypes = transactionTypes,
|
||||
_statuses = statuses;
|
||||
_statuses = statuses,
|
||||
_approvalStatuses = approvalStatuses;
|
||||
|
||||
final List<LookupItem> _transactionTypes;
|
||||
final List<LookupItem> _statuses;
|
||||
final List<LookupItem> _approvalStatuses;
|
||||
|
||||
@override
|
||||
Future<List<LookupItem>> fetchTransactionTypes({
|
||||
@@ -125,7 +169,7 @@ class _StubInventoryLookupRepository implements InventoryLookupRepository {
|
||||
Future<List<LookupItem>> fetchApprovalStatuses({
|
||||
bool activeOnly = true,
|
||||
}) async {
|
||||
return const [];
|
||||
return _approvalStatuses;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -136,6 +180,60 @@ class _StubInventoryLookupRepository implements InventoryLookupRepository {
|
||||
}
|
||||
}
|
||||
|
||||
class _StubProductRepository implements ProductRepository {
|
||||
_StubProductRepository({required List<Product> products})
|
||||
: _products = products;
|
||||
|
||||
final List<Product> _products;
|
||||
|
||||
@override
|
||||
Future<PaginatedResult<Product>> list({
|
||||
int page = 1,
|
||||
int pageSize = 20,
|
||||
String? query,
|
||||
int? vendorId,
|
||||
int? uomId,
|
||||
bool? isActive,
|
||||
}) async {
|
||||
Iterable<Product> filtered = _products;
|
||||
if (query != null && query.trim().isNotEmpty) {
|
||||
final normalized = query.trim().toLowerCase();
|
||||
filtered = filtered.where(
|
||||
(product) =>
|
||||
product.productCode.toLowerCase().contains(normalized) ||
|
||||
product.productName.toLowerCase().contains(normalized),
|
||||
);
|
||||
}
|
||||
final items = filtered.toList(growable: false);
|
||||
return PaginatedResult<Product>(
|
||||
items: items,
|
||||
page: page,
|
||||
pageSize: pageSize,
|
||||
total: items.length,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Product> create(ProductInput input) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> delete(int id) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Product> restore(int id) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Product> update(int id, ProductInput input) {
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
|
||||
class _StubStockTransactionRepository implements StockTransactionRepository {
|
||||
_StubStockTransactionRepository({
|
||||
required List<StockTransaction> transactions,
|
||||
|
||||
Reference in New Issue
Block a user