- Replace dart:js with package:js in health_check_service_web.dart\n- Implement showHealthCheckNotification in web/index.html\n- Pin js dependency to ^0.6.7 for flutter_secure_storage_web compatibility auth: harden AuthInterceptor + tests - Allow overrideAuthRepository injection for testing\n- Normalize imports to package: paths\n- Add unit test covering token attach, 401→refresh→retry, and failure path\n- Add integration test skeleton gated by env vars ui/data: map User.companyName to list column - Add companyName to domain User\n- Map UserDto.company?.name\n- Render companyName in user_list cleanup: remove legacy equipment table + unused code; minor warnings - Remove _buildFlexibleTable and unused helpers\n- Remove unused zipcode details and cache retry constant\n- Fix null-aware and non-null assertions\n- Address child-last warnings in administrator dialog docs: update AGENTS.md session context
46 lines
1.2 KiB
Dart
46 lines
1.2 KiB
Dart
import 'package:dartz/dartz.dart';
|
|
import '../../repositories/company_repository.dart';
|
|
import '../../../core/errors/failures.dart';
|
|
import '../base_usecase.dart';
|
|
|
|
/// 회사 삭제 파라미터
|
|
class DeleteCompanyParams {
|
|
final int id;
|
|
|
|
const DeleteCompanyParams({
|
|
required this.id,
|
|
});
|
|
}
|
|
|
|
/// 회사 삭제 UseCase
|
|
class DeleteCompanyUseCase extends UseCase<void, DeleteCompanyParams> {
|
|
// 레포지토리 기반으로 마이그레이션
|
|
final CompanyRepository _companyRepository;
|
|
|
|
DeleteCompanyUseCase(this._companyRepository);
|
|
|
|
@override
|
|
Future<Either<Failure, void>> call(DeleteCompanyParams params) async {
|
|
try {
|
|
final result = await _companyRepository.deleteCompany(params.id);
|
|
return result;
|
|
} on ServerFailure catch (e) {
|
|
if (e.message.contains('associated')) {
|
|
return Left(ValidationFailure(
|
|
message: '연관된 데이터가 있어 삭제할 수 없습니다.',
|
|
originalError: e,
|
|
));
|
|
}
|
|
return Left(ServerFailure(
|
|
message: e.message,
|
|
originalError: e,
|
|
));
|
|
} catch (e) {
|
|
return Left(UnknownFailure(
|
|
message: '회사 삭제 중 오류가 발생했습니다.',
|
|
originalError: e,
|
|
));
|
|
}
|
|
}
|
|
}
|