You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// src/models/post.tsimport{BeforeInsert,Column,Entity,JoinColumn,ManyToOne,}from'typeorm'import{BaseEntity}from'@medusajs/medusa'import{generateEntityId}from'@medusajs/medusa/dist/utils'import{User}from'@medusajs/medusa'// I think this should not be './user' ?
@Entity()exportclassPostextendsBaseEntity{
@Column({type: 'varchar'})title: string|null
@Column({type: 'varchar'})author_id: string
@ManyToOne(()=>User,(user)=>user.posts)// <- Here property not exists
@JoinColumn({name: 'author_id'})author: User
@BeforeInsert()privatebeforeInsert(){this.id=generateEntityId(this.id,"post")}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I was trying to extend the
User
entity according to this Document. But I met something confusing.And the
Post
entity from the tutorialAnd the declaration file
And There are two errors on
![image](https://private-user-images.githubusercontent.com/48652450/266186224-d7552739-cd92-4655-90f1-3aa9d6874835.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEwNzY0OTEsIm5iZiI6MTcyMTA3NjE5MSwicGF0aCI6Ii80ODY1MjQ1MC8yNjYxODYyMjQtZDc1NTI3MzktY2Q5Mi00NjU1LTkwZjEtM2FhOWQ2ODc0ODM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE1VDIwNDMxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk3NDhlOTJjMjZiY2I4N2NkYjMzZjIxYjNkZDhlMjg5NzkxOTY5MGVhODMyYWUxMWZmMzFiNTI3OTMxM2ViNWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.MSb9S9Ac1-iFD7FRLOgngxamYc9qA033yJ7B9WihKPU)
![image](https://private-user-images.githubusercontent.com/48652450/266186783-ea50f34d-a04d-4cb4-bd33-8b7e4c2a97e6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEwNzY0OTEsIm5iZiI6MTcyMTA3NjE5MSwicGF0aCI6Ii80ODY1MjQ1MC8yNjYxODY3ODMtZWE1MGYzNGQtYTA0ZC00Y2I0LWJkMzMtOGI3ZTRjMmE5N2U2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE1VDIwNDMxMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM3ZTdhNWE4OGQyNGUyMmE1NzUwZjZjMzdiZjZiMjkwZjBlY2ZmNzhjNDhiOTM5NGNhMDdiMzY3OTliNzRiZGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.wuLJ8dgzXprJELzsXLM5glHh2HY-M_GfdSSCdcaF6Qw)
index.d.ts
I've looking through the issues and discussions, but not found any solution. If there is something I missed, my bad.
Beta Was this translation helpful? Give feedback.
All reactions