diff --git a/data-layer/api/api.go b/api/api.go similarity index 100% rename from data-layer/api/api.go rename to api/api.go diff --git a/data-layer/cmd/api/main.go b/cmd/api/main.go similarity index 100% rename from data-layer/cmd/api/main.go rename to cmd/api/main.go diff --git a/data-layer/go.mod b/go.mod similarity index 100% rename from data-layer/go.mod rename to go.mod diff --git a/data-layer/go.sum b/go.sum similarity index 100% rename from data-layer/go.sum rename to go.sum diff --git a/data-layer/internal/handlers/api.go b/internal/handlers/api.go similarity index 100% rename from data-layer/internal/handlers/api.go rename to internal/handlers/api.go diff --git a/data-layer/internal/handlers/get_blocks.go b/internal/handlers/get_blocks.go similarity index 97% rename from data-layer/internal/handlers/get_blocks.go rename to internal/handlers/get_blocks.go index bcabf72..51ce078 100644 --- a/data-layer/internal/handlers/get_blocks.go +++ b/internal/handlers/get_blocks.go @@ -31,7 +31,7 @@ func GetBlocks(w http.ResponseWriter, r *http.Request) { api.InternalErrorHandler(w) return } - defer conn.Close() + // defer conn.Close() row := conn.QueryRow(context.Background(), "SELECT block_hash FROM chainsaw.blocks LIMIT 1") var blockHash string @@ -55,4 +55,6 @@ func GetBlocks(w http.ResponseWriter, r *http.Request) { api.InternalErrorHandler(w) return } + + defer conn.Close() } \ No newline at end of file diff --git a/data-layer/internal/middleware/authorization.go b/internal/middleware/authorization.go similarity index 100% rename from data-layer/internal/middleware/authorization.go rename to internal/middleware/authorization.go diff --git a/data-layer/internal/tools/clickhouse.go b/internal/tools/clickhouse.go similarity index 96% rename from data-layer/internal/tools/clickhouse.go rename to internal/tools/clickhouse.go index 747cb53..1fabf88 100644 --- a/data-layer/internal/tools/clickhouse.go +++ b/internal/tools/clickhouse.go @@ -11,7 +11,7 @@ import ( ) func ConnectDB() (clickhouse.Conn, error) { - // Load .env file + // TODO load .env in the mapi main file err := godotenv.Load() if err != nil { return nil, fmt.Errorf("error loading .env file: %w", err) diff --git a/data-layer/src/Worker.go b/src/Worker.go similarity index 100% rename from data-layer/src/Worker.go rename to src/Worker.go diff --git a/data-layer/src/main.go b/src/main.go similarity index 100% rename from data-layer/src/main.go rename to src/main.go