Searching project through short name as well
This commit is contained in:
parent
a7a9fb4012
commit
eed97d31c6
@ -52,7 +52,8 @@ namespace Marco.Pms.Services.Service
|
||||
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
|
||||
}
|
||||
|
||||
#region =================================================================== Project Get APIs ===================================================================
|
||||
#region =================================================================== Project Get APIs ===================================================================\
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a combined list of basic infrastructure and active service projects accessible by the logged-in employee within a tenant.
|
||||
/// </summary>
|
||||
@ -84,7 +85,8 @@ namespace Marco.Pms.Services.Service
|
||||
{
|
||||
var normalized = searchString.Trim().ToLowerInvariant();
|
||||
infraProjectsQuery = infraProjectsQuery
|
||||
.Where(p => p.Name.ToLower().Contains(normalized));
|
||||
.Where(p => p.Name.ToLower().Contains(normalized) ||
|
||||
(!string.IsNullOrWhiteSpace(p.ShortName) && p.ShortName.ToLower().Contains(normalized)));
|
||||
}
|
||||
|
||||
var infraProjects = await infraProjectsQuery.ToListAsync();
|
||||
@ -102,7 +104,8 @@ namespace Marco.Pms.Services.Service
|
||||
{
|
||||
var normalized = searchString.Trim().ToLowerInvariant();
|
||||
serviceProjectsQuery = serviceProjectsQuery
|
||||
.Where(sp => sp.Name.ToLower().Contains(normalized));
|
||||
.Where(sp => sp.Name.ToLower().Contains(normalized) ||
|
||||
(!string.IsNullOrWhiteSpace(sp.ShortName) && sp.ShortName.ToLower().Contains(normalized)));
|
||||
}
|
||||
|
||||
var serviceProjects = await serviceProjectsQuery.ToListAsync();
|
||||
@ -127,7 +130,6 @@ namespace Marco.Pms.Services.Service
|
||||
return ApiResponse<object>.ErrorResponse("Internal Server Error", "An error occurred while fetching projects.", 500);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ApiResponse<object>> GetAllProjectsBasicAsync(bool provideAll, Employee loggedInEmployee, Guid tenantId)
|
||||
{
|
||||
try
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user