forked from storacha/w3infra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbilling-db-stack.js
29 lines (25 loc) · 1.14 KB
/
billing-db-stack.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Table, Config } from 'sst/constructs'
import { customerTableProps } from '../billing/tables/customer.js'
import { spaceDiffTableProps } from '../billing/tables/space-diff.js'
import { spaceSnapshotTableProps } from '../billing/tables/space-snapshot.js'
import { usageTableProps } from '../billing/tables/usage.js'
/**
* @param {import('sst/constructs').StackContext} properties
*/
export const BillingDbStack = ({ stack }) => {
const customerTable = new Table(stack, 'customer', customerTableProps)
const spaceSnapshotTable = new Table(stack, 'space-snapshot', spaceSnapshotTableProps)
const spaceDiffTable = new Table(stack, 'space-diff', spaceDiffTableProps)
const usageTable = new Table(stack, 'usage', {
...usageTableProps,
stream: 'new_image'
})
stack.addOutputs({
customerTableName: customerTable.tableName,
spaceSnapshotTableName: spaceSnapshotTable.tableName,
spaceDiffTableName: spaceDiffTable.tableName,
usageTable: usageTable.tableName
})
const stripeSecretKey = new Config.Secret(stack, 'STRIPE_SECRET_KEY')
return { customerTable, spaceSnapshotTable, spaceDiffTable, usageTable, stripeSecretKey }
}