ODNZSL / nzsl-online

New Zealand Sign Language Dictionary
GNU General Public License v3.0
40 stars 11 forks source link

NZSL-51: Refactor Freelex code into a module, add bridge class to resolve correct class #1476

Closed joshmcarthur closed 1 year ago

joshmcarthur commented 1 year ago

This pull request is the first step on NZSL-51, moving code that relies on data from Freelex into a module. This includes the signs controller and related services (primarily related to search).

This PR also adds a model named SignModel, with a class method to resolve the correct model class. This class is used outside the Freelex module namespace to resolve the correct model class to use - e.g. when querying for random signs, sign of the day, or for looking up signs by ID. At the moment, this class always returns Freelex::Sign. The next PR will start adding support for Signbank::Sign.

The objective of this change is to enable support for feature flagging the source for dictionary data. This allows us to switch between Freelex and Signbank while testing, to ensure data equivalency and to be able to test dictionary export changes. This change is going to stay in place until at least February, at which point we'll be able to remove the Freelex-based code, and replace SignModel.resolve with direct calls to Signbank::Sign.

Br3nda commented 1 year ago

This is so much better than the Sign model code. Great change.