Final commit.
This commit is contained in:
36
lib/domain/repository/payment_methods_repository.dart
Normal file
36
lib/domain/repository/payment_methods_repository.dart
Normal file
@ -0,0 +1,36 @@
|
||||
import 'package:hl_lieferservice/domain/entity/payment_method.dart';
|
||||
|
||||
/// Port für Zahlungsmethoden — globale Stammdaten.
|
||||
///
|
||||
/// Im Gegensatz zu `CarsRepository` keine Account-Filter: die Methoden
|
||||
/// sind firmenweit, alle Fahrer sehen dieselbe Liste.
|
||||
///
|
||||
/// Lösch-Verhalten: `delete` wirft eine `PaymentMethodsRepositoryException`
|
||||
/// mit konkretem `409`-Fall, wenn die Methode noch von Lieferungen
|
||||
/// referenziert wird (Backend hat dafür den FK-RESTRICT). Für „weiches
|
||||
/// Entfernen" gibt es `update(active: false)`.
|
||||
abstract interface class PaymentMethodsRepository {
|
||||
Future<List<PaymentMethod>> list({bool includeInactive = false});
|
||||
|
||||
Future<PaymentMethod> create({
|
||||
required String code,
|
||||
required String name,
|
||||
});
|
||||
|
||||
Future<PaymentMethod> update({
|
||||
required String id,
|
||||
String? name,
|
||||
bool? active,
|
||||
});
|
||||
|
||||
Future<void> delete(String id);
|
||||
}
|
||||
|
||||
class PaymentMethodsRepositoryException implements Exception {
|
||||
const PaymentMethodsRepositoryException(this.message, [this.cause]);
|
||||
final String message;
|
||||
final Object? cause;
|
||||
|
||||
@override
|
||||
String toString() => 'PaymentMethodsRepositoryException: $message';
|
||||
}
|
||||
Reference in New Issue
Block a user