Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
CREATE TABLE provider_inventory (
owner TEXT PRIMARY KEY,
host_uri TEXT NOT NULL,
ip_region TEXT,
uptime_7d DOUBLE PRECISION,
is_online BOOLEAN NOT NULL DEFAULT false,
is_online_since TIMESTAMPTZ,

Expand Down
12 changes: 0 additions & 12 deletions apps/provider-inventory/drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@
"primaryKey": false,
"notNull": true
},
"ip_region": {
"name": "ip_region",
"type": "text",
"primaryKey": false,
"notNull": false
},
"uptime_7d": {
"name": "uptime_7d",
"type": "double precision",
"primaryKey": false,
"notNull": false
},
"is_online": {
"name": "is_online",
"type": "boolean",
Expand Down
2 changes: 1 addition & 1 deletion apps/provider-inventory/env/.env.functional.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
POSTGRES_BASE_URL=postgres://postgres:password@localhost:5432
PROVIDER_INVENTORY_POSTGRES_URL=postgres://postgres:password@localhost:5432
LOG_LEVEL=warn
STD_OUT_LOG_FORMAT=pretty
REST_API_NODE_URL=https://api.sandbox-2.aksh.pw:443
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sql } from "drizzle-orm";
import { bigint, boolean, doublePrecision, index, pgTable, text, timestamp } from "drizzle-orm/pg-core";
import { bigint, boolean, index, pgTable, text, timestamp } from "drizzle-orm/pg-core";

import { jsonbBigint } from "@src/lib/jsonb-bigint/jsonb-bigint.column";

Expand All @@ -8,8 +8,6 @@ export const providerInventory = pgTable(
{
owner: text("owner").primaryKey(),
hostUri: text("host_uri").notNull(),
ipRegion: text("ip_region"),
uptime7d: doublePrecision("uptime_7d"),
isOnline: boolean("is_online").notNull().default(false),
isOnlineSince: timestamp("is_online_since", { withTimezone: true }),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export class BidScreeningRepository {
.select({
owner: providerInventory.owner,
hostUri: providerInventory.hostUri,
ipRegion: providerInventory.ipRegion,
uptime7d: providerInventory.uptime7d,
inventory: providerInventory.inventory,
isAudited: sql<boolean>`${providerInventory.auditedBy} @> ARRAY[${AUDITOR}]::text[]`.as("isAudited")
})
Expand All @@ -42,8 +40,6 @@ export class BidScreeningRepository {
return rows.map(row => ({
owner: row.owner,
hostUri: row.hostUri,
ipRegion: row.ipRegion,
uptime7d: row.uptime7d,
cluster: hydrateClusterState(row.inventory),
isAudited: row.isAudited
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ function makeCandidate(owner: string, overrides?: { isAudited?: boolean }): BidS
return {
owner,
hostUri: "https://provider.example.com:8443",
ipRegion: "us-east",
uptime7d: 0.998,
isAudited: overrides?.isAudited ?? false,
cluster: {
nodes: [
Expand Down
2 changes: 0 additions & 2 deletions apps/provider-inventory/src/types/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ import type { ClusterState } from "./inventory.types";
export interface ProviderWithClusterState {
owner: string;
hostUri: string;
ipRegion?: string | null;
uptime7d?: number | null;
cluster: ClusterState;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export class TestDatabaseService {
readonly #dbName: string;

constructor(testPath: string) {
if (!process.env.POSTGRES_BASE_URL) {
throw new Error("POSTGRES_BASE_URL is not set");
if (!process.env.PROVIDER_INVENTORY_POSTGRES_URL) {
throw new Error("PROVIDER_INVENTORY_POSTGRES_URL is not set");
}
const fileName = path.basename(testPath).replace(/\.(spec|integration)\.ts$/, "");
const prefix = randomUUID().replace(/-/g, "");
this.#postgresUri = process.env.POSTGRES_BASE_URL;
this.#postgresUri = process.env.PROVIDER_INVENTORY_POSTGRES_URL;
this.#dbName = `pi_test_${prefix}_${fileName}`.replace(/\W+/g, "_");
process.env.PROVIDER_INVENTORY_POSTGRES_URL = `${this.#postgresUri}/${this.#dbName}`;
}
Expand Down
Loading