Questions tagged «typeorm»

6
TypeError:类扩展未定义的值不是函数或null
尝试创建这些实体时出现以下错误。 TypeError: Class extends value undefined is not a function or null 我假设这与循环依赖关系有关,但是在使用表继承和一对多关系时应该如何避免呢? 在抱怨以下javascript BaseComic_1.BaseComic。 let Variant = class Variant extends BaseComic_1.BaseComic { 这是完整的文件。 "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target …

4
NESTJS中的TypeORM实体-无法在模块外部使用import语句
使用“嵌套新”命令启动新项目。正常工作,直到我向其中添加实体文件。 出现以下错误: 从'typeorm'导入{Entity,Column,PrimaryGeneratedColumn}; ^^^^^^ SyntaxError:无法在模块外部使用import语句 我想念什么? 向模块添加实体: import { Module } from '@nestjs/common'; import { BooksController } from './books.controller'; import { BooksService } from './books.service'; import { BookEntity } from './book.entity'; import { TypeOrmModule } from '@nestjs/typeorm'; @Module({ imports: [TypeOrmModule.forFeature([BookEntity])], controllers: [BooksController], providers: [BooksService], }) export class BooksModule {} app.module.ts: …
11 nestjs  typeorm 

2
NestJS nodejs在具有关系的一个查询中加载嵌套注释?
我有以下型号: User,Customer,Comment 用户可以对发表评论Customer,用户可以递归地限制其他用户的评论。 我已经做到了,但仅限于一个答复,我想获得所有嵌套的答复: public async getCommentsForCustomerId(customerId: string): Promise<CustomerComment[]> { return this.find({where: {customer: {id: customerId}, parentComment: null}, relations: ['childComments']}); } 但是我得到的响应仅嵌套在一个级别上: [ { "id": "7b5b654a-efb0-4afa-82ee-c00c38725072", "content": "test", "created_at": "2019-12-03T15:14:48.000Z", "updated_at": "2019-12-03T15:14:49.000Z", "childComments": [ { "id": "7b5b654a-efb0-4afa-82ee-c00c38725073", "content": "test reply", "created_at": "2019-12-03T15:14:48.000Z", "updated_at": "2019-12-03T15:14:49.000Z", "parentCommentId": "7b5b654a-efb0-4afa-82ee-c00c38725072" } ] } ] 如何进行查询以将它们全部嵌套在typeorm中? …
10 node.js  typeorm 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.