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

Add support for device tags #191

Merged
merged 9 commits into from
Jun 8, 2022
Merged

Commits on Jun 1, 2022

  1. Generate Devices.Tags schema

    Generated with:
    
    mix phx.gen.schema Devices.Tag tags tenant_id:references:tenants \
      name:string:unique
    
    License headers added afterwards
    
    Signed-off-by: Riccardo Binetti <riccardo.binetti@secomind.com>
    rbino committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    5eec3ff View commit details
    Browse the repository at this point in the history
  2. Adapt the generated tags schema to our needs

    - Use the correct defaults for tenant_id
    - Scope the unique_index to :tenant_id additionally
    - Add the unique_index on id and tenant_id needed for foreign keys
    - Make name not null
    
    Signed-off-by: Riccardo Binetti <riccardo.binetti@secomind.com>
    rbino committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    0b57dbd View commit details
    Browse the repository at this point in the history
  3. Add DeviceTag association schema

    Generated with:
    
    mix phx.gen.schema Devices.DeviceTag devices_tags tenant_id:references:tenants \
      tag_id:references:tags device_id:references:devices
    
    License header added after generation.
    
    Signed-off-by: Riccardo Binetti <riccardo.binetti@secomind.com>
    rbino committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    5c60732 View commit details
    Browse the repository at this point in the history
  4. Associate Devices with Tags

    Rework the schema and migration to accomodate the change:
    - No need for a primary key in devices_tags, use a composite one
    - Autogenerate tenant_id (use integer since id fields can't have an autogenerate
    option)
    - Adjust all references to take tenant_id into account
    
    Signed-off-by: Riccardo Binetti <riccardo.binetti@secomind.com>
    rbino committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    510d99c View commit details
    Browse the repository at this point in the history
  5. astarte: add tag handling in update_device

    Also add relevant tests
    
    Signed-off-by: Riccardo Binetti <riccardo.binetti@secomind.com>
    rbino committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    ac32633 View commit details
    Browse the repository at this point in the history
  6. astarte: preload tags when querying the device

    Signed-off-by: Riccardo Binetti <riccardo.binetti@secomind.com>
    rbino committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    0160a71 View commit details
    Browse the repository at this point in the history
  7. astarte: add tag filtering

    Signed-off-by: Riccardo Binetti <riccardo.binetti@secomind.com>
    rbino committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    f8ae18a View commit details
    Browse the repository at this point in the history
  8. Add device tag handling in the GraphQL schema

    Show tags for the device object and allow updating them with the update_device
    mutation. Add all the relevant tests.
    
    Signed-off-by: Riccardo Binetti <riccardo.binetti@secomind.com>
    rbino committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    8442681 View commit details
    Browse the repository at this point in the history
  9. Update CHANGELOG

    Signed-off-by: Riccardo Binetti <riccardo.binetti@secomind.com>
    rbino committed Jun 1, 2022
    Configuration menu
    Copy the full SHA
    634023b View commit details
    Browse the repository at this point in the history