~/ Cultured Man
~/ Cultured Man
Explore posts from servers
PPrisma
Created by ~/ Cultured Man on 12/24/2024 in #help-and-questions
PrismaClientKnownRequestError: Invalid prisma.b2bTransaction.findUnique()
prisma table B2bTransaction exists in database cross-checked with the studio, but when try to use in hono on production, it gives this error:
PrismaClientKnownRequestError: Invalid prisma.b2bTransaction.findUnique() invocation: The table public.B2bTransaction does not exist in the current database.
PrismaClientKnownRequestError: Invalid prisma.b2bTransaction.findUnique() invocation: The table public.B2bTransaction does not exist in the current database.
table schema
model B2bTransaction {
id String @id @default(uuid())
amount Int
timestamp DateTime @default(now())
status TransactionStatus
type TransactionType

webhookId String? @unique // To track webhook processing
webhookStatus WebhookStatus?
webhookAttempts Int @default(0)
lastWebhookAttempt DateTime?

senderUserId String?
receiverUserId String?

senderAccountNumber String?
receiverAccountNumber String?

senderBankName String
receiverBankName String


senderUser User? @relation("SenderBankRelation", fields: [senderUserId], references: [id], onDelete: SetNull)
receiverUser User? @relation("ReceiverBankRelation", fields: [receiverUserId], references: [id], onDelete: SetNull)

@@index([senderUserId])
@@index([receiverUserId])
@@index([webhookId])
}
model B2bTransaction {
id String @id @default(uuid())
amount Int
timestamp DateTime @default(now())
status TransactionStatus
type TransactionType

webhookId String? @unique // To track webhook processing
webhookStatus WebhookStatus?
webhookAttempts Int @default(0)
lastWebhookAttempt DateTime?

senderUserId String?
receiverUserId String?

senderAccountNumber String?
receiverAccountNumber String?

senderBankName String
receiverBankName String


senderUser User? @relation("SenderBankRelation", fields: [senderUserId], references: [id], onDelete: SetNull)
receiverUser User? @relation("ReceiverBankRelation", fields: [receiverUserId], references: [id], onDelete: SetNull)

@@index([senderUserId])
@@index([receiverUserId])
@@index([webhookId])
}
target code:
if (!decryptedData.txnId) {
return { success: false, message: "Transaction ID not found", paymentToken: null };
}

// fetch transaction data
const transaction = await db.b2bTransaction.findUnique({
where: {
id: decryptedData.txnId,
//webhookId: webhookId!
},
select: {
id: true,
senderUserId: true,
receiverUserId: true,
senderBankName: true,
amount: true,
status: true,
webhookStatus: true,
},
});
if (!decryptedData.txnId) {
return { success: false, message: "Transaction ID not found", paymentToken: null };
}

// fetch transaction data
const transaction = await db.b2bTransaction.findUnique({
where: {
id: decryptedData.txnId,
//webhookId: webhookId!
},
select: {
id: true,
senderUserId: true,
receiverUserId: true,
senderBankName: true,
amount: true,
status: true,
webhookStatus: true,
},
});
prisma version: "@prisma/client": "^5.22.0",
10 replies
CDCloudflare Developers
Created by ~/ Cultured Man on 10/19/2024 in #general-help
Integreate cloudflare workers and pages in turbo repo
Hello everyone, So, I have a turbo repo which consists of currently 1 next-js app: user-app and 1 node+express: webhook and I am thinking of adding 2 other apps one for fe: pages and one for be: worker I have a common DB for the whole project in packages/DB/prisma, so I will be directly communicating with it my ques: Is it possible to integrate this or just 1 next-js app with Cloudflare in turbo-repo? I would greatly appreciate any suggestions, blog posts, or videos.
/root-repo

├── turbo.json

├── package/
│ └── db/
│ └── prisma/
│ ├── schema.prisma
│ ├── migrations/
│ └── seed.ts

├── apps/
│ ├── user-app/
│ │ ├── package.json
│ │ ├── next.config.js
│ │ ├── public/
│ │ ├── src/
│ │ └── (other Next.js specific files)
│ │
│ ├── webhook/
│ │ ├── package.json
│ │ ├── index.js (or index.ts)
│ │ └── (other Node.js specific files)
│ │
│ ├── cloudflare-pages/ [to add]
│ │ ├── package.json
│ │ ├── (other Cloudflare Pages specific files)
│ │
│ └── cloudflare-workers/ [to add]
│ ├── package.json
│ ├── index.js (or index.ts)
│ └── (other Cloudflare Workers specific files)

└── (other project files, e.g., README.md, .gitignore)
/root-repo

├── turbo.json

├── package/
│ └── db/
│ └── prisma/
│ ├── schema.prisma
│ ├── migrations/
│ └── seed.ts

├── apps/
│ ├── user-app/
│ │ ├── package.json
│ │ ├── next.config.js
│ │ ├── public/
│ │ ├── src/
│ │ └── (other Next.js specific files)
│ │
│ ├── webhook/
│ │ ├── package.json
│ │ ├── index.js (or index.ts)
│ │ └── (other Node.js specific files)
│ │
│ ├── cloudflare-pages/ [to add]
│ │ ├── package.json
│ │ ├── (other Cloudflare Pages specific files)
│ │
│ └── cloudflare-workers/ [to add]
│ ├── package.json
│ ├── index.js (or index.ts)
│ └── (other Cloudflare Workers specific files)

└── (other project files, e.g., README.md, .gitignore)
1 replies