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,42 @@
import 'package:dio/dio.dart';
import '../../../constants/api_constants.dart';
import '../../../data/authentication/auth_request.dart';
import '../../../data/authentication/auth_response.dart';
import '../../../modules/authentication/auth.dart';
import '../../../modules/authentication/getbyid.dart';
import '../../provider/authentication/auth_provider.dart';
class LoginRepository{
LoginProvider loginProvider = LoginProvider();
final LoginProvider _profileProvider = LoginProvider();
Future<LoginResponse?> signIn(LoginRequest data) async {
return await loginProvider.signIn('${ApiConstants.login}',data);
}
Future<CustomerFullView?> fetchProfile(String customerId) async {
return await _profileProvider.getProfile(customerId);
}
Future<dynamic> updateProfile(dynamic data) async {
final String url = ApiConstants.updateCustomer;
try {
final dio = Dio();
// print(url);
final response = await dio.put(url, data: data);
return response.data;
} catch (e) {
print("Error updating profile: $e");
return null;
}
}
}

View File

@@ -0,0 +1,21 @@
import '../../../modules/authentication/auth.dart';
abstract class CustomerLocationRepository {
Future<List<Authentication>> fetchCustomerLocations(int customerId);
Future<bool> createCustomerLocation({
required int customerId,
required String address,
required String doorNo,
required String landmark,
String suburb,
String city,
String state,
String postcode,
String latitude,
String longitude,
String defaultAddress,
int primaryAddress,
int status,
});
}

View File

@@ -0,0 +1,7 @@
// lib/domain/repository/order/create_order_repo.dart
import '../../../modules/orders/create_order.dart';
abstract class CreateOrderRepository {
Future<CreateOrderResponse> createOrder(CreateOrderRequest request);
}

View File

@@ -0,0 +1,8 @@
import '../../../modules/product/product.dart';
abstract class ProductsRepository {
Future<ProductResponse?> getProductsBySubCategory({
required int categoryId,
required int tenantId,
});
}

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 [];
}
}
}

View File

@@ -0,0 +1,24 @@
import '../../../modules/tenant/get_tenant.dart';
import '../../provider/tenant/get_tenant_pro.dart';
abstract class CustomerTenantsRepository {
Future<CustomerTenantsResponse?> getCustomerTenants(int customerId);
Future<OrdersResponse?> getCustomerOrders(int customerId);
Future<Map<String, dynamic>?> createTenantCustomer({
required int tenantId,
required int locationId,
required int customerId,
required int status,
});
final CustomerTenantsProvider provider;
CustomerTenantsRepository({required this.provider});
Future<TenantLocationsResponse?> getTenantLocations(int tenantId) async {
final response = await provider.getTenantLocations(tenantId);
return response;
}
}

View File

@@ -0,0 +1,19 @@
import '../../../modules/product/product.dart';
// abstract class ProductVariantRepository {
// Future<ProductVariant?> getProductVariant({
// required int tenantId,
// required int variantId,
// });
// }
abstract class ProductVariantRepository {
Future<List<Product>?> getProductVariant({
required int tenantId,
required int variantId,
});
}