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

Feature: Add models on update callbacks #31

Merged
merged 5 commits into from
Mar 16, 2023

Conversation

syphax-bouazzouni
Copy link

@syphax-bouazzouni syphax-bouazzouni commented Mar 16, 2023

Requirement

This PR adds the possibility to add an onUpdate callback to a model attribute

For example

  attribute :name, enforce: [:string, :existence]
  attribute :first_name, onUpdate: :update_name
  attribute :last_name, onUpdate: :update_name


  def update_name(inst, attr)
    self.name = self.first_name + self.last_name
  end

Will ensure that each time we update firt_name or last_name we call the method update_name and make that name will always be firt_name + last_name

Changes

  • add onUpdate callback tests (c83687e)

  • implement enforce_callback to run an attribute callback (e4979ff)

  • move the attribute default callback to the save method (c7f7092)

  • implement onUpdate DSL in the ressource settings (f81b15f)

  • call to the attributes onUpdate callback in the save method (714f085)

@syphax-bouazzouni syphax-bouazzouni merged commit 90f3336 into development Mar 16, 2023
syphax-bouazzouni added a commit that referenced this pull request Jul 8, 2023
…date-callbacks

Feature: Add models on update callbacks
syphax-bouazzouni added a commit that referenced this pull request Sep 5, 2023
…date-callbacks

Feature: Add models on update callbacks
syphax-bouazzouni added a commit that referenced this pull request Sep 5, 2023
…date-callbacks

Feature: Add models on update callbacks
syphax-bouazzouni added a commit that referenced this pull request Dec 4, 2023
…scheme file and callbacks) (#45)

* Merge pull request #23 from ontoportal-lirmm/feature/add-property-datatype-dsl

Feature: add property data type dsl

* Merge pull request #26 from ontoportal-lirmm/refactor/resources-validators

Refactor: resources validators

* Merge pull request #27 from ontoportal-lirmm/feature/implement-new-validators

Feature: Implement new validators

* Merge pull request #28 from ontoportal-lirmm/feature/implement-new-validators

Feature: Implement instance proc validators

* Merge pull request #30 from ontoportal-lirmm/feature/add-model-scheme-yml-file

Feature/add model scheme yml file

* Merge pull request #31 from ontoportal-lirmm/feature/add-models-on-update-callbacks

Feature: Add models on update callbacks
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.

1 participant