feat: implement basic search functionality with partial text matches

This commit is contained in:
2025-05-19 01:30:49 +02:00
parent 4da3729edb
commit ef7ec0fc33
3 changed files with 34 additions and 3 deletions

View File

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