fix images

This commit is contained in:
2026-07-24 01:08:09 +07:00
parent 871331f14d
commit c79cff2709
3 changed files with 6 additions and 2 deletions
Binary file not shown.
@@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"evening_detective_server/internal/modules/storytelling" "evening_detective_server/internal/modules/storytelling"
"evening_detective_server/internal/repos" "evening_detective_server/internal/repos"
"strings"
) )
func mapScenarios( func mapScenarios(
@@ -57,7 +58,10 @@ func mapStory(o string, domain string) (*storytelling.Story, error) {
return res, nil return res, nil
} }
func convertStory(o *storytelling.Story) (string, error) { func convertStory(o *storytelling.Story, domain string) (string, error) {
for _, place := range o.Places {
place.Image = strings.TrimLeft(place.Image, domain)
}
b, err := json.Marshal(o) b, err := json.Marshal(o)
if err != nil { if err != nil {
return "", err return "", err
@@ -143,7 +143,7 @@ func (s *ScenarioService) updateStory(ctx context.Context, id int, story *storyt
return errors.New("Такой код точки уже существует") return errors.New("Такой код точки уже существует")
} }
storyString, err := convertStory(story) storyString, err := convertStory(story, s.domain)
if err != nil { if err != nil {
return err return err
} }