feat: Add getGlobalProjects method and update project fetching logic

This commit is contained in:
Vaibhav Surve 2025-06-12 22:06:59 +05:30
parent 916cfa3af4
commit 8e47d28005
3 changed files with 8 additions and 2 deletions

View File

@ -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(

View File

@ -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";

View File

@ -129,7 +129,12 @@ class ApiService {
? _parseResponse(response, label: 'Projects')
: null;
}
static Future<List<dynamic>?> getGlobalProjects() async {
final response = await _getRequest(ApiEndpoints.getProjects);
return response != null
? _parseResponse(response, label: 'Global Projects')
: null;
}
static Future<List<dynamic>?> getEmployeesByProject(String projectId) async {
final response = await _getRequest(ApiEndpoints.getEmployeesByProject,
queryParams: {"projectId": projectId});