refactor: consolidate packages - move output to cmd, config/session to store, rename Store to GraphStore

This commit is contained in:
2026-04-02 00:18:33 +02:00
parent 2bcc310c6d
commit 03a896d23f
25 changed files with 190 additions and 239 deletions

View File

@@ -3,6 +3,7 @@ package serve
import (
"axolotl/models"
"axolotl/service"
"axolotl/store"
"encoding/json"
"net/http"
"strings"
@@ -12,7 +13,7 @@ import (
// When oidcCfg is non-nil, every request must carry a valid Bearer token;
// the authenticated username is derived from the token claim configured in
// OIDCConfig.UserClaim. Without OIDC, the X-Ax-User header is used instead.
func New(newSvc func(user string) (service.NodeService, error), oidcCfg *service.OIDCConfig) (http.Handler, error) {
func New(newSvc func(user string) (service.NodeService, error), oidcCfg *store.OIDCConfig) (http.Handler, error) {
s := &server{newSvc: newSvc}
mux := http.NewServeMux()
mux.HandleFunc("GET /nodes", s.listNodes)
@@ -191,8 +192,9 @@ func parseRel(s string) service.RelInput {
if strings.Contains(s, "::") {
return service.RelInput{Type: models.RelType(s)}
}
if idx := strings.Index(s, ":"); idx >= 0 {
return service.RelInput{Type: models.RelType(s[:idx]), Target: s[idx+1:]}
if before, after, found := strings.Cut(s, ":"); found {
return service.RelInput{Type: models.RelType(before), Target: after}
}
return service.RelInput{Type: models.RelType(s)}
}