I have a growing list of general purpose re-usable validation checks, similar to this list below:
1. check_product_name()
2. check_product_price_within_range()
3. check_product_expiration_date()
4. check_product_sizes()
5. check_foo()
6. check_bar()
7. ...
I also have a growing list of clients. Client A may want to implement validations 1-5, while Client B may want to implement validations 3, 6, and 4 (in that order).
Right now I'm considering a simple approach like below. (Pseudo-code, the actual configuration will be stored within a database)
client_a_validations = ['check_product_name', 'check_product_price_within_range', 'check_product_expiration_date', 'check_product_sizes', 'check_foo']
client_b_validations = ['check_product_expiration_date', 'check_foo', 'check_product_sizes']
My question is, is there a better more established pattern I could be referencing to solve this problem?
Aucun commentaire:
Enregistrer un commentaire