mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-28 16:45:32 +00:00
Started agent view
This commit is contained in:
25
viewmodels/agentsvm.go
Normal file
25
viewmodels/agentsvm.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package viewmodels
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/Theodor-Springmann-Stiftung/kgpz_web/providers/xmlprovider"
|
||||
)
|
||||
|
||||
type AgentView struct {
|
||||
Agents []xmlprovider.Agent
|
||||
}
|
||||
|
||||
func AgentsView(letterorid string, lib *xmlprovider.Library) *AgentView {
|
||||
res := AgentView{}
|
||||
lib.Agents.Items.Range(func(key, value interface{}) bool {
|
||||
k := key.(string)
|
||||
if strings.HasPrefix(k, letterorid) {
|
||||
agent := value.(xmlprovider.Agent)
|
||||
res.Agents = append(res.Agents, agent)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
return &res
|
||||
}
|
||||
Reference in New Issue
Block a user