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:
@@ -18,14 +18,38 @@ import 'package:superport_v2/features/inventory/lookups/domain/entities/lookup_i
|
||||
import 'package:superport_v2/features/inventory/lookups/domain/repositories/inventory_lookup_repository.dart';
|
||||
|
||||
import '../../helpers/test_app.dart';
|
||||
import '../../helpers/fixture_loader.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
late Map<String, dynamic> permissionFixture;
|
||||
late Set<PermissionAction> viewerPermissions;
|
||||
late Set<PermissionAction> approverPermissions;
|
||||
|
||||
Set<PermissionAction> parseActions(String key) {
|
||||
final raw = permissionFixture[key];
|
||||
if (raw is! List) {
|
||||
return {};
|
||||
}
|
||||
return raw
|
||||
.whereType<String>()
|
||||
.map(
|
||||
(action) => PermissionAction.values.firstWhere(
|
||||
(candidate) => candidate.name == action,
|
||||
orElse: () => PermissionAction.view,
|
||||
),
|
||||
)
|
||||
.toSet();
|
||||
}
|
||||
|
||||
setUpAll(() async {
|
||||
dotenv.testLoad(fileInput: 'FEATURE_APPROVALS_ENABLED=true');
|
||||
await Environment.initialize();
|
||||
dotenv.env['FEATURE_APPROVALS_ENABLED'] = 'true';
|
||||
permissionFixture = loadJsonFixture('approvals/approval_permissions.json');
|
||||
viewerPermissions = parseActions('viewer');
|
||||
approverPermissions = parseActions('approver');
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
@@ -52,9 +76,7 @@ void main() {
|
||||
GetIt.I.registerSingleton<InventoryLookupRepository>(lookupRepo);
|
||||
|
||||
final permissionManager = PermissionManager(
|
||||
overrides: {
|
||||
PermissionResources.approvals: {PermissionAction.view},
|
||||
},
|
||||
overrides: {PermissionResources.approvals: viewerPermissions},
|
||||
);
|
||||
|
||||
final view = tester.view;
|
||||
@@ -95,12 +117,7 @@ void main() {
|
||||
GetIt.I.registerSingleton<InventoryLookupRepository>(lookupRepo);
|
||||
|
||||
final permissionManager = PermissionManager(
|
||||
overrides: {
|
||||
PermissionResources.approvals: {
|
||||
PermissionAction.view,
|
||||
PermissionAction.approve,
|
||||
},
|
||||
},
|
||||
overrides: {PermissionResources.approvals: approverPermissions},
|
||||
);
|
||||
|
||||
await pumpApprovalPage(tester, permissionManager);
|
||||
@@ -133,12 +150,7 @@ void main() {
|
||||
GetIt.I.registerSingleton<InventoryLookupRepository>(lookupRepo);
|
||||
|
||||
final permissionManager = PermissionManager(
|
||||
overrides: {
|
||||
PermissionResources.approvals: {
|
||||
PermissionAction.view,
|
||||
PermissionAction.approve,
|
||||
},
|
||||
},
|
||||
overrides: {PermissionResources.approvals: approverPermissions},
|
||||
);
|
||||
|
||||
await pumpApprovalPage(tester, permissionManager);
|
||||
@@ -200,6 +212,8 @@ class _StubApprovalRepository implements ApprovalRepository {
|
||||
int? transactionId,
|
||||
int? approvalStatusId,
|
||||
int? requestedById,
|
||||
List<String>? statusCodes,
|
||||
bool includePending = false,
|
||||
bool includeHistories = false,
|
||||
bool includeSteps = false,
|
||||
}) async {
|
||||
@@ -220,6 +234,31 @@ class _StubApprovalRepository implements ApprovalRepository {
|
||||
return _approval;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Approval> submit(ApprovalSubmissionInput input) async {
|
||||
return _approval;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Approval> resubmit(ApprovalResubmissionInput input) async {
|
||||
return _approval;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Approval> approve(ApprovalDecisionInput input) async {
|
||||
return _approval;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Approval> reject(ApprovalDecisionInput input) async {
|
||||
return _approval;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Approval> recall(ApprovalRecallInput input) async {
|
||||
return _approval;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<ApprovalAction>> listActions({bool activeOnly = true}) async {
|
||||
return [
|
||||
@@ -229,6 +268,24 @@ class _StubApprovalRepository implements ApprovalRepository {
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
Future<PaginatedResult<ApprovalHistory>> listHistory({
|
||||
required int approvalId,
|
||||
int page = 1,
|
||||
int pageSize = 20,
|
||||
DateTime? from,
|
||||
DateTime? to,
|
||||
int? actorId,
|
||||
int? approvalActionId,
|
||||
}) async {
|
||||
return PaginatedResult(
|
||||
items: const <ApprovalHistory>[],
|
||||
page: page,
|
||||
pageSize: pageSize,
|
||||
total: 0,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Approval> performStepAction(ApprovalStepActionInput input) async {
|
||||
return _approval;
|
||||
|
||||
Reference in New Issue
Block a user