-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: store and send metadata during invoice creation
- Loading branch information
1 parent
ccf1a10
commit e9875b0
Showing
8 changed files
with
4,387 additions
and
4,437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"imports": { | ||
"@nostr/tools": "jsr:@nostr/tools@^2.10.3", | ||
"hono": "jsr:@hono/hono@^4.5.5", | ||
"drizzle-orm": "npm:[email protected]", | ||
"drizzle-kit": "npm:[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CREATE TABLE IF NOT EXISTS "invoices" ( | ||
"id" serial PRIMARY KEY NOT NULL, | ||
"amount" integer NOT NULL, | ||
"description" text, | ||
"description_hash" text, | ||
"payment_request" text NOT NULL, | ||
"payment_hash" text NOT NULL, | ||
"metadata" jsonb, | ||
"created_at" timestamp DEFAULT now() NOT NULL, | ||
CONSTRAINT "invoices_payment_request_unique" UNIQUE("payment_request"), | ||
CONSTRAINT "invoices_payment_hash_unique" UNIQUE("payment_hash") | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
{ | ||
"id": "54f6d0b9-47e0-450e-8c68-e0a3b0ac72ae", | ||
"prevId": "e292703e-d08b-4f8b-a9eb-3937fe872be7", | ||
"version": "7", | ||
"dialect": "postgresql", | ||
"tables": { | ||
"public.invoices": { | ||
"name": "invoices", | ||
"schema": "", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "serial", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"amount": { | ||
"name": "amount", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"description": { | ||
"name": "description", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"description_hash": { | ||
"name": "description_hash", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"payment_request": { | ||
"name": "payment_request", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"payment_hash": { | ||
"name": "payment_hash", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"metadata": { | ||
"name": "metadata", | ||
"type": "jsonb", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "timestamp", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": "now()" | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": { | ||
"invoices_payment_request_unique": { | ||
"name": "invoices_payment_request_unique", | ||
"nullsNotDistinct": false, | ||
"columns": [ | ||
"payment_request" | ||
] | ||
}, | ||
"invoices_payment_hash_unique": { | ||
"name": "invoices_payment_hash_unique", | ||
"nullsNotDistinct": false, | ||
"columns": [ | ||
"payment_hash" | ||
] | ||
} | ||
} | ||
}, | ||
"public.users": { | ||
"name": "users", | ||
"schema": "", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "serial", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"connection_secret": { | ||
"name": "connection_secret", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"username": { | ||
"name": "username", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "timestamp", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"default": "now()" | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": { | ||
"users_username_unique": { | ||
"name": "users_username_unique", | ||
"nullsNotDistinct": false, | ||
"columns": [ | ||
"username" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"enums": {}, | ||
"schemas": {}, | ||
"sequences": {}, | ||
"_meta": { | ||
"columns": {}, | ||
"schemas": {}, | ||
"tables": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core"; | ||
import { integer, jsonb, pgTable, serial, text, timestamp } from "drizzle-orm/pg-core"; | ||
|
||
export const users = pgTable("users", { | ||
id: serial("id").primaryKey(), | ||
encryptedConnectionSecret: text("connection_secret").notNull(), | ||
username: text("username").unique().notNull(), | ||
createdAt: timestamp("created_at").notNull().defaultNow(), | ||
}); | ||
|
||
export const invoices = pgTable("invoices", { | ||
id: serial("id").primaryKey(), | ||
amount: integer("amount").notNull(), | ||
description: text("description"), | ||
descriptionHash: text("description_hash"), | ||
paymentRequest: text("payment_request").unique().notNull(), | ||
paymentHash: text("payment_hash").unique().notNull(), | ||
metadata: jsonb("metadata"), | ||
createdAt: timestamp("created_at").notNull().defaultNow(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters