Skip to content
Open
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
1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "dist/index.js",
"scripts": {
"dev": "tsx watch src/index.ts",
"prebuild": "npm run prisma:generate",
"build": "tsc",
"start": "node dist/index.js",
"test": "jest --runInBand",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- CreateTable
CREATE TABLE "IdempotencyKey" (
"id" TEXT NOT NULL PRIMARY KEY,
"keyId" TEXT NOT NULL,
"tenantId" TEXT NOT NULL,
"walletAddress" TEXT,
"operation" TEXT NOT NULL,
"status" TEXT NOT NULL DEFAULT 'pending',
"requestHash" TEXT NOT NULL,
"responseHash" TEXT,
"responseBody" TEXT,
"statusCode" INTEGER,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"completedAt" DATETIME,
"expiresAt" DATETIME NOT NULL
);

-- CreateIndex
CREATE INDEX "IdempotencyKey_expiresAt_idx" ON "IdempotencyKey"("expiresAt");

-- CreateIndex
CREATE UNIQUE INDEX "IdempotencyKey_keyId_tenantId_key" ON "IdempotencyKey"("keyId", "tenantId");

19 changes: 19 additions & 0 deletions backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -604,3 +604,22 @@ model WriteAheadAuditEntry {
@@index([configType])
@@index([actor])
}

model IdempotencyKey {
id String @id @default(uuid())
keyId String
tenantId String
walletAddress String?
operation String
status String @default("pending") // pending | completed | failed
requestHash String
responseHash String?
responseBody String?
statusCode Int?
createdAt DateTime @default(now())
completedAt DateTime?
expiresAt DateTime

@@unique([keyId, tenantId])
@@index([expiresAt])
}
12 changes: 11 additions & 1 deletion backend/schema-snapshots/get-_health.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@
"degraded",
"unknown"
]
},
"indexer": {
"type": "string",
"enum": [
"up",
"down",
"degraded",
"unknown"
]
}
},
"required": [
Expand All @@ -90,7 +99,8 @@
"databasePrimary",
"databaseReplica",
"prisma",
"jobs"
"jobs",
"indexer"
],
"additionalProperties": false
},
Expand Down
6 changes: 5 additions & 1 deletion backend/schema-snapshots/get-_ready.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@
},
"prisma": {
"type": "boolean"
},
"indexer": {
"type": "boolean"
}
},
"required": [
"cache",
"stellarRpc",
"database",
"prisma"
"prisma",
"indexer"
],
"additionalProperties": false
}
Expand Down