feat: customer page
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
import '../../common/api/api_failure.dart';
|
||||
|
||||
part 'customer.freezed.dart';
|
||||
part 'entities/customer_entity.dart';
|
||||
part 'failures/customer_failure.dart';
|
||||
part 'repositories/i_customer_repository.dart';
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
part of '../customer.dart';
|
||||
|
||||
@freezed
|
||||
class Customer with _$Customer {
|
||||
const factory Customer({
|
||||
required String id,
|
||||
required String organizationId,
|
||||
required String name,
|
||||
required String email,
|
||||
required String phone,
|
||||
required String address,
|
||||
required bool isDefault,
|
||||
required bool isActive,
|
||||
required Map<String, dynamic> metadata,
|
||||
required String createdAt,
|
||||
required String updatedAt,
|
||||
}) = _Customer;
|
||||
|
||||
factory Customer.empty() => Customer(
|
||||
id: '',
|
||||
organizationId: '',
|
||||
name: '',
|
||||
email: '',
|
||||
phone: '',
|
||||
address: '',
|
||||
isDefault: false,
|
||||
isActive: false,
|
||||
metadata: const {},
|
||||
createdAt: '',
|
||||
updatedAt: '',
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
part of '../customer.dart';
|
||||
|
||||
@freezed
|
||||
sealed class CustomerFailure with _$CustomerFailure {
|
||||
const factory CustomerFailure.serverError(ApiFailure failure) = _ServerError;
|
||||
const factory CustomerFailure.unexpectedError() = _UnexpectedError;
|
||||
const factory CustomerFailure.empty() = _Empty;
|
||||
const factory CustomerFailure.dynamicErrorMessage(String erroMessage) =
|
||||
_DynamicErrorMessage;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
part of '../customer.dart';
|
||||
|
||||
abstract class ICustomerRepository {
|
||||
Future<Either<CustomerFailure, List<Customer>>> get({
|
||||
int page = 1,
|
||||
int limit = 20,
|
||||
String? search,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user