refactoring
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import 'package:injectable/injectable.dart';
|
||||
import '../entities/type_reference_entity.dart';
|
||||
import '../repositories/org_types_repository.dart';
|
||||
|
||||
@injectable
|
||||
class CreateOrgType {
|
||||
final IOrgTypesRepository _repository;
|
||||
const CreateOrgType(this._repository);
|
||||
|
||||
Future<TypeReferenceEntity> call({
|
||||
required String code,
|
||||
required String libelle,
|
||||
String? description,
|
||||
String? couleur,
|
||||
int ordreAffichage = 0,
|
||||
}) => _repository.createOrgType(
|
||||
code: code,
|
||||
libelle: libelle,
|
||||
description: description,
|
||||
couleur: couleur,
|
||||
ordreAffichage: ordreAffichage,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import 'package:injectable/injectable.dart';
|
||||
import '../repositories/org_types_repository.dart';
|
||||
|
||||
@injectable
|
||||
class DeleteOrgType {
|
||||
final IOrgTypesRepository _repository;
|
||||
const DeleteOrgType(this._repository);
|
||||
|
||||
Future<void> call(String id) => _repository.deleteOrgType(id);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import 'package:injectable/injectable.dart';
|
||||
import '../entities/type_reference_entity.dart';
|
||||
import '../repositories/org_types_repository.dart';
|
||||
|
||||
@injectable
|
||||
class GetOrgTypes {
|
||||
final IOrgTypesRepository _repository;
|
||||
const GetOrgTypes(this._repository);
|
||||
|
||||
Future<List<TypeReferenceEntity>> call() => _repository.getOrgTypes();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:injectable/injectable.dart';
|
||||
import '../entities/type_reference_entity.dart';
|
||||
import '../repositories/org_types_repository.dart';
|
||||
|
||||
@injectable
|
||||
class UpdateOrgType {
|
||||
final IOrgTypesRepository _repository;
|
||||
const UpdateOrgType(this._repository);
|
||||
|
||||
Future<TypeReferenceEntity> call({
|
||||
required String id,
|
||||
required String code,
|
||||
required String libelle,
|
||||
String? description,
|
||||
String? couleur,
|
||||
int ordreAffichage = 0,
|
||||
}) => _repository.updateOrgType(
|
||||
id: id,
|
||||
code: code,
|
||||
libelle: libelle,
|
||||
description: description,
|
||||
couleur: couleur,
|
||||
ordreAffichage: ordreAffichage,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user