This commit is contained in:
2026-09-17 13:04:44 +07:00
parent e3cbf18220
commit 5ba640bfe4
12 changed files with 19 additions and 60 deletions
+9 -12
View File
@@ -9,9 +9,6 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"
)
// textFormatter — форматирование текста при конвертации входящих данных.
var textFormatter = formatter_utils.NewFormatter()
func mapScenarios(o []*scenarios_service.Scenario) []*proto.Scenario {
res := make([]*proto.Scenario, 0, len(o))
for _, item := range o {
@@ -66,7 +63,7 @@ func convertConclusion(o *proto.Conclusion) *storytelling.Conclusion {
if o == nil || (o.Text == "" && o.Video == "") {
return nil
}
return &storytelling.Conclusion{Text: textFormatter.FormatText(o.Text), Video: o.Video}
return &storytelling.Conclusion{Text: formatter_utils.FormatText(o.Text), Video: o.Video}
}
func mapIntroduction(o *storytelling.Introduction) *proto.Introduction {
@@ -149,8 +146,8 @@ func mapKey(o *storytelling.Key) *proto.Key {
func convertPlace(o *proto.Place) *storytelling.Place {
return &storytelling.Place{
Code: o.Code,
Name: textFormatter.FormatString(o.Name),
Text: textFormatter.FormatText(o.Text),
Name: formatter_utils.FormatString(o.Name),
Text: formatter_utils.FormatText(o.Text),
Image: o.Image,
Hidden: o.Hidden,
Applications: convertApplications(o.Applications),
@@ -185,7 +182,7 @@ func convertKeys(o []*proto.Key) []*storytelling.Key {
func convertApplication(o *proto.Application) *storytelling.Application {
return &storytelling.Application{
Name: textFormatter.FormatString(o.Name),
Name: formatter_utils.FormatString(o.Name),
Image: o.Image,
FileType: o.FileType,
}
@@ -194,14 +191,14 @@ func convertApplication(o *proto.Application) *storytelling.Application {
func convertDoor(o *proto.Door) *storytelling.Door {
return &storytelling.Door{
Code: o.Code,
Name: textFormatter.FormatString(o.Name),
Name: formatter_utils.FormatString(o.Name),
Keys: convertKeys(o.Keys),
}
}
func convertKey(o *proto.Key) *storytelling.Key {
return &storytelling.Key{
Name: textFormatter.FormatString(o.Name),
Name: formatter_utils.FormatString(o.Name),
}
}
@@ -210,7 +207,7 @@ func convertIntroduction(o *proto.Introduction) *storytelling.Introduction {
return nil
}
return &storytelling.Introduction{
Text: textFormatter.FormatText(o.Text),
Text: formatter_utils.FormatText(o.Text),
Audio: o.Audio,
}
}
@@ -240,7 +237,7 @@ func convertQuestion(o *proto.Question) *storytelling.Question {
}
return &storytelling.Question{
Code: o.Code,
Text: textFormatter.FormatText(o.Text),
Answer: textFormatter.FormatText(o.Answer),
Text: formatter_utils.FormatText(o.Text),
Answer: formatter_utils.FormatText(o.Answer),
}
}