This commit is contained in:
2026-08-21 00:09:32 +07:00
parent 7656100fe6
commit a2cadf6eca
20 changed files with 320 additions and 94 deletions
+8 -5
View File
@@ -9,6 +9,9 @@ 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 {
@@ -117,8 +120,8 @@ func mapKey(o *storytelling.Key) *proto.Key {
func convertPlace(o *proto.Place) *storytelling.Place {
return &storytelling.Place{
Code: o.Code,
Name: formatter_utils.FormatString(o.Name),
Text: formatter_utils.FormatText(o.Text),
Name: textFormatter.FormatString(o.Name),
Text: textFormatter.FormatText(o.Text),
Image: o.Image,
Hidden: o.Hidden,
Applications: convertApplications(o.Applications),
@@ -153,7 +156,7 @@ func convertKeys(o []*proto.Key) []*storytelling.Key {
func convertApplication(o *proto.Application) *storytelling.Application {
return &storytelling.Application{
Name: formatter_utils.FormatString(o.Name),
Name: textFormatter.FormatString(o.Name),
Image: o.Image,
}
}
@@ -161,13 +164,13 @@ func convertApplication(o *proto.Application) *storytelling.Application {
func convertDoor(o *proto.Door) *storytelling.Door {
return &storytelling.Door{
Code: o.Code,
Name: formatter_utils.FormatString(o.Name),
Name: textFormatter.FormatString(o.Name),
Keys: convertKeys(o.Keys),
}
}
func convertKey(o *proto.Key) *storytelling.Key {
return &storytelling.Key{
Name: formatter_utils.FormatString(o.Name),
Name: textFormatter.FormatString(o.Name),
}
}