From 8e47d28005e59a09322f70cf6afaf5074a1bd483 Mon Sep 17 00:00:00 2001 From: Vaibhav Surve Date: Thu, 12 Jun 2025 22:06:59 +0530 Subject: [PATCH] feat: Add getGlobalProjects method and update project fetching logic --- lib/controller/project_controller.dart | 2 +- lib/helpers/services/api_endpoints.dart | 1 + lib/helpers/services/api_service.dart | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/controller/project_controller.dart b/lib/controller/project_controller.dart index 6594d78..7baf879 100644 --- a/lib/controller/project_controller.dart +++ b/lib/controller/project_controller.dart @@ -46,7 +46,7 @@ class ProjectController extends GetxController { isLoadingProjects.value = true; isLoading.value = true; - final response = await ApiService.getProjects(); + final response = await ApiService.getGlobalProjects(); if (response != null && response.isNotEmpty) { projects.assignAll( diff --git a/lib/helpers/services/api_endpoints.dart b/lib/helpers/services/api_endpoints.dart index 19c2f75..dba0bb0 100644 --- a/lib/helpers/services/api_endpoints.dart +++ b/lib/helpers/services/api_endpoints.dart @@ -4,6 +4,7 @@ class ApiEndpoints { // Attendance Screen API Endpoints static const String getProjects = "/project/list"; + static const String getGlobalProjects = "/project/list/basic"; static const String getEmployeesByProject = "/attendance/project/team"; static const String getAttendanceLogs = "/attendance/project/log"; static const String getAttendanceLogView = "/attendance/log/attendance"; diff --git a/lib/helpers/services/api_service.dart b/lib/helpers/services/api_service.dart index a734477..22c3110 100644 --- a/lib/helpers/services/api_service.dart +++ b/lib/helpers/services/api_service.dart @@ -129,7 +129,12 @@ class ApiService { ? _parseResponse(response, label: 'Projects') : null; } - + static Future?> getGlobalProjects() async { + final response = await _getRequest(ApiEndpoints.getProjects); + return response != null + ? _parseResponse(response, label: 'Global Projects') + : null; + } static Future?> getEmployeesByProject(String projectId) async { final response = await _getRequest(ApiEndpoints.getEmployeesByProject, queryParams: {"projectId": projectId});