refactoring
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Entité Type de référence (ex: Type d'organisation)
|
||||
class TypeReferenceEntity extends Equatable {
|
||||
final String id;
|
||||
final String domaine;
|
||||
final String code;
|
||||
final String libelle;
|
||||
final String? description;
|
||||
final String? icone;
|
||||
final String? couleur;
|
||||
final String? severity;
|
||||
final int ordreAffichage;
|
||||
final bool estDefaut;
|
||||
final bool estSysteme;
|
||||
final bool actif;
|
||||
|
||||
const TypeReferenceEntity({
|
||||
required this.id,
|
||||
required this.domaine,
|
||||
required this.code,
|
||||
required this.libelle,
|
||||
this.description,
|
||||
this.icone,
|
||||
this.couleur,
|
||||
this.severity,
|
||||
this.ordreAffichage = 0,
|
||||
this.estDefaut = false,
|
||||
this.estSysteme = false,
|
||||
this.actif = true,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, domaine, code, libelle, description, icone, couleur, severity, ordreAffichage, estDefaut, estSysteme, actif];
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import '../entities/type_reference_entity.dart';
|
||||
|
||||
abstract class IOrgTypesRepository {
|
||||
Future<List<TypeReferenceEntity>> getOrgTypes();
|
||||
Future<TypeReferenceEntity> createOrgType({
|
||||
required String code,
|
||||
required String libelle,
|
||||
String? description,
|
||||
String? couleur,
|
||||
int ordreAffichage,
|
||||
});
|
||||
Future<TypeReferenceEntity> updateOrgType({
|
||||
required String id,
|
||||
required String code,
|
||||
required String libelle,
|
||||
String? description,
|
||||
String? couleur,
|
||||
int ordreAffichage,
|
||||
});
|
||||
Future<void> deleteOrgType(String id);
|
||||
}
|
||||
@@ -37,7 +37,7 @@ abstract class IOrganizationRepository {
|
||||
/// Recherche avancée d'organisations
|
||||
Future<List<OrganizationModel>> searchOrganizations({
|
||||
String? nom,
|
||||
TypeOrganization? type,
|
||||
String? type,
|
||||
StatutOrganization? statut,
|
||||
String? ville,
|
||||
String? region,
|
||||
|
||||
@@ -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