Skip to content

Commit

Permalink
fix(server): support group for generic data
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Mar 28, 2024
1 parent da630e9 commit 36a0aaf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/datacatalog/datacatalogv3/cms_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ type GenericItem struct {
Items []GenericItemDataset `json:"items,omitempty" cms:"items,group"`
OpenDataURL string `json:"open_data_url,omitempty" cms:"open_data_url,url"`
Category string `json:"category,omitempty" cms:"category,select"`
Group string `json:"group,omitempty" cms:"group,text"`
// metadata
Status *cms.Tag `json:"status,omitempty" cms:"status,select,metadata"`
Public bool `json:"public,omitempty" cms:"public,bool,metadata"`
Expand Down
7 changes: 7 additions & 0 deletions server/datacatalog/datacatalogv3/conv_dataset_generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package datacatalogv3

import (
"fmt"
"strings"

"github.com/eukarya-inc/reearth-plateauview/server/datacatalog/plateauapi"
"github.com/samber/lo"
Expand Down Expand Up @@ -48,6 +49,11 @@ func (i *GenericItem) toDatasets(area *areaContext, dts []plateauapi.DatasetType
}, true
})

var groups []string
if i.Group == "" {
groups = strings.Split(i.Group, "/")
}

res := plateauapi.GenericDataset{
ID: id,
Name: standardItemName(i.Name, "", area.Name()),
Expand All @@ -61,6 +67,7 @@ func (i *GenericItem) toDatasets(area *areaContext, dts []plateauapi.DatasetType
CityCode: area.CityCode,
TypeID: dt.GetID(),
TypeCode: dt.GetCode(),
Groups: groups,
Admin: newAdmin(i.ID, i.Stage(), cmsurl, nil),
Items: items,
}
Expand Down

0 comments on commit 36a0aaf

Please sign in to comment.