b
This commit is contained in:
@@ -11,7 +11,7 @@ class CustomerRepository {
|
||||
final String companyId = GetIt.I.get<SessionCubit>().state.company!.id!;
|
||||
|
||||
// Crea un nuovo cliente
|
||||
Future<CustomerModel> saveCustomer(CustomerModel customer) async {
|
||||
Future<CustomerModel> insertCustomer(CustomerModel customer) async {
|
||||
try {
|
||||
final response = await _supabase
|
||||
.from('customer')
|
||||
@@ -57,6 +57,23 @@ class CustomerRepository {
|
||||
}
|
||||
}
|
||||
|
||||
Future<CustomerModel> getCustomerById(String customerId) async {
|
||||
try {
|
||||
final response = await _supabase
|
||||
.from('customer')
|
||||
.select('''
|
||||
*,
|
||||
attachment(*)
|
||||
''')
|
||||
.eq('id', customerId)
|
||||
.single();
|
||||
|
||||
return CustomerModel.fromMap(response);
|
||||
} catch (e) {
|
||||
throw '$e';
|
||||
}
|
||||
}
|
||||
|
||||
// Ricerca clienti per nome o telefono (fondamentale per la UX)
|
||||
Future<List<CustomerModel>> searchCustomers(
|
||||
String companyId,
|
||||
|
||||
Reference in New Issue
Block a user