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