Adopt File type for trust logos and MCP
Trust GraphQL and MCP still exposed presigned URL strings for trust-center logos while console and connect already serve stable File.downloadUrl paths. Phase 1 migrates the seven public logo fields on trust GraphQL and the trust-center file references on MCP to the shared File type; trust GraphQL NDA stays on fileUrl for a follow-up. Trust resolvers load public files through filemanager and map them with types.NewFile. The trust app Relay queries and components now read logo.downloadUrl. MCP specification, resolvers, and helpers are updated in sync, including NDA on MCP where callers already have file access. filemanager is split into focused files and its URL surface is narrowed to GenerateFileURL(file) for stable app URLs and GeneratePresignedURL for S3 redirects. GetPublicFile remains the DB entry point when only a file ID is known. Add trust and MCP e2e coverage for public logo download URLs. Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
@@ -126,6 +126,10 @@ func (c *Client) DoConnect(query string, variables map[string]any) (*GraphQLResp
|
||||
return c.doWithEndpoint("/api/connect/v1/graphql", query, variables)
|
||||
}
|
||||
|
||||
func (c *Client) DoTrust(trustCenterID string, query string, variables map[string]any) (*GraphQLResponse, error) {
|
||||
return c.doWithEndpoint(fmt.Sprintf("/trust/%s/api/trust/v1/graphql", trustCenterID), query, variables)
|
||||
}
|
||||
|
||||
func (c *Client) Execute(query string, variables map[string]any, result any) error {
|
||||
resp, err := c.Do(query, variables)
|
||||
if err != nil {
|
||||
@@ -156,6 +160,21 @@ func (c *Client) ExecuteConnect(query string, variables map[string]any, result a
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) ExecuteTrust(trustCenterID string, query string, variables map[string]any, result any) error {
|
||||
resp, err := c.DoTrust(trustCenterID, query, variables)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if result != nil && resp.Data != nil {
|
||||
if err := json.Unmarshal(resp.Data, result); err != nil {
|
||||
return fmt.Errorf("cannot unmarshal data: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) MustExecute(query string, variables map[string]any, result any) {
|
||||
c.T.Helper()
|
||||
err := c.Execute(query, variables, result)
|
||||
|
||||
Reference in New Issue
Block a user