Home > Software engineering >  How to implement an interface in an Entity using typeorm
How to implement an interface in an Entity using typeorm

Time:09-03

I'm using an entity "User" but I need to implement the currentMatch the user is playing so I did something like this

@Column({
nullable: true,
})
public currentMatch: Match;

Where Match is an interface with all the data I need from the match.

ERROR [ExceptionHandler] Data type "Match" in "UserEntity.currentMatch" is not supported by "postgres" database.

Is there a way to implement my interface to the entity ?

CodePudding user response:

You can try adding type: 'json'

@Column({
nullable: true,
type: 'json'
})
public currentMatch: Match;
  • Related