Skip to content

Commit

Permalink
fix where statement (#4)
Browse files Browse the repository at this point in the history
* fix where statement

* update release
  • Loading branch information
DenisCarriere authored Sep 23, 2024
1 parent 0aa4c2e commit ce7d733
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ echo "CREATE DATABASE eos_transactions_v1 ON CLUSTER <cluster>" | clickhouse cli
> Linux x86 only
```console
$ wget https://github.com/pinax-network/antelope-transactions-api/releases/download/v0.3.0/antelope-transactions-api
$ wget https://github.com/pinax-network/antelope-transactions-api/releases/download/v0.3.1/antelope-transactions-api
$ chmod +x ./antelope-transactions-api
$ ./antelope-transactions-api --help
Usage: antelope-transactions-api [options]
Expand Down
7 changes: 7 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import { APIErrorResponse } from "./src/utils.js";
import { usageOperationsToEndpointsMap, type EndpointReturnTypes, type UsageEndpoints } from "./src/types/api.js";
import { paths } from './src/types/zod.gen.js';

await client.ping().then((result) => {
if (!result.success) {
logger.error(`Failed to connect to ClickHouse: ${result.error.message}`);
process.exit(1);
}
});

async function AntelopeTransactionsAPI() {
const app = new Hono();

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "antelope-transactions-api",
"description": "Transactions information from the Antelope blockchains",
"version": "0.3.0",
"version": "0.3.1",
"homepage": "https://github.com/pinax-network/antelope-transactions-api",
"license": "MIT",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion src/typespec/openapi3.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using TypeSpec.OpenAPI;
name: "MIT",
url: "https://github.com/pinax-network/antelope-transactions-api/blob/75db1c61477ac7ea5e56f775cefe54875af953d4/LICENSE",
},
version: "0.3.0",
version: "0.3.1",
}) // From @typespec/openapi
//@server("https://eos.api.pinax.network/v1", "EOS V1 Api Endpoint")
namespace AntelopeTransactionsApi;
Expand Down
5 changes: 3 additions & 2 deletions src/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export async function makeUsageQuery(ctx: Context, endpoint: UsageEndpoints, use
for (let key in query_params) {
if (["limit", "offset", "order_by", "order_direction", "skip", "first"].includes(key)) continue; // skip pagination params
const value = (query_params as any)[key];
where.push(`${key} = {${key}: ${typeof value === "number" ? "int" : "String"}}`);
let isNumber = !isNaN(Number(value));
where.push(`"${key}" = {${key}: ${isNumber ? "int" : "String"}}`);
}
if (where.length) query.push(`WHERE ${where.join(" AND ")}`);

Expand All @@ -48,4 +49,4 @@ export async function makeUsageQuery(ctx: Context, endpoint: UsageEndpoints, use
} catch (err) {
return APIErrorResponse(ctx, 500, "bad_database_response", err);
}
}
}
4 changes: 2 additions & 2 deletions static/@typespec/openapi3/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "MIT",
"url": "https://github.com/pinax-network/antelope-transactions-api/blob/75db1c61477ac7ea5e56f775cefe54875af953d4/LICENSE"
},
"version": "0.3.0"
"version": "0.3.1"
},
"tags": [
{
Expand Down Expand Up @@ -1877,4 +1877,4 @@
}
}
}
}
}

0 comments on commit ce7d733

Please sign in to comment.