This commit is contained in:
@@ -8,8 +8,8 @@ import (
|
||||
)
|
||||
|
||||
type RasterTileService interface {
|
||||
GetMetadata(ctx context.Context) (map[string]string, error)
|
||||
GetTile(ctx context.Context, z, x, y int) ([]byte, map[string]string, error)
|
||||
GetMetadata(ctx context.Context) (map[string]string, *fiber.Error)
|
||||
GetTile(ctx context.Context, z, x, y int) ([]byte, map[string]string, *fiber.Error)
|
||||
}
|
||||
|
||||
type rasterTileService struct {
|
||||
@@ -24,21 +24,21 @@ func NewRasterTileService(
|
||||
}
|
||||
}
|
||||
|
||||
func (t *rasterTileService) GetMetadata(ctx context.Context) (map[string]string, error) {
|
||||
func (t *rasterTileService) GetMetadata(ctx context.Context) (map[string]string, *fiber.Error) {
|
||||
metaData, err := t.tileRepo.GetMetadata(ctx)
|
||||
if err != nil {
|
||||
return nil, fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
return nil, fiber.NewError(fiber.StatusInternalServerError, "Failed to fetch map metadata")
|
||||
}
|
||||
return metaData, nil
|
||||
}
|
||||
|
||||
|
||||
func (t *rasterTileService) GetTile(ctx context.Context, z, x, y int) ([]byte, map[string]string, error) {
|
||||
func (t *rasterTileService) GetTile(ctx context.Context, z, x, y int) ([]byte, map[string]string, *fiber.Error) {
|
||||
contentType := make(map[string]string)
|
||||
|
||||
data, format, err := t.tileRepo.GetTile(ctx, z, x, y)
|
||||
if err != nil {
|
||||
return nil, contentType, fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
return nil, contentType, fiber.NewError(fiber.StatusInternalServerError, "Failed to fetch tile data")
|
||||
}
|
||||
|
||||
switch format {
|
||||
|
||||
Reference in New Issue
Block a user