1602 / 1602/jugglingdb

Support multiple hooks per action

Offen
#446 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
2k
Forks
238
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, nodejs
Bereich
backend, databases
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.