Skip to content

Commit

Permalink
make workspaceId not null
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-tey committed Dec 24, 2024
1 parent e48f785 commit ee2bee2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 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
4 changes: 2 additions & 2 deletions packages/prisma/schema/invoice.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ enum InvoiceStatus {
model Invoice {
id String @id @default(cuid())
programId String
workspaceId String?
workspaceId String
status InvoiceStatus @default(processing)
amount Int @default(0)
fee Int @default(0)
Expand All @@ -17,7 +17,7 @@ model Invoice {
payouts Payout[]
program Program @relation(fields: [programId], references: [id])
workspace Project? @relation(fields: [workspaceId], references: [id])
workspace Project @relation(fields: [workspaceId], references: [id])
@@index([programId])
@@index([workspaceId])
Expand Down

0 comments on commit ee2bee2

Please sign in to comment.