Skip to content

Commit

Permalink
Merge branch 'dub-customer' of https://github.com/dubinc/dub into dub…
Browse files Browse the repository at this point in the history
…-customer
  • Loading branch information
steven-tey committed Dec 25, 2024
2 parents 915b40d + 76a9747 commit 3eaf985
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
12 changes: 1 addition & 11 deletions apps/web/app/api/workspaces/[idOrSlug]/billing/invoices/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,9 @@ const subscriptionInvoices = async (stripeId: string) => {
};

const payoutInvoices = async (workspaceId: string) => {
const program = await prisma.program.findFirst({
where: {
workspaceId,
},
});

if (!program) {
return [];
}

const invoices = await prisma.invoice.findMany({
where: {
programId: program.id,
workspaceId,
},
select: {
id: true,
Expand Down
1 change: 1 addition & 0 deletions apps/web/lib/actions/partners/confirm-payouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const confirmPayoutsAction = authActionClient
data: {
id: createId({ prefix: "inv_" }),
programId,
workspaceId: workspace.id,
amount,
fee,
total,
Expand Down
6 changes: 5 additions & 1 deletion packages/prisma/schema/invoice.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ enum InvoiceStatus {
model Invoice {
id String @id @default(cuid())
programId String
workspaceId String
status InvoiceStatus @default(processing)
amount Int @default(0)
fee Int @default(0)
total Int @default(0)
receiptUrl String? @db.LongText
createdAt DateTime @default(now())
program Program @relation(fields: [programId], references: [id])
payouts Payout[]
program Program @relation(fields: [programId], references: [id])
workspace Project @relation(fields: [workspaceId], references: [id])
@@index([programId])
@@index([workspaceId])
}
1 change: 1 addition & 0 deletions packages/prisma/schema/workspace.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ model Project {
domains Domain[]
tags Tag[]
programs Program[]
invoices Invoice[]
customers Customer[]
defaultDomains DefaultDomains[]
restrictedTokens RestrictedToken[]
Expand Down

0 comments on commit 3eaf985

Please sign in to comment.