cost 208 ms
无法使用 nestjs 中的另一个 shcema 在棱镜模式中搜索数据 - Can't search data in prisma schema using aonther shcema in nestjs

编辑: 使用 where: { id: userId } don't help ,因为它使用书签的 id 而不是添加书签的用户进行搜索我的目标是能够使用来自另一个 model 的 userId 在书签表中进行搜索。 在这个使用 Prisma 的 model 文件中,我有两个模型(一个用于用户,一个用 ...

单元测试说无法读取未定义的属性“映射” - Unit test say that cannot read property 'map' of undefined

我正在尝试通过 mocking 和 addressList 对方法运行统一测试,但它说它无法读取未定义的属性。 方法: 问题是,当我放置一个 console.log() 来读取变量“pagination”时,它向我显示了一个在 concole 上不为空的数组: 这就是存储库返回给我的内容。 我要运 ...

开玩笑错误:预期为“{”,得到“命名空间”...使用命名空间和@Injectable - Jest Error: Expected '{', got 'namespace' ... Using namespace and @Injectable

我正在使用:NestJS,我有一个使用命名空间导出的 class。 在导出命名空间之后,我有 NestJS @Injectable装饰器,当我尝试运行测试时出现以下错误: × Expected '{', got 'namespace' 没有@Injectable ,测试运行没有问题,但我需要Inj ...

Nest JS 使用全局管道验证来自外部 API 的数据 - Nest JS validate data from an external API using global pipes

我正在开发一个 Nestjs 项目。 在这里,我从另一个 rest API 获取数据。我从 API 获取数据并将其存储在我的数据库中。 但是,我需要验证我得到的 API 中的数据。 我如何使用class-validator来做到这一点? 我在 main.ts 文件中使用了全局 pipe,例如 - 我 ...

Prisma / NestJS:错误:找不到模块“src/prisma/prisma.module.js”需要堆栈: - Prisma / NestJS : Error: Cannot find module 'src/prisma/prisma.module.js' Require stack:

我正在使用 Prisma 和 NestJS 开发一个项目。 错误: 当我尝试在我的 PrismaModule 中添加@Global装饰器时发生。 我直接Ctrl+Z 还是报错。 我认为这是一个编译问题,但不知道如何恢复它。 这是我的代码:prisma.module.ts 棱镜服务.ts 我想在其中 ...

如何使用 Typeorm 在 postgresql 中搜索并返回关系的变异值? - How do I search in the postgresql using Typeorm and return the mutated value for relation?

我在应用程序Nestjs中有一个具有 Role 关系的 User 实体。 当我想从数据库中获取用户时,我会这样做: 我得到这样的数据: 但我不想获得 object 的角色,我只想要此示例中的名称: 所以,我的问题是如何获得关系并仅返回{... role: "user" }的值? ...

NestJS / Prisma:键入'{ id:string; }' 不可分配给类型 'CustomersWhereUniqueInput' - NestJS / Prisma : Type '{ id: string; }' is not assignable to type 'CustomersWhereUniqueInput'

今天我正在使用 NestJS 开发一个新项目,我对 NestJS 很陌生,尤其是 Prisma。 我遵循了有关 prisma 文档的 本教程,并尝试将其适应我的项目。 正如错误所说,问题发生在findOne function 内部。 我认为这是我的类型。 我已经阅读了很多东西,但似乎没有什么与我遇 ...

NestJs v9 无法解决我的依赖性,尽管它似乎已正确导入。 同一个项目曾经在 NestJs 7 中工作 - NestJs v9 doesn't resolve my dependency eventhough it seems to be properly imported. The same project used to work in NestJs 7

我有一个导出 DatabaseUserRepository 的模块: 另一个项目正试图将其注入自定义提供程序: 我在运行时出现以下错误: Nest 无法解析 getProjectUsecases (?) 的依赖项。 请确保索引 [0] 处的参数 DatabaseProjectRepository ...

Nest 错误 - 错误 [ExceptionHandler] Nest 无法解析 AuthService 的依赖项(?,JwtService) - Nest Error - ERROR [ExceptionHandler] Nest can't resolve dependencies of the AuthService (?, JwtService)

我正在尝试用于用户身份验证的 JWT 服务出现问题错误 [ExceptionHandler] Nest 无法解析 AuthService (?, JwtService) 的依赖项。 请确保索引 [0] 处的参数 UsersService 在 AuthModule 上下文中可用。 这是 auth.m ...

我在抛出不应该发生的 BadRequestException 时遇到错误 - I'm facing a n error when throwing a BadRequestException which is not supposed to happen

我正在编写一个基本注册 api 并使用 find() function 检查是否有任何重复的 api 并且在 if() 条件下我抛出 BadRequestException 但如果输入 email 已在使用中,它会给我一个错误。 另一个项目中非常相似的代码没有给出任何错误,但这是错误的。 这是代码片 ...

NestJS Jest 错误:TypeError:无法读取未定义的属性(读取“[来自所需配置的任何变量]”) - NestJS Jest error: TypeError: Cannot read properties of undefined (reading '[any variable from required config]')

在尝试使用 nest 的笑话在单元测试中覆盖项目时,我遇到了一个测试模块无法从配置中提取变量的问题。 基本上,我有一个 EmailService,我想测试它,我在我的测试模块中将它用作提供者。 自然地,由于 EmailService 在其构造函数中使用 ConfigService 从配置中提取一些 ...

如何在GraphQL和Nestjs执行上下文中访问父查询arguments - How to access parent query arguments in GraphQL and Nestjs execution context

假设我们有一家书店和一个作者实体,为了向作者显示他们的收入统计数据,我们想检查经过身份验证的用户是否确实是作者本人。 所以我们有: 我们可以这样查询: 现在假设我们想要使用自定义 Guard 而不是 if 语句。 像下面这样的东西: 当AutherGuard用于getEarnings处理程序时,如 ...


 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM