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

Update APIs include function overhaul #209

Closed
4 tasks done
vestrel00 opened this issue May 18, 2022 · 1 comment
Closed
4 tasks done

Update APIs include function overhaul #209

vestrel00 opened this issue May 18, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@vestrel00
Copy link
Owner

vestrel00 commented May 18, 2022

Problem

Not including all fields in the include function of the Update, ProfileUpdate, and DataUpdate APIs could lead to unwanted and unexpected behavior.

Included fields result in expected behavior of updating the database to match the data contained in the ContactEntity/RawContactEntity instances.

On the other hand, fields that are not included result in a bit of unclear behavior that is not very well-documented. For example,

contactsApi.update().include(Fields.Email.all).rawContacts(rawContactToUpdate).commit()

Currently, the above will perform insert/update/delete database operations ensure that the emails in the Data table matches the emails contained in rawContactToUpdate.

All other data corresponding to non-included fields will be set to null or deleted if they are empty. This may have been the original desired behavior at the time of implementing include for update APIs. However, in retrospect, that is NOT how it should be. Users of this library can just set the data/properties in rawContactToUpdate to null if they want to remove it from the Data table...

Solution

Overhaul the behavior of the include functions in Update, ProfileUpdate, and DataUpdate such that;

  1. Update operations are performed on data corresponding to included fields such that the Contacts Provider database tables contain the same data as the in-memory models provided in the operation.
    • This is already the current behavior.
  2. Update operations are NOT performed on data corresponding to excluded/non-included fields such that the Contacts Provider database tables contain the same data before and after the operation. This may result in the database containing data that is different from the in-memory models provided in the operation.
    • This is NOT the current behavior. This is what needs to be done for this issue.

Note that "update operations" may involve insert/update/delete database operations internally.

Acceptance criteria

  • Implement the solution
  • Update all documentation in Kotlin files
  • Update all documentation in markdown files
  • Update gh-pages
@vestrel00 vestrel00 added the enhancement New feature or request label May 18, 2022
@vestrel00 vestrel00 self-assigned this May 18, 2022
@vestrel00 vestrel00 added this to In progress in General maintenance May 18, 2022
@vestrel00 vestrel00 pinned this issue May 18, 2022
vestrel00 added a commit that referenced this issue May 19, 2022
@vestrel00 vestrel00 moved this from In progress to Done in General maintenance May 19, 2022
@vestrel00 vestrel00 unpinned this issue May 19, 2022
@vestrel00
Copy link
Owner Author

This is included in release 0.2.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant