Skip to content

Commit 192feef

Browse files
authored
fix(server): update project import export (#1755)
1 parent aa9e058 commit 192feef

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

server/e2e/gql_project_export_test.go

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,34 @@ mutation ExportProject($projectId: ID!) {
2020
func TestProjectExport(t *testing.T) {
2121
e := Server(t, fullSeeder)
2222

23-
requestBody := GraphQLRequest{
23+
projectId, sceneId, _ := createProjectSet(e)
24+
updateProjectMetadata(e, uID, map[string]any{
25+
"input": map[string]any{
26+
"project": projectId,
27+
"readme": "readme test",
28+
"license": "license test",
29+
"topics": "topics test",
30+
},
31+
})
32+
_, _, layerId := addNLSLayerSimple(e, sceneId, "someTitle1", 1)
33+
// _, _, _, propertyId :=
34+
createPhotoOverlay(e, layerId)
35+
36+
projectDataPath := Request(e, uID.String(), GraphQLRequest{
2437
OperationName: "ExportProject",
2538
Query: ExportProjectMutation,
2639
Variables: map[string]any{
27-
"projectId": pID.String(),
40+
"projectId": projectId,
2841
},
29-
}
30-
31-
projectDataPath := Request(e, uID.String(), requestBody).
32-
Path("$.data.exportProject.projectDataPath").String()
42+
}).Path("$.data.exportProject.projectDataPath").String()
3343

3444
assert.NotNil(t, projectDataPath)
3545

46+
resp := e.GET(projectDataPath.Raw()).
47+
Expect().
48+
Status(200)
49+
50+
resp.Header("Content-Type").Contains("application/zip")
51+
body := resp.Body().Raw()
52+
assert.Greater(t, len(body), 0)
3653
}

server/internal/usecase/interactor/project.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,19 @@ func (i *Project) ImportProjectData(ctx context.Context, workspace string, proje
10041004
return nil, err
10051005
}
10061006

1007+
var readme *string
1008+
if ret, ok := projectData["readme"].(string); ok {
1009+
readme = &ret
1010+
}
1011+
var license *string
1012+
if ret, ok := projectData["license"].(string); ok {
1013+
license = &ret
1014+
}
1015+
var topics *string
1016+
if ret, ok := projectData["topics"].(string); ok {
1017+
topics = &ret
1018+
}
1019+
10071020
result, err := i.createProject(ctx, createProjectInput{
10081021
WorkspaceID: workspaceId,
10091022
ProjectID: projectId,
@@ -1015,9 +1028,9 @@ func (i *Project) ImportProjectData(ctx context.Context, workspace string, proje
10151028
Alias: &alias,
10161029
Archived: &archived,
10171030
CoreSupport: &coreSupport,
1018-
Readme: nil,
1019-
License: nil,
1020-
Topics: nil,
1031+
Readme: readme,
1032+
License: license,
1033+
Topics: topics,
10211034
}, op)
10221035
if err != nil {
10231036
return nil, err

0 commit comments

Comments
 (0)