[FEATURE] new decorators `@AfterAll`, `@BeforeAll`, `@OnAll`
Closed this issue · 0 comments
dragolea commented
Description
Handle all events in one decorator like @AfterAll
which will have the CREATE
, READ
, UPDATE
, DELETE
, BOUND ACTION
, BOUNS FUNCTION
Suggested solution
@AfterAll()
private async afterAll(
@Req() req: Request,
@Res() res: RequestResponse,
@Result() result: Book | Book[] | boolean,
): Promise<void> {
if (Array.isArray(result)) {
// when after `read` event was triggered
// console.log('READ');
} else if (typeof result === 'boolean') {
// when after `delete` event was triggered
// console.log('DELETE');
} else {
// when after `create`, `update` as triggered
// console.log('CREATE and UPDATE');
}
}