Move trust center profile onto the page
Store website, email, and headquarters on the trust center so public and admin surfaces read branding from one place. Drop the trust API organization type and wire console, MCP, CLI, and apps through the updated schema. Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -256,6 +256,7 @@ type TrustCenter implements Node
|
||||
websiteUrl: String
|
||||
email: String
|
||||
headquarterAddress: String
|
||||
title: String!
|
||||
createdAt: Datetime!
|
||||
updatedAt: Datetime!
|
||||
organization: Organization! @goField(forceResolver: true)
|
||||
@@ -567,6 +568,7 @@ input UpdateTrustCenterInput {
|
||||
trustCenterId: ID!
|
||||
active: Boolean
|
||||
searchEngineIndexing: SearchEngineIndexing
|
||||
title: String
|
||||
description: String @goField(omittable: true)
|
||||
websiteUrl: String @goField(omittable: true)
|
||||
email: String @goField(omittable: true)
|
||||
|
||||
@@ -75,6 +75,7 @@ func (r *mutationResolver) UpdateTrustCenter(ctx context.Context, input types.Up
|
||||
WebsiteURL: gqlutils.UnwrapOmittable(input.WebsiteURL),
|
||||
Email: gqlutils.UnwrapOmittable(input.Email),
|
||||
HeadquarterAddress: gqlutils.UnwrapOmittable(input.HeadquarterAddress),
|
||||
Title: input.Title,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -38,6 +38,7 @@ type TrustCenter struct {
|
||||
WebsiteURL *string `json:"websiteUrl,omitempty"`
|
||||
Email *string `json:"email,omitempty"`
|
||||
HeadquarterAddress *string `json:"headquarterAddress,omitempty"`
|
||||
Title string `json:"title"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
Organization *Organization `json:"organization"`
|
||||
@@ -64,6 +65,7 @@ func NewTrustCenter(tc *coredata.TrustCenter) *TrustCenter {
|
||||
WebsiteURL: tc.WebsiteURL,
|
||||
Email: tc.Email,
|
||||
HeadquarterAddress: tc.HeadquarterAddress,
|
||||
Title: tc.Title,
|
||||
CreatedAt: tc.CreatedAt,
|
||||
UpdatedAt: tc.UpdatedAt,
|
||||
}
|
||||
|
||||
@@ -4954,6 +4954,9 @@ func (r *Resolver) UpdateTrustCenterTool(ctx context.Context, req *mcp.CallToolR
|
||||
updateReq.WebsiteURL = UnwrapOmittable(input.WebsiteURL)
|
||||
updateReq.Email = UnwrapOmittable(input.Email)
|
||||
updateReq.HeadquarterAddress = UnwrapOmittable(input.HeadquarterAddress)
|
||||
if title := UnwrapOmittable(input.Title); title != nil {
|
||||
updateReq.Title = *title
|
||||
}
|
||||
|
||||
trustCenter, _, err := prb.Update(ctx, scope, updateReq)
|
||||
if err != nil {
|
||||
|
||||
@@ -8832,6 +8832,7 @@ components:
|
||||
- organization_id
|
||||
- active
|
||||
- search_engine_indexing
|
||||
- title
|
||||
- created_at
|
||||
- updated_at
|
||||
properties:
|
||||
@@ -8869,6 +8870,9 @@ components:
|
||||
- string
|
||||
- "null"
|
||||
description: Compliance page headquarter address
|
||||
title:
|
||||
type: string
|
||||
description: Public compliance page title
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
@@ -9059,6 +9063,12 @@ components:
|
||||
- "null"
|
||||
description: Compliance page headquarter address
|
||||
go.probo.inc/mcpgen/omittable: true
|
||||
title:
|
||||
type:
|
||||
- string
|
||||
- "null"
|
||||
description: Public compliance page title
|
||||
go.probo.inc/mcpgen/omittable: true
|
||||
|
||||
UpdateTrustCenterOutput:
|
||||
type: object
|
||||
|
||||
@@ -31,6 +31,7 @@ func NewTrustCenter(tc *coredata.TrustCenter) *TrustCenter {
|
||||
OrganizationID: tc.OrganizationID,
|
||||
Active: tc.Active,
|
||||
SearchEngineIndexing: tc.SearchEngineIndexing,
|
||||
Title: tc.Title,
|
||||
Description: tc.Description,
|
||||
WebsiteURL: tc.WebsiteURL,
|
||||
Email: tc.Email,
|
||||
|
||||
@@ -46,15 +46,6 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error
|
||||
trustService := r.trust
|
||||
|
||||
switch id.EntityType() {
|
||||
case coredata.OrganizationEntityType:
|
||||
organization, err := trustService.GetOrganization(ctx, scope, id)
|
||||
if err != nil {
|
||||
r.logger.ErrorCtx(ctx, "cannot get organization", log.Error(err))
|
||||
return nil, gqlutils.Internal(ctx)
|
||||
}
|
||||
|
||||
return types.NewOrganization(organization), nil
|
||||
|
||||
case coredata.DocumentEntityType:
|
||||
trustCenter := complianceportal.CompliancePageFromContext(ctx)
|
||||
|
||||
@@ -190,11 +181,7 @@ func (r *queryResolver) CurrentTrustCenter(ctx context.Context) (*types.TrustCen
|
||||
scope := coredata.NewScopeFromObjectID(trustCenter.ID)
|
||||
trustService := r.trust
|
||||
|
||||
org, err := trustService.GetOrganization(ctx, scope, trustCenter.OrganizationID)
|
||||
if err != nil {
|
||||
r.logger.ErrorCtx(ctx, "cannot get organization", log.Error(err))
|
||||
return nil, gqlutils.Internal(ctx)
|
||||
}
|
||||
var err error
|
||||
|
||||
trustCenter, err = trustService.GetPortal(ctx, scope, trustCenter.ID)
|
||||
if err != nil {
|
||||
@@ -202,10 +189,7 @@ func (r *queryResolver) CurrentTrustCenter(ctx context.Context) (*types.TrustCen
|
||||
return nil, gqlutils.Internal(ctx)
|
||||
}
|
||||
|
||||
response := types.NewTrustCenter(trustCenter)
|
||||
response.Organization = types.NewOrganization(org)
|
||||
|
||||
return response, nil
|
||||
return types.NewTrustCenter(trustCenter), nil
|
||||
}
|
||||
|
||||
// OidcProviders is the resolver for the oidcProviders field.
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
type Organization implements Node {
|
||||
id: ID!
|
||||
name: String!
|
||||
logo: File @goField(forceResolver: true)
|
||||
}
|
||||
@@ -9,13 +9,12 @@ type TrustCenter implements Node {
|
||||
websiteUrl: String
|
||||
email: String
|
||||
headquarterAddress: String
|
||||
title: String!
|
||||
|
||||
nonDisclosureAgreement: NonDisclosureAgreement @goField(forceResolver: true)
|
||||
|
||||
viewerSubscription: MailingListSubscriber @goField(forceResolver: true)
|
||||
|
||||
organization: Organization! @goField(forceResolver: true)
|
||||
|
||||
documents(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package trust_v1
|
||||
|
||||
// This file will be automatically regenerated based on the schema, any resolver
|
||||
// implementations
|
||||
// will be copied through when generating and any unknown code will be moved to the end.
|
||||
// Code generated by github.com/99designs/gqlgen version v0.17.93
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.probo.inc/probo/pkg/coredata"
|
||||
"go.probo.inc/probo/pkg/server/api/compliancepage"
|
||||
"go.probo.inc/probo/pkg/server/api/trust/v1/schema"
|
||||
"go.probo.inc/probo/pkg/server/api/trust/v1/types"
|
||||
"go.probo.inc/probo/pkg/server/gqlutils"
|
||||
)
|
||||
|
||||
// Logo is the resolver for the logo field.
|
||||
func (r *organizationResolver) Logo(ctx context.Context, obj *types.Organization) (*types.File, error) {
|
||||
compliancePage := compliancepage.CompliancePageFromContext(ctx)
|
||||
scope := coredata.NewScopeFromObjectID(compliancePage.OrganizationID)
|
||||
|
||||
organization, err := r.trust.GetOrganization(ctx, scope, obj.ID)
|
||||
if err != nil {
|
||||
return nil, gqlutils.NotFoundf(ctx, "organization %q not found", obj.ID)
|
||||
}
|
||||
|
||||
if organization.LogoFileID == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return r.loadPublicFile(ctx, *organization.LogoFileID)
|
||||
}
|
||||
|
||||
// Organization returns schema.OrganizationResolver implementation.
|
||||
func (r *Resolver) Organization() schema.OrganizationResolver { return &organizationResolver{r} }
|
||||
|
||||
type organizationResolver struct{ *Resolver }
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@probo.com>.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"go.probo.inc/probo/pkg/coredata"
|
||||
)
|
||||
|
||||
func NewOrganization(o *coredata.Organization) *Organization {
|
||||
return &Organization{
|
||||
ID: o.ID,
|
||||
Name: o.Name,
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ func NewTrustCenter(tc *coredata.TrustCenter) *TrustCenter {
|
||||
ID: tc.ID,
|
||||
Active: tc.Active,
|
||||
Slug: tc.Slug,
|
||||
Title: tc.Title,
|
||||
Description: tc.Description,
|
||||
WebsiteURL: tc.WebsiteURL,
|
||||
Email: tc.Email,
|
||||
|
||||
@@ -137,7 +137,7 @@ func NewServer(cfg Config) (*Server, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
trustWebServer, err := trust_web.NewServer(compliancePageHeadData(cfg.BaseURL, cfg.Trust))
|
||||
trustWebServer, err := trust_web.NewServer(compliancePageHeadData(cfg.BaseURL))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -252,27 +252,22 @@ func (s *Server) TrustCenterHandler() http.Handler {
|
||||
return r
|
||||
}
|
||||
|
||||
func compliancePageHeadData(baseURL *baseurl.BaseURL, trustService *trust.Service) trust_web.HeadDataFunc {
|
||||
func compliancePageHeadData(baseURL *baseurl.BaseURL) trust_web.HeadDataFunc {
|
||||
return func(r *http.Request) trust_web.HeadData {
|
||||
tc := complianceportal.CompliancePageFromContext(r.Context())
|
||||
if tc == nil {
|
||||
return trust_web.HeadData{Title: "Compliance Page"}
|
||||
}
|
||||
|
||||
org, err := trustService.GetPortalOrganization(r.Context(), tc.ID)
|
||||
if err != nil || org == nil {
|
||||
return trust_web.HeadData{Title: "Compliance Page"}
|
||||
}
|
||||
|
||||
compliancePageBaseURL := complianceportal.CompliancePageBaseURLFromContext(r.Context())
|
||||
|
||||
description := org.Name + " Compliance Page"
|
||||
description := tc.Title + " Compliance Page"
|
||||
if tc.Description != nil && *tc.Description != "" {
|
||||
description = *tc.Description
|
||||
}
|
||||
|
||||
headData := trust_web.HeadData{
|
||||
Title: org.Name + " — Compliance",
|
||||
Title: tc.Title,
|
||||
Description: description,
|
||||
OGURL: ref.UnrefOrZero(compliancePageBaseURL),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user