feat: implement core backend architecture and project management services for the History API
Build and Release / release (push) Successful in 1m33s

This commit is contained in:
2026-06-05 14:18:55 +07:00
parent 420a9ad43a
commit fdcd44cc00
70 changed files with 944 additions and 734 deletions
+13 -13
View File
@@ -9,7 +9,7 @@ import (
type RasterTileService interface {
GetMetadata(ctx context.Context) (map[string]string, *fiber.Error)
GetTile(ctx context.Context, z, x, y int) ([]byte, map[string]string, *fiber.Error)
GetTile(ctx context.Context, z, x, y int) (TileResponse, *fiber.Error)
}
type rasterTileService struct {
@@ -32,26 +32,26 @@ func (t *rasterTileService) GetMetadata(ctx context.Context) (map[string]string,
return metaData, nil
}
func (t *rasterTileService) GetTile(ctx context.Context, z, x, y int) ([]byte, map[string]string, *fiber.Error) {
contentType := make(map[string]string)
func (t *rasterTileService) GetTile(ctx context.Context, z, x, y int) (TileResponse, *fiber.Error) {
data, format, err := t.tileRepo.GetTile(ctx, z, x, y)
if err != nil {
return nil, contentType, fiber.NewError(fiber.StatusInternalServerError, "Failed to fetch tile data")
return TileResponse{}, fiber.NewError(fiber.StatusInternalServerError, "Failed to fetch tile data")
}
res := TileResponse{
Data: data,
CacheControl: tileCacheControl,
}
switch format {
case "png":
contentType["Content-Type"] = "image/png"
res.ContentType = "image/png"
case "jpg", "jpeg":
contentType["Content-Type"] = "image/jpeg"
res.ContentType = "image/jpeg"
case "webp":
contentType["Content-Type"] = "image/webp"
res.ContentType = "image/webp"
default:
contentType["Content-Type"] = "application/octet-stream"
res.ContentType = "application/octet-stream"
}
return data, contentType, nil
return res, nil
}