Skip to content

Conversation

natesilva
Copy link
Contributor

@natesilva natesilva commented Aug 14, 2017

Decorators for declaring hook methods in Model classes.

Includes README update, tests (100% coverage of new code).

Fixes #88

@natesilva natesilva changed the title feature(hooks): add decorators for declaring hooks (fixes #88) feature(hooks): add decorators for declaring hooks Aug 14, 2017
@codecov-io
Copy link

codecov-io commented Aug 14, 2017

Codecov Report

Merging #97 into master will increase coverage by 0.65%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #97      +/-   ##
=========================================
+ Coverage   95.65%   96.3%   +0.65%     
=========================================
  Files          66      99      +33     
  Lines         759     893     +134     
  Branches      106     114       +8     
=========================================
+ Hits          726     860     +134     
  Misses         11      11              
  Partials       22      22
Impacted Files Coverage Δ
lib/annotations/hooks/BeforeBulkDelete.ts 100% <100%> (ø)
lib/annotations/hooks/AfterFind.ts 100% <100%> (ø)
lib/annotations/hooks/BeforeBulkUpdate.ts 100% <100%> (ø)
lib/annotations/hooks/AfterSave.ts 100% <100%> (ø)
lib/annotations/hooks/AfterBulkUpdate.ts 100% <100%> (ø)
lib/models/BaseSequelize.ts 91.42% <100%> (+0.51%) ⬆️
lib/annotations/hooks/AfterBulkDestroy.ts 100% <100%> (ø)
lib/annotations/hooks/BeforeBulkRestore.ts 100% <100%> (ø)
lib/annotations/hooks/BeforeCount.ts 100% <100%> (ø)
lib/annotations/hooks/BeforeSave.ts 100% <100%> (ø)
... and 59 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84a0538...30dc64b. Read the comment docs.

@RobinBuschmann
Copy link
Member

RobinBuschmann commented Aug 16, 2017

Great job.

I've added one comment to your code :)

export function AfterBulkCreate(options: IHookOptions): Function;
export function AfterBulkCreate(...args: any[]): void|Function {

if (args.length === 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to separate this (line 8-20) to an additional method in the hooks service cause these lines appear in every hook annotation. What do you think?

@natesilva natesilva closed this Aug 17, 2017
@natesilva natesilva deleted the feature/hooks branch August 17, 2017 16:58
@natesilva
Copy link
Contributor Author

I messed up this branch. Re-opened the pull request as #101.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants