Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks for DB CRUD calls #166

Closed
3 tasks done
etsuo opened this issue Apr 18, 2018 · 0 comments
Closed
3 tasks done

Hooks for DB CRUD calls #166

etsuo opened this issue Apr 18, 2018 · 0 comments
Assignees
Milestone

Comments

@etsuo
Copy link
Member

etsuo commented Apr 18, 2018

for example, a model might have:

@BeforeSave()
onBeforeSave() {
}

Which gets called before modelThing.save().

Candidate decorators:

  1. @BeforeSave()
  2. @AfterSave()
  3. @BeforeCreate()
  4. @AfterCreate()

etc.

This will make it easier to make sure fields like updatedAt are automatically handled instead of having to worry each time you create or save a model.

These should be multiply applicable... i.e., you should be able to have as many @BeforeSave() on as many methods on a Model as you want.

These should also be async and they should allow the integrator to reject with the befores to stop the actual transaction from happening.

  • beforeSave
  • beforeCreate

  • Open ticket to add afterSave, afterCreate and other possible before/after decorators
@etsuo etsuo added the feature label Apr 18, 2018
@etsuo etsuo modified the milestones: 0.13.0, next Apr 18, 2018
@etsuo etsuo self-assigned this Apr 22, 2018
etsuo added a commit that referenced this issue Apr 22, 2018
@etsuo etsuo closed this as completed in 4f71fc5 Apr 22, 2018
@etsuo etsuo removed the in progress label Apr 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant