Project

General

Profile

« Previous | Next » 

Revision 751dbca8

Added by Brad Buckingham over 10 years ago

Content Views Rework: Filters: change parameters hash to be separate rules models/schema

This commit contains a fundamental change to how the 'parameters' for a filter
are handled. Previously, the parameters were defined as a serialized hash placed on the
filter. The format of the hash varied depending upon the type of filter (e.g. package).

While the parameters hash has some benefits (e.g. ease of changing
structure without impacting schema, all variations handled by single schema),
it does have some drawbacks (e.g. no id for a given parameter, created/updated
dates must be manually maintained by the app, slow search times, difficulty
performing validations across filters...etc).

Due to the drawbacks, this commit is creating new schema/model
to support the parameters (now called 'rules'). For each filter type,
there is a schema to contain the attributes needed by the
filter type (e.g. package_filter_rules). This is to avoid having
a lot of nil attributes that may not apply to filter type.

E.g.

Filter -> PackageFilter has_many PackageFilterRules
Filter -> ErratumFilter has_many ErratumFilterRules

The API is generic for all filter types. This is enabled by the
user providing both filter and rule id, when needed.

E.g.

GET /filters/:filter_id/rules => list the rules for a filter
POST /filters/:filter_id/rules => create a new rule for a filter
GET /filter/:filter_id/rules/:id => get a rule associated with the filter
...

  • added
  • modified
  • copied
  • renamed
  • deleted