I have a big problem with EventSubscribers of typeorm
& postgresSql
.
I need to set Notification
for a newly created Entity
inside AfterInsert
event on TypeormEventSubscriber
but, when I try to set the relations there is nothing inserted into the database to do that.
# Output of event.entity
Entity: {
id: 34,
}
# It seems everyting is ok and record inserted but it's not.
Typeorm runs every query including the event hooks query inside a transaction as it seems, until every query is not done correctly, nothing is inserted into the database, which means I can not create relations in that events even in AfterInserted
because nothing is written into tables.
there is no other solution for this use case?
I can write the code after entity saved within my service but, not what I’m looking for.
thanks…
TYPEORM
:POSTGRESQL
Set relations on event hooks