2024-01-17 06:34:08 +00:00
|
|
|
package navi
|
2023-11-17 17:42:04 +00:00
|
|
|
|
|
|
|
import (
|
2024-01-17 06:34:08 +00:00
|
|
|
"code.smartsheep.studio/goatworks/roadsign/pkg/navi/transformers"
|
|
|
|
|
2023-11-25 15:00:34 +00:00
|
|
|
"github.com/gofiber/fiber/v2"
|
2023-11-17 17:42:04 +00:00
|
|
|
)
|
|
|
|
|
2023-12-12 13:07:05 +00:00
|
|
|
type RoadApp struct {
|
2024-01-25 06:46:43 +00:00
|
|
|
Regions []*Region `json:"regions"`
|
|
|
|
Traces []RoadTrace `json:"traces"`
|
2023-11-17 17:42:04 +00:00
|
|
|
}
|
|
|
|
|
2024-01-24 16:09:39 +00:00
|
|
|
func (v *RoadApp) Forward(ctx *fiber.Ctx, dest *Destination) error {
|
|
|
|
switch dest.GetType() {
|
|
|
|
case DestinationHypertext:
|
|
|
|
return makeHypertextResponse(ctx, dest)
|
|
|
|
case DestinationStaticFile:
|
|
|
|
return makeFileResponse(ctx, dest)
|
2023-11-17 17:42:04 +00:00
|
|
|
default:
|
|
|
|
return fiber.ErrBadGateway
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-24 16:09:39 +00:00
|
|
|
type RequestTransformerConfig = transformers.TransformerConfig
|