คำถามติดแท็ก typeorm

4
TypeORM Entity ใน NESTJS - ไม่สามารถใช้คำสั่งนำเข้านอกโมดูล
เริ่มต้นโครงการใหม่ด้วยคำสั่ง 'nest new' ทำงานได้ดีจนกว่าฉันจะเพิ่มไฟล์เอนทิตีลงไป มีข้อผิดพลาดดังต่อไปนี้: นำเข้า {Entity, คอลัมน์, PrimaryGeneratedColumn} จาก 'typeorm'; ^^^^^^ SyntaxError: ไม่สามารถใช้คำสั่งนำเข้านอกโมดูล ฉันคิดถึงอะไร การเพิ่มเอนทิตีลงในโมดูล: 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: …
11 nestjs  typeorm 

2
NestJS nodejs โหลดความคิดเห็นซ้อนในหนึ่งแบบสอบถามที่มีความสัมพันธ์?
ฉันมีโมเดลดังต่อไปนี้: User, Customer,Comment ผู้ใช้สามารถแสดงความคิดเห็นในCustomerผู้ใช้สามารถตอบกลับความคิดเห็นของผู้ใช้คนอื่นไม่ จำกัด ซ้ำ ฉันได้ทำสิ่งนี้แล้ว แต่ จำกัด ไว้เพียงคำตอบเดียวและฉันต้องการได้รับคำตอบทั้งหมด NESTED: 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", …
10 node.js  typeorm 
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.