1602 / 1602/jugglingdb

Support multiple hooks per action

Aperta
#446 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
2k
Fork
238
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

It should be possible to add multiple hooks per action. Also let's get rid of mixin-style hooks declaration. Hook should return promise.

```
User.afterCreate = function(data, done) {
Basket.create({userId: this.id}, (err, basket) => {
done(err);
});
};
```

should become

```
User.hooks.after('create', user => Basket.create({userId: user.id}));
```

Old mixin-style should be deprecated from next stable version.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Look at the ORM's hook system, likely in a hooks or lifecycle module. Understand how hooks are currently attached (mixin-style) and the data flow. The change involves designing a new API for multiple promises per action and deprecating the old style. Check existing tests for hooks to understand the expected behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, nodejs
Ambito
backend, databases
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.