postgresql - typeorm: How to do a RIGHT JOIN and SELECT -
how 1 following query using typeorm please
select * "userstrength" right join "strength" on "strength"."id" = "userstrength"."strengthid"
where userstrengthentity defined as:
@entity("userstrength") export class userstrengthentity extends baseentity implements iuserstrength { @column({default: false}) iscompleted: boolean; @manytoone(type => userentity, user => user.userstrengtharray, { cascadeall: true }) @joincolumn({name: "userid"}) user: userentity; @onetomany(type => userstrengthitementity, userstrengthitem => userstrengthitem.userstrength, { cascadeinsert: true, cascadeupdate: true }) userstrengthitemarray?: userstrengthitementity[]; @manytoone(type => strengthentity, strength => strength.userstrengtharray, { cascadeall: true }) @joincolumn({name: "strengthid"}) strength: strengthentity; }
and strengthentity is:
@entity("strength") export class strengthentity extends baseentity implements istrength { @column({length: 50}) name: string; @column({length: 100}) title: string; @column() strengthtype: strengthtype; @column({length: 10, nullable: true}) titlecolor: string; @column({nullable: true}) titleicon: string; @manytoone(type => cliententity, cliententity => cliententity.strengtharray, { cascadeall: true }) @joincolumn({name: "clientid"}) client: cliententity @onetomany(type => strengthitementity, strengthitem => strengthitem.strength, { cascadeinsert: true, cascadeupdate: true }) strengthitemarray: strengthitementity[]; @onetomany(type => userstrengthentity, userstrength => userstrength.strength, { cascadeinsert: true, cascadeupdate: true }) userstrengtharray: userstrengthentity[]; }
i want load userstrength may or may not exist along strength given strengthtype (i need right join userentity further filter userentity.id)
could explain how accomplished typeorm please?
Comments
Post a Comment