Buckets:
| import { Billing } from "../src/billing.js" | |
| import { Database, eq } from "../src/drizzle/index.js" | |
| import { WorkspaceTable } from "../src/schema/workspace.sql.js" | |
| // get input from command line | |
| const workspaceID = process.argv[2] | |
| const dollarAmount = process.argv[3] | |
| if (!workspaceID || !dollarAmount) { | |
| console.error("Usage: bun credit-workspace.ts <workspaceID> <dollarAmount>") | |
| process.exit(1) | |
| } | |
| // check workspace exists | |
| const workspace = await Database.use((tx) => | |
| tx | |
| .select() | |
| .from(WorkspaceTable) | |
| .where(eq(WorkspaceTable.id, workspaceID)) | |
| .then((rows) => rows[0]), | |
| ) | |
| if (!workspace) { | |
| console.error("Error: Workspace not found") | |
| process.exit(1) | |
| } | |
| const amountInDollars = parseFloat(dollarAmount) | |
| if (isNaN(amountInDollars) || amountInDollars <= 0) { | |
| console.error("Error: dollarAmount must be a positive number") | |
| process.exit(1) | |
| } | |
| await Billing.grantCredit(workspaceID, amountInDollars) | |
| console.log(`Added payment of $${amountInDollars.toFixed(2)} to workspace ${workspaceID}`) | |
Xet Storage Details
- Size:
- 1.02 kB
- Xet hash:
- 052e0ff3d6fb67dd1749b8dbb78be6e3858612837847d53702f4d6bfd881c3f6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.