保存创建的作业接口+
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// lib/features/devices/domain/usecases/save_work_record_usecase.dart
|
||||
import 'package:fpdart/fpdart.dart';
|
||||
import '../../domain/errors/device_failure.dart';
|
||||
import '../../domain/repositories/path_repository.dart';
|
||||
|
||||
class SaveWorkRecordUseCase {
|
||||
final PathRepository repository;
|
||||
|
||||
SaveWorkRecordUseCase(this.repository);
|
||||
|
||||
Future<Either<DeviceFailure, Map<String, dynamic>>> call({
|
||||
required String workName,
|
||||
required String userId,
|
||||
required String jsonData,
|
||||
}) async {
|
||||
try {
|
||||
final result = await repository.saveWorkRecord(
|
||||
workName: workName,
|
||||
userId: userId,
|
||||
jsonData: jsonData,
|
||||
);
|
||||
return Right(result);
|
||||
} catch (e) {
|
||||
return Left(DeviceFailure.networkError(message: e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user