Migrate Connect org logos to File type
Replace Organization.logoUrl and horizontalLogoUrl with nested File
objects whose downloadUrl points at /api/files/v1/public/{id}, matching
the Console migration.
Org logos are FileVisibilityPublic and served without HTTP auth, so
Connect File.downloadUrl is built eagerly in NewFile with no field-level
authorize. Logo loading moves to iam.OrganizationService.LogoFile and
HorizontalLogoFile; the old URL generators are removed.
Sync IAM Relay components and n8n organization operations. Add an e2e
test for Connect multipart logo upload and ExecuteConnectWithFile.
Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
@@ -185,14 +185,18 @@ type UploadFile struct {
|
||||
}
|
||||
|
||||
func (c *Client) ExecuteWithFile(query string, variables map[string]any, variablePath string, file UploadFile, result any) error {
|
||||
return c.executeMultipart(query, variables, map[string]UploadFile{variablePath: file}, result)
|
||||
return c.executeMultipart("/api/console/v1/graphql", query, variables, map[string]UploadFile{variablePath: file}, result)
|
||||
}
|
||||
|
||||
func (c *Client) ExecuteConnectWithFile(query string, variables map[string]any, variablePath string, file UploadFile, result any) error {
|
||||
return c.executeMultipart("/api/connect/v1/graphql", query, variables, map[string]UploadFile{variablePath: file}, result)
|
||||
}
|
||||
|
||||
func (c *Client) ExecuteWithFiles(query string, variables map[string]any, files map[string]UploadFile, result any) error {
|
||||
return c.executeMultipart(query, variables, files, result)
|
||||
return c.executeMultipart("/api/console/v1/graphql", query, variables, files, result)
|
||||
}
|
||||
|
||||
func (c *Client) executeMultipart(query string, variables map[string]any, files map[string]UploadFile, result any) error {
|
||||
func (c *Client) executeMultipart(endpoint string, query string, variables map[string]any, files map[string]UploadFile, result any) error {
|
||||
// Create multipart writer using standard library
|
||||
var buf bytes.Buffer
|
||||
|
||||
@@ -262,7 +266,7 @@ func (c *Client) executeMultipart(query string, variables map[string]any, files
|
||||
}
|
||||
|
||||
// Create request
|
||||
req, err := http.NewRequest("POST", c.baseURL+"/api/console/v1/graphql", &buf)
|
||||
req, err := http.NewRequest("POST", c.baseURL+endpoint, &buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot create request: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user