Add framework import

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-13 16:32:30 +01:00
parent 2f229fc27d
commit 03f621ec8d
6 changed files with 453 additions and 13 deletions

View File

@@ -6,6 +6,7 @@ package console_v1
import (
"context"
"encoding/json"
"fmt"
"time"
@@ -348,7 +349,21 @@ func (r *mutationResolver) UpdateFramework(ctx context.Context, input types.Upda
// ImportFramework is the resolver for the importFramework field.
func (r *mutationResolver) ImportFramework(ctx context.Context, input types.ImportFrameworkInput) (*types.ImportFrameworkPayload, error) {
panic(fmt.Errorf("not implemented: ImportFramework - importFramework"))
svc := r.GetTenantServiceIfAuthorized(ctx, input.OrganizationID.TenantID())
req := probo.ImportFrameworkRequest{}
if err := json.NewDecoder(input.File.File).Decode(&req.Data); err != nil {
return nil, fmt.Errorf("cannot decode framework: %w", err)
}
framework, err := svc.Frameworks.Import(ctx, input.OrganizationID, req)
if err != nil {
return nil, fmt.Errorf("cannot import framework: %w", err)
}
return &types.ImportFrameworkPayload{
FrameworkEdge: types.NewFrameworkEdge(framework),
}, nil
}
// CreateControl is the resolver for the createControl field.