generated from VLADIMIR/template
add images
This commit is contained in:
Binary file not shown.
@@ -25,7 +25,7 @@ func mapScenario(
|
|||||||
o *repos.Scenario,
|
o *repos.Scenario,
|
||||||
domain string,
|
domain string,
|
||||||
) (*Scenario, error) {
|
) (*Scenario, error) {
|
||||||
story, err := mapStory(o.Scenario)
|
story, err := mapStory(o.Scenario, domain)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -44,11 +44,16 @@ func mapScenario(
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func mapStory(o string) (*storytelling.Story, error) {
|
func mapStory(o string, domain string) (*storytelling.Story, error) {
|
||||||
res := &storytelling.Story{}
|
res := &storytelling.Story{}
|
||||||
if err := json.Unmarshal([]byte(o), res); err != nil {
|
if err := json.Unmarshal([]byte(o), res); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
for _, place := range res.Places {
|
||||||
|
if place.Image != "" {
|
||||||
|
place.Image = domain + place.Image
|
||||||
|
}
|
||||||
|
}
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ func (s *ScenarioService) getStory(ctx context.Context, id int) (*storytelling.S
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return mapStory(storyString)
|
return mapStory(storyString, s.domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storytelling.Story) error {
|
func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storytelling.Story) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user