generated from VLADIMIR/template
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
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)}
|
|
}
|