mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
feat: implement basic search functionality with partial text matches
This commit is contained in:
@@ -159,11 +159,20 @@ namespace WebApp.Endpoints
|
||||
|
||||
foreach(Event e in AllEvents)
|
||||
{
|
||||
bool matchFound = true;
|
||||
// Logika wyszukiwania
|
||||
// Sprawdź wszystkie pola z EventSearchDto, np.
|
||||
if (query.OrganisationId is not null)
|
||||
{
|
||||
// Sprawdź, czy Event należy do query.OrganisationId.
|
||||
if (e.OrganisationId != query.OrganisationId) matchFound = false;
|
||||
}
|
||||
|
||||
if (query.TitleOrDescription is not null)
|
||||
{
|
||||
var TitleMatch = guhf.SearchString(e.Title, query.TitleOrDescription);
|
||||
var DescMatch = guhf.SearchString(e.Description, query.TitleOrDescription);
|
||||
if (!TitleMatch && !DescMatch) matchFound = false;
|
||||
}
|
||||
|
||||
// ...
|
||||
@@ -179,7 +188,11 @@ namespace WebApp.Endpoints
|
||||
e.EventRegistrations.Clear();
|
||||
}
|
||||
|
||||
SearchResults.Add(e.ToEventSummaryDto());
|
||||
// UWAGA! TO NIE POWINNO TAK DZIAŁAĆ!
|
||||
// KTOKOLWIEK WIDZIAŁ, KTOKOLWIEK WIE CZEMU Organisation JEST null?
|
||||
e.Organisation = await guhf.GetOrganisationFromId(e.OrganisationId);
|
||||
|
||||
if (matchFound) SearchResults.Add(e.ToEventSummaryDto());
|
||||
}
|
||||
|
||||
return Results.Ok(SearchResults);
|
||||
|
||||
Reference in New Issue
Block a user