first commit

This commit is contained in:
Anbarasu
2026-05-26 18:01:57 +05:30
commit 6d59c8daf6
297 changed files with 35238 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
import '../../../modules/profile/customer_request.dart';
import '../../../service/dio.dart';
class CustomerRequestRepository {
final CustomDio _dio = CustomDio();
/// Create a new customer request
Future<dynamic> createCustomerRequest(CustomerRequestModel model) async {
const String url = "https://fiesta.nearle.app/live/api/v1/mob/customers/createcustomerrequest";
try {
final response = await _dio.postData(url, model.toJson());
print("POST URL: $url");
print("Payload: ${model.toJson()}");
print("Response: $response");
return response;
} catch (e) {
return {"status": false, "message": e.toString()};
}
}
/// Fetch customer requests (status)
Future<List<CustomerRequestStatusModel>> fetchCustomerRequests({
required int customerId,
int pageNo = 1,
int pageSize = 10,
}) async {
final String url = "https://fiesta.nearle.app/live/api/v1/mob/customers/getcustomerrequests"
"?customerid=$customerId&pageno=$pageNo&pagesize=$pageSize";
try {
final response = await _dio.getData(url); // assuming getData exists
print("GET URL: $url");
print("Response: $response");
if (response != null && response['status'] == true) {
final List data = response['data'] ?? [];
return data.map((e) => CustomerRequestStatusModel.fromJson(e)).toList();
}
return [];
} catch (e) {
print("❌ Fetch error: $e");
return [];
}
}
}