This commit is contained in:
2026-03-12 02:10:57 +01:00
parent a8e769c73d
commit 3c6dd52d8f
29 changed files with 3323 additions and 0 deletions

32
internal/domain/report.go Normal file
View File

@@ -0,0 +1,32 @@
package domain
import "sort"
// PersonWithDistance represents a person with their distance to a location
type PersonWithDistance struct {
Name string `json:"name"`
Surname string `json:"surname"`
LocationName string `json:"location_name"`
DistanceKm float64 `json:"distance_km"`
AccessLevel int `json:"access_level,omitempty"`
}
// LocationReport represents a report for a single location
type LocationReport struct {
LocationName string `json:"location_name"`
Persons []PersonWithDistance `json:"persons"`
}
// SortPersonsByDistance sorts persons by distance (ascending)
func (r *LocationReport) SortPersonsByDistance() {
sort.Slice(r.Persons, func(i, j int) bool {
return r.Persons[i].DistanceKm < r.Persons[j].DistanceKm
})
}
// PersonData holds all gathered data for a person
type PersonData struct {
Person Person
Locations []PersonLocation // Multiple possible locations
AccessLevel int
}