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-26 05:07:42 +00:00
|
|
|
Regions []*Region `json:"regions"`
|
2024-01-25 06:46:43 +00:00
|
|
|
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:
|
2024-01-26 05:07:42 +00:00
|
|
|
return makeUnifiedResponse(ctx, dest)
|
2024-01-24 16:09:39 +00:00
|
|
|
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
|