-
-
Notifications
You must be signed in to change notification settings - Fork 573
Closed
Description
Models:
import {Column,Entity, OneToMany,PrimaryGeneratedColumn} from "typeorm";
import { WLogin } from "./wlogin.entity";
@Entity("users" ,{schema:"public" } )
export class Users {
@PrimaryGeneratedColumn({
type:"bigint",
name:"id"
})
id:string;
@Column("name")
name:string | null;
@OneToMany(()=>WebLogin, (wlogin: WLogin)=>wlogin.user,{ onDelete: 'CASCADE' ,onUpdate: 'CASCADE' })
wLogins:WLogin[];
}
WLogin
import { Column,Entity,Index,JoinColumn,ManyToOne,PrimaryGeneratedColumn, JoinTable } from "typeorm";
import { Users } from "./users.entity";
@Entity("wlogin" ,{schema:"public" })
export class WebLogin {
@PrimaryGeneratedColumn({
type:"bigint",
name:"id"
})
id:string;
@JoinColumn({ name:'user_id'})
@ManyToOne(type => Users, users => users.id)
user:Users | null;
}
But when I hit the service http://localhost:3000/weblogin?join=users, I'm only getting fields from wlogin table. But it should display the users name as well as mentioned in the entity. Can someone tell me what am I doing wrong in this case?
Metadata
Metadata
Assignees
Labels
No labels