Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

288
Visualizações
How to force TypeORM to update an entity using repository.save() even if there are no changes

I have introduced certain decorators to the fields in my entity class that get triggered when an entity is saved using repository.save()

I am using entitySubscriber interface to check for events (Reference) and calling certain methods to perform an operation like this:

public beforeUpdate({ entity }: UpdateEvent<any>): void {
     encryptData(entity);
  }

But I noticed that this method is only called when we actually update certain fields in the entity. Is there a way to override this behaviour so that this method is called or in other words @BeforeUpdate hook is triggered every time we do a repository.save() ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Nope unless you modify the TypeORM sourcecode.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda