-
Notifications
You must be signed in to change notification settings - Fork 52
Undefined type error. Make sure you are providing an explicit type for the "alerts" of the "AlertType" class.
#334
New issue
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
Comments
You can see that it works just fine in normal setup with NestJS: https://github.com/kasir-barati/bugs/tree/normal-one-to-many-rel |
I am trying to debug this issue with an example, but I am having a bit of trouble. It does not make sense to me that although I have said in my entities (written in TypeORM) that I wanna have a What in the world is happening here? |
Took a quick look, but relations are not defined with |
I had to tell that it MUST use the import { Field, GraphQLISODateTime, ObjectType } from '@nestjs/graphql'
import { FilterableField } from '@ptc-org/nestjs-query-graphql'
import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
import { AlertType } from '../alert-type/alert-type.entity'
@ObjectType()
@Entity()
export class Alert {
@Column('uuid', { name: 'userId' })
@Field({ description: "Who's the creator of this alert" })
@FilterableField()
userId: string
} |
You lost me here? If I understand you this is a issue with TypeORM and not this lib? |
If you ask me I would say some configuration somewhere is causing TypeORM to behave this way. But let's ignore it right now since it is not directly related to this issue. BTW I am reading the docs ATM. Will update you here. |
Thanks to this comments I was able to pin point the issue and solve it (RTFM, I did not read it completely). This was a lesson I learned. First read the docs completely. |
Describe the bug
So it is fairly simple, just have a 1:N relation between alert and alert type. Need to allow users to fetch:
Have you read the Contributing Guidelines?
Yup.
To Reproduce
Clone my repo: https://github.com/kasir-barati/nestjs-materials
cd typeorm
.pnpm i --frozen-lockfile
.nx serve botprobe-nest
Expected behavior
Just start like it was before adding this piece of code in my
alert-type.entity.ts
:https://github.com/kasir-barati/nestjs-materials/blob/0b712a5de535c7cb8204aa8eac5d9344af9afaa3/typeorm/apps/botprobe-nest/src/alert-type/entities/alert-type.entity.ts#L41-L45
Screenshots

Desktop (please complete the following information):
Additional context
Error message in text:
I am kinda wondering if I am experiencing what they are talking about it here: https://stackoverflow.com/a/72300528/8784518
The text was updated successfully, but these errors were encountered: