LCOV - code coverage report
Current view: top level - lib/domain/usecases/services/booking - delete_booking_of_service.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 7 0.0 %
Date: 2020-06-26 11:36:11 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:app_pym/core/error/exceptions.dart';
       2             : import 'package:app_pym/core/usecases/usecase.dart';
       3             : import 'package:app_pym/domain/repositories/app_pym/booking_repository.dart';
       4             : import 'package:app_pym/domain/usecases/services/booking/booking_of_service_params.dart';
       5             : import 'package:injectable/injectable.dart';
       6             : 
       7             : /// Delete a booking of a service
       8             : ///
       9             : /// Returns void if success.
      10             : ///
      11             : /// Throws [NotAuthenticatedException] if no AppUser exists.
      12             : ///
      13             : /// Throws [EmailNotVerifiedException] if the email of the AppUser is
      14             : /// not confirmed
      15             : @prod
      16             : @lazySingleton
      17             : class DeleteBookingOfService
      18             :     extends Usecase<Future<void>, BookingOfServiceParams> {
      19             :   final BookingRepository repository;
      20             : 
      21           0 :   const DeleteBookingOfService(this.repository);
      22             : 
      23           0 :   @override
      24             :   Future<void> call(BookingOfServiceParams params) {
      25           0 :     if (params.appUser == null) {
      26           0 :       throw NotAuthenticatedException();
      27           0 :     } else if (!params.appUser.is_email_verified) {
      28           0 :       throw EmailNotVerifiedException();
      29             :     }
      30           0 :     return repository.delete(params.booking.id);
      31             :   }
      32             : }

Generated by: LCOV version 1.13