I am encountering an issue with a GET
request. I have two entities, the primary one being Article
and the secondary one being ArticleContent
. For some reason, when attempting to retrieve a previously created entity, the ArticleContent
column returns as null
instead of displaying the corresponding id.
Below is the structure of the Article
entity:
@Entity('article')
export class Article extends DefaultEntity {
@Column({ type: 'integer', default: 0 })
numberOfViews: number;
@Column({
type: 'enum',
enum: ArticleType,
default: ArticleType.BLOG,
})
type: ArticleType;
@OneToOne(() => ArticleContent, { cascade: true, eager: true })
@JoinColumn()
content: ArticleContent;
}
And here is the setup for the ArticleContent
entity:
@Entity({ name: 'article_content' })
export class ArticleContent extends DefaultEntity {
@Column({ type: 'text' })
title: string;
@Column({ type: 'text', nullable: true })
summary: string;
@Column({ type: 'text', nullable: true })
description: string;
}
This is how I execute the POST
request:
{
"numberOfViews" : "13",
"type:" : "NEWS",
"content" : [{
"title" : "TEST"
}]
}
Upon inspecting the results of the GET
request, I notice that the content
attribute shows as null
.