Skip to content

Instantly share code, notes, and snippets.

@stevepentler
Last active February 18, 2019 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevepentler/674eb13b6015daa961599f41ad08b612 to your computer and use it in GitHub Desktop.
Save stevepentler/674eb13b6015daa961599f41ad08b612 to your computer and use it in GitHub Desktop.

Labels

  • whole path is saved to array, ending in it's own key.
  • can lookup parent/children very easily with scopes
  • adding/querying is easy & fast, but rearrangment gets more complicated
  • belong to Brandfolder
  • soft deleted (all children soft deleted too)
  • api/v4/(brandfolders || collections)/:key/labels
    • #index (see permissions section below)
    • #create
  • api/v4/labels_controller/:key
    • #update (except for path)
    • #move (parent_key) handles all children
    • #destroy
  • scopes
    • child_lookup_for
    • parent_lookup_for
    • peers_for
    • closest_descendants
    • with_depth
    • ordered_by_depth
    • at_depth

AssetLabels

  • Asset Label joins table
  • api/v4/bulk_actions/assets_controller
    • #add_to_label
    • #remove_from_label
  • soft deleted

Permissions

  • v4/bulk_actions/assets/#add_to_label && #remove_from_label
    • Brandfolder/Collection Collab+
  • v4/resource/:key/labels#index
    • Brandfolders
      • Collab+ returns all associated labels
      • Guest joins AssetLabels & returns ALL PARENTS for those labels
    • Collections
      • joins AssetLabels & returns all parents
  • v4/resources/:key/labels#create && api/v4/labels_controller/:key#update && #move && #destroy
    • Brandfolder Admin+ (No Collection Admins)

Possible changes:

  1. Id's in path instead of keys (length considerations)
  2. add/remove in bulk assets controller? brandfolder_key requirement in the bulk assets controller? (Kevin)
  3. Destroy/Move to async job due to cascade effect 3.5 Transaction blocks (nest_under/move method, BulkAssets#add_to_label)
  4. Deny move in #update => custom error message (Kevin)
  5. org_consistency validations... thoughts?
  6. Label validations (path length limited to depth of 20, name must be present)

Notes

  • path @> $PATH = where path contains $PATH
  • path <@ $PATH = where $PATH is contained by path

References

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