[英]Can't search data in prisma schema using aonther shcema in nestjs
編輯: 使用 where: { id: userId } don't help ,因為它使用書簽的 id 而不是添加書簽的用戶進行搜索我的目標是能夠使用來自另一個 model 的 userId 在書簽表中進行搜索。 在這個使用 Prisma 的 model 文件中,我有兩個模型(一個用於用戶,一個用 ...
[英]Can't search data in prisma schema using aonther shcema in nestjs
編輯: 使用 where: { id: userId } don't help ,因為它使用書簽的 id 而不是添加書簽的用戶進行搜索我的目標是能夠使用來自另一個 model 的 userId 在書簽表中進行搜索。 在這個使用 Prisma 的 model 文件中,我有兩個模型(一個用於用戶,一個用 ...
[英]change database based on request origin using expressjs & prisma
我想根據請求來源動態更改數據庫。 我創建了一個在每條路線上調用的 globalMiddleware。 // middlwares/global.middleware.js import DBController from "../controllers/db.controller.js"; imp ...
[英]Migrating Apollo Server from v3 to v4 in next.js
在 v3 中你可以這樣寫“createHandler”: 這在 v4 中是不可能的。 錯誤是: “ApolloServer<BaseContext>”類型上不存在屬性“createHandler”。 我閱讀了文檔,但無法理解如何做等效的我嘗試使用這個https://github.co ...
[英]Prisma batch upsert with raw SQL
我想對 postgres 中的表進行批量更新插入。 由於 prisma 在其 api 中不支持此功能,因此我必須使用$executeRaw 。 我對如何正確使用Prisma.join和Prisma.sql將數據插入模板標簽有點困惑。 這篇文章似乎表明了一個可能的解決方案: https://gith ...
[英]Prisma / NestJS : Error: Cannot find module 'src/prisma/prisma.module.js' Require stack:
我正在使用 Prisma 和 NestJS 開發一個項目。 錯誤: 當我嘗試在我的 PrismaModule 中添加@Global裝飾器時發生。 我直接Ctrl+Z 還是報錯。 我認為這是一個編譯問題,但不知道如何恢復它。 這是我的代碼:prisma.module.ts 棱鏡服務.ts 我想在其中 ...
[英]NestJS / Prisma : Type '{ id: string; }' is not assignable to type 'CustomersWhereUniqueInput'
今天我正在使用 NestJS 開發一個新項目,我對 NestJS 很陌生,尤其是 Prisma。 我遵循了有關 prisma 文檔的 本教程,並嘗試將其適應我的項目。 正如錯誤所說,問題發生在findOne function 內部。 我認為這是我的類型。 我已經閱讀了很多東西,但似乎沒有什么與我遇 ...
[英]How to do Prisma runtime model validation?
在我的應用程序中,我已經使用類驗證器在 DTO 級別驗證了輸入憑據。 但我需要像 sequelize ORM 這樣的運行時 model 驗證。 在續集中: 是否有可能在 Prisma 中進行 model 驗證? ...
[英]References a sub model from parent in typescript using prisma client
我正在學習 prisma,如果返回的數據包含子 model,我無法弄清楚如何正確使用 prisma 類型。 比如我有下面兩張表 然后我使用以下方法從服務 model 中提取數據: 然后我在客戶端引用Services model,但 IDE 沒有檢測到Services可以包含sub_services ...
[英]Next.js prisma recipe - ERROR [ExceptionHandler] Nest can't resolve dependencies of the AppController (?, PostService)
我遵循https://docs.nestjs.com/recipes/prisma上的食譜(兩次),但出現以下錯誤: 錯誤 [ExceptionHandler] Nest 無法解析 AppController(?,PostService)的依賴項。 請確保索引 [0] 處的參數 UserServi ...
[英]Why is my schema.prisma not automatically adding '@relation' when autosaving?
我正在使用 T3 堆棧構建 NextJS 應用程序。 當我自動保存我的 schema.prisma 文件時,它不會自動添加 @relation 標簽,一個朋友正在使用相同的堆棧並且沒有任何問題。 我用粉紅色突出顯示了我希望自動生成的部分我試圖更新棱鏡。 我安裝了 prisma 擴展。 我試圖用谷歌 ...
[英]GraphQLError: Syntax Error: Expected Name, found ")"
我一直收到這個錯誤,據說來自 typeDefs 這是我的服務 解析器: 我不斷收到此錯誤: ...
[英]How to write Prisma queryRaw Mysql iLike correctly?
我在 nextJs 使用 Prisma。 所以,我有這個工作查詢: 但我需要將變量名傳遞給該 queryRaw。 我應該怎么寫才正確? 請參閱PrismaDocs ,其中僅適用於 Postgres 示例但在 mySQL($1 無法識別變量)中不起作用。 ...
[英]How to update a Prisma model that has a relation "one-to-many" in Nestjs
我在 nestjs 中有這兩個 prisma 模型: 和 我對 create 方法沒有問題,但我找不到一種方法來更新鏈接字段,而不會 typescript 對我大喊大叫或出現 nestjs 錯誤。 我不明白更新此特定字段的步驟。 例如這里是我的代碼 還有我的 DTO: ...
[英]Pisma Unique constraint failed
你好(我是法國人,抱歉我的英語不好!!) 我想為一個具有 prisma 模式的項目創建數據庫,其中有一個用戶表,另一個用於用戶寫的評論,最后一個用於喜歡(每個用戶都可以喜歡每個評論)。 所以我的架構是: model User { idUser Int @id @default ...
[英]How to filter by relationships using each Prisma orm
我有一個一對多的關系,我需要過濾關系值,我需要帶上所有包含數組所有值的記錄/ 示例: const attributes = ["Car", "Bike", "Truck"] 此搜索僅在所有attributes都存在時才有效,如果任何屬性不存在,則不返回任何內容我需要它來返回記錄,即使 typeCa ...
[英]Typescript with Prisma
我是 Typescript 的新手。 我已經開始使用 Prisma,並且來自 Sequelize,我懷念簡單地編寫一些東西,例如user.update({... }) 。 似乎 Prisma 只返回普通對象,而不是類,所以我想出了這個:import { Prisma, User as PrismaU ...
[英]Unable to match input value to any allowed input type for the field error - Prisma -Seed
運行種子命令tsx prisma/seed.ts ... 它無法創建帖子,因為它返回錯誤 → 6 await prisma.habit.create( 無法驗證查詢: Unable to match input value to any allowed input type for the fie ...
[英]Prisma update operation failing in validator; using generated `UncheckedUpdateInput` type instead of `UpdateInput` type
我正在嘗試執行更新操作: const specialItem = await db.specialItem.update({ where: query, data: formattedUpdate }) 該語句中的值formattedUpdate看起來像這樣:{ item_name: nul ...
[英]Need to call an api for each key stroke in react, but the response can have thousands of objects
我在前端使用 react 和 axios,在后端使用帶有 prisma 的 nextjs。 我在數據庫中有 4000 個包含健身練習的練習。 我想創建一個 function,每次擊鍵,api 都會查找相關的練習。 我完成了創建它,但我有一些問題: 主要問題是響應從第一次擊鍵開始延遲,因為負載響應太大 ...
[英]Prisma seed - cannot read properties of undefined (reading 'findFirst')
我在使用 prisma seed 時遇到了一個奇怪的問題,這是我以前從未遇到過的,並且很難理解是什么原因造成的。 該應用程序托管在 nextjs 全棧項目中。 我有以下棱鏡初始化腳本: 在我的應用程序 ( next dev ) 中使用 prisma 時,一切正常並且正在執行查詢。 但是,當我嘗試運 ...