add loading links form file
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s

This commit is contained in:
Thomas Peetz
2026-10-07 18:50:09 +02:00
parent 980eda29af
commit 094dffb1c7
9 changed files with 384 additions and 172 deletions
+32
View File
@@ -1,7 +1,9 @@
package models
import (
"fmt"
"kontor-api-gin/internal/helpers"
"log/slog"
"time"
)
@@ -27,6 +29,36 @@ type SportDTO struct {
Name string `json:"name" binding:"required"`
}
type SportDTOList []SportDTO
func (sportList *SportDTOList) CompareIds(target *SportDTOList) (missing, obsolete []string) {
sources := make(map[string]SportDTO, len(*sportList))
targets := make(map[string]SportDTO, len(*target))
for _, source := range *sportList {
sources[source.ID] = source
}
for _, target := range *target {
targets[target.ID] = target
}
// iterate source IDs
for id := range sources {
if _, ok := targets[id]; ok {
slog.Info(fmt.Sprintf("ID %s found in both lists", id))
} else {
missing = append(missing, id)
}
}
for id := range targets {
if _, ok := sources[id]; ok {
slog.Info(fmt.Sprintf("ID %s found in both lists", id))
} else {
obsolete = append(obsolete, id)
}
}
slog.Info("CompareIds", "missing", missing, "obsolete", obsolete)
return missing, obsolete
}
func ConvertSportsToDtos(sports []Sport) []SportDTO {
dtos := make([]SportDTO, len(sports))
for i, sport := range sports {