Fix intelligence being planning-redundant.

This commit is contained in:
Eli Ribble 2026-03-05 19:04:36 +00:00
parent 72a4ef9fff
commit 6c922ec9df
No known key found for this signature in database
5 changed files with 743 additions and 1038 deletions

View file

@ -4,30 +4,13 @@ import (
"context"
"net/http"
"github.com/Gleipnir-Technology/nidus-sync/background"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/Gleipnir-Technology/nidus-sync/html"
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
"github.com/rs/zerolog/log"
)
type contentIntelligenceRoot struct {
ArcgisAccessToken string
}
type contentIntelligenceRoot struct{}
func getIntelligenceRoot(ctx context.Context, r *http.Request, org *models.Organization, user *models.User) (*html.Response[contentIntelligenceRoot], *nhttp.ErrorWithStatus) {
var oauth_token *models.ArcgisOauthToken
var err error
var access_token string
oauth_token, err = background.GetOAuthForOrg(ctx, org)
if err != nil {
log.Warn().Err(err).Msg("Failed to get oauth")
oauth_token = nil
access_token = ""
} else {
access_token = oauth_token.AccessToken
}
return html.NewResponse("sync/intelligence-root.html", contentIntelligenceRoot{
ArcgisAccessToken: access_token,
}), nil
return html.NewResponse("sync/intelligence-root.html", contentIntelligenceRoot{}), nil
}

View file

@ -4,13 +4,30 @@ import (
"context"
"net/http"
"github.com/Gleipnir-Technology/nidus-sync/background"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/Gleipnir-Technology/nidus-sync/html"
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
"github.com/rs/zerolog/log"
)
type contentPlanningRoot struct{}
type contentPlanningRoot struct {
ArcgisAccessToken string
}
func getPlanningRoot(ctx context.Context, r *http.Request, org *models.Organization, user *models.User) (*html.Response[contentPlanningRoot], *nhttp.ErrorWithStatus) {
return html.NewResponse("sync/planning-root.html", contentPlanningRoot{}), nil
var oauth_token *models.ArcgisOauthToken
var err error
var access_token string
oauth_token, err = background.GetOAuthForOrg(ctx, org)
if err != nil {
log.Warn().Err(err).Msg("Failed to get oauth")
oauth_token = nil
access_token = ""
} else {
access_token = oauth_token.AccessToken
}
return html.NewResponse("sync/planning-root.html", contentPlanningRoot{
ArcgisAccessToken: access_token,
}), nil
}