generated from VLADIMIR/template
up
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"evening_detective_server/internal/services/screen_plan_service"
|
||||
proto "evening_detective_server/proto"
|
||||
)
|
||||
|
||||
func mapScreenPlanSteps(steps []*proto.ScreenPlanStep) []screen_plan_service.Step {
|
||||
mapped := make([]screen_plan_service.Step, 0, len(steps))
|
||||
for _, step := range steps {
|
||||
if step == nil {
|
||||
mapped = append(mapped, screen_plan_service.Step{})
|
||||
continue
|
||||
}
|
||||
mapped = append(mapped, screen_plan_service.Step{
|
||||
Mode: int32(step.Mode),
|
||||
Text: step.Text,
|
||||
TimerLabel: step.TimerLabel,
|
||||
TimerDurationSeconds: step.TimerDurationSeconds,
|
||||
})
|
||||
}
|
||||
return mapped
|
||||
}
|
||||
|
||||
func mapScreenPlan(plan *screen_plan_service.Plan) *proto.ScreenPlan {
|
||||
if plan == nil {
|
||||
return nil
|
||||
}
|
||||
steps := make([]*proto.ScreenPlanStep, 0, len(plan.Steps))
|
||||
for _, step := range plan.Steps {
|
||||
steps = append(steps, &proto.ScreenPlanStep{
|
||||
Mode: proto.ScreenMode(step.Mode),
|
||||
Text: step.Text,
|
||||
TimerLabel: step.TimerLabel,
|
||||
TimerDurationSeconds: step.TimerDurationSeconds,
|
||||
})
|
||||
}
|
||||
return &proto.ScreenPlan{Steps: steps, CurrentStep: int32(plan.CurrentStep)}
|
||||
}
|
||||
Reference in New Issue
Block a user