refactor: Update API endpoints for employee retrieval to include projectId as a query parameter for improved functionality

This commit is contained in:
Vaibhav Surve 2025-08-04 17:04:33 +05:30
parent 0150400092
commit f245f9accf
2 changed files with 10 additions and 7 deletions

View File

@ -15,8 +15,8 @@ class ApiEndpoints {
static const String uploadAttendanceImage = "/attendance/record-image"; static const String uploadAttendanceImage = "/attendance/record-image";
// Employee Screen API Endpoints // Employee Screen API Endpoints
static const String getAllEmployeesByProject = "/employee/list"; static const String getAllEmployeesByProject = "/Employee/basic";
static const String getAllEmployees = "/employee/list"; static const String getAllEmployees = "/Employee/basic";
static const String getRoles = "/roles/jobrole"; static const String getRoles = "/roles/jobrole";
static const String createEmployee = "/employee/manage-mobile"; static const String createEmployee = "/employee/manage-mobile";
static const String getEmployeeInfo = "/employee/profile/get"; static const String getEmployeeInfo = "/employee/profile/get";
@ -35,7 +35,7 @@ class ApiEndpoints {
static const String assignTask = "/project/task"; static const String assignTask = "/project/task";
static const String getmasterWorkCategories = "/Master/work-categories"; static const String getmasterWorkCategories = "/Master/work-categories";
////// Directory Module API Endpoints ////// Directory Module API Endpoints ///////
static const String getDirectoryContacts = "/directory"; static const String getDirectoryContacts = "/directory";
static const String getDirectoryBucketList = "/directory/buckets"; static const String getDirectoryBucketList = "/directory/buckets";
static const String getDirectoryContactDetail = "/directory/notes"; static const String getDirectoryContactDetail = "/directory/notes";

View File

@ -1114,10 +1114,13 @@ class ApiService {
static Future<List<dynamic>?> getAllEmployeesByProject( static Future<List<dynamic>?> getAllEmployeesByProject(
String projectId) async { String projectId) async {
if (projectId.isEmpty) throw ArgumentError('projectId must not be empty'); if (projectId.isEmpty) throw ArgumentError('projectId must not be empty');
final endpoint = "${ApiEndpoints.getAllEmployeesByProject}/$projectId"; final endpoint =
return _getRequest(endpoint).then((res) => res != null "${ApiEndpoints.getAllEmployeesByProject}?projectId=$projectId";
? _parseResponse(res, label: 'Employees by Project') return _getRequest(endpoint).then(
: null); (res) => res != null
? _parseResponse(res, label: 'Employees by Project')
: null,
);
} }
static Future<List<dynamic>?> getAllEmployees() async => static Future<List<dynamic>?> getAllEmployees() async =>