We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, i'm new on nestjs, i have an issue with the join of these two entities, can't find why... any help ?..
Controller
@Crud({ model: { type: Housekeeper, }, query: { join: { geozones: { alias: "test", allow: ["postalCode"], eager: true, }, }, }, }) @ApiTags("housekeepers") @Controller("housekeepers") export class HousekeepersController implements CrudController<Housekeeper> {
Geozone.ts
@Entity() export class Geozone extends BaseEntity { @PrimaryGeneratedColumn() id: number; @IsDefined() @Validate(RelationExists, [{ targetEntity: "housekeeper", targetField: "id" }]) @ApiProperty({ type: "number" }) @ManyToOne(() => Housekeeper, (hs) => hs.geozones) @JoinColumn() owner: Housekeeper; @ApiProperty() @Column() postalCode: string; }
Housekeeper.ts
@Entity() export class Housekeeper extends BaseEntity { @PrimaryGeneratedColumn() id: number; @ApiProperty() @IsEmail() @Column({ unique: true }) email: string; @OneToMany(() => Geozone, (geozone) => geozone.owner) geozones: Geozone[]; }
Here is the error:
backend_1 | [Nest] 2197 - 04/16/2022, 6:27:43 PM LOG [NestApplication] Nest application successfully started +1ms backend_1 | [Nest] 2197 - 04/16/2022, 6:28:24 PM ERROR [ExceptionsHandler] Duplicate column name 'Housekeeper_id' backend_1 | QueryFailedError: Duplicate column name 'Housekeeper_id' backend_1 | at Query.onResult (/usr/src/app/src/driver/mysql/MysqlQueryRunner.ts:222:33) backend_1 | at Query.execute (/usr/src/app/node_modules/mysql2/lib/commands/command.js:36:14) backend_1 | at PoolConnection.handlePacket (/usr/src/app/node_modules/mysql2/lib/connection.js:456:32) backend_1 | at PacketParser.onPacket (/usr/src/app/node_modules/mysql2/lib/connection.js:85:12) backend_1 | at PacketParser.executeStart (/usr/src/app/node_modules/mysql2/lib/packet_parser.js:75:16) backend_1 | at Socket.<anonymous> (/usr/src/app/node_modules/mysql2/lib/connection.js:92:25) backend_1 | at Socket.emit (node:events:390:28) backend_1 | at addChunk (node:internal/streams/readable:315:12) backend_1 | at readableAddChunk (node:internal/streams/readable:289:9) backend_1 | at Socket.Readable.push (node:internal/streams/readable:228:10)
update: i found that this issue appears only when "limit" or "maxLimit" is set in query.
The text was updated successfully, but these errors were encountered:
Did you found out how it can be used with limit? Because it is basic paging functionality ... trying to tag team member @fwoelffel
Sorry, something went wrong.
Have same problem. It appears if limit is set. I have made a PR: #808
please try as it is entities field name @ghostlexly
No branches or pull requests
Hello, i'm new on nestjs,
i have an issue with the join of these two entities, can't find why...
any help ?..
Controller
Geozone.ts
Housekeeper.ts
Here is the error:
update:
i found that this issue appears only when "limit" or "maxLimit" is set in query.
The text was updated successfully, but these errors were encountered: