EntityStore: Move slug+folder to summary metadata (#59620)
This commit is contained in:
@@ -10,6 +10,8 @@ type summarySupport struct {
|
||||
model *models.EntitySummary
|
||||
name string
|
||||
description *string // null or empty
|
||||
slug *string // null or empty
|
||||
folder *string // null or empty
|
||||
labels *string
|
||||
fields *string
|
||||
errors *string // should not allow saving with this!
|
||||
@@ -32,7 +34,12 @@ func newSummarySupport(summary *models.EntitySummary) (*summarySupport, error) {
|
||||
if summary.Description != "" {
|
||||
s.description = &summary.Description
|
||||
}
|
||||
|
||||
if summary.Slug != "" {
|
||||
s.slug = &summary.Slug
|
||||
}
|
||||
if summary.Folder != "" {
|
||||
s.folder = &summary.Folder
|
||||
}
|
||||
if len(summary.Labels) > 0 {
|
||||
js, err = json.Marshal(summary.Labels)
|
||||
if err != nil {
|
||||
@@ -71,6 +78,12 @@ func (s summarySupport) toEntitySummary() (*models.EntitySummary, error) {
|
||||
if s.description != nil {
|
||||
summary.Description = *s.description
|
||||
}
|
||||
if s.slug != nil {
|
||||
summary.Slug = *s.slug
|
||||
}
|
||||
if s.folder != nil {
|
||||
summary.Folder = *s.folder
|
||||
}
|
||||
if s.labels != nil {
|
||||
b := []byte(*s.labels)
|
||||
err = json.Unmarshal(b, &summary.Labels)
|
||||
|
||||
Reference in New Issue
Block a user