Ghost/core/server/models
Fabien 'egg' O'Carroll 8f660c3259
Improved settings validation (#12048)
closes #12001

* Moved settings validation to the model

This moves the settings validation out of the validation file and into
the model, as it is _only_ used there.

It also sets us up in the future for custom validators on individual
settings.

* Improved validation of stripe_plans setting

- Checks `interval` is a valid string
- Checks `name` & `currency` are strings

* Moved stripe key validation into model

The stripe key settings are all nullable and the regex validation fails
when the input is `null`. Rather than reworking the entirety of how we
validate with default-settings validation objects, this moves the
validation into methods on the Settings model.

* Added tests for new setting validations

Adds tests for both valid and invalid settings, as well as helpers
making future tests easier and less repetitive
2020-07-15 17:11:27 +02:00
..
base Updated Content API resource ordering to be same as slugs in filter 2020-07-10 18:33:00 +12:00
plugins Added ?paid query parameter to Admin API members browse endpoint (#11892) 2020-06-12 12:12:10 +01:00
relations Refactored common lib import to use destructuring (#11835) 2020-05-22 19:22:20 +01:00
action.js Added model implementation for actions 2019-02-06 21:36:09 +01:00
api-key.js Moved core/server/lib/common/logging to core/shared/logging (#11857) 2020-05-28 19:30:23 +01:00
author.js Added plugin based author and public tag models in API v2 (#10284) 2019-01-03 20:30:35 +01:00
email.js Added default stats object to email model 2019-11-08 17:11:54 +07:00
index.js Updated var declarations to const/let and no lists 2020-04-29 16:51:13 +01:00
integration.js Ensured Admin API cannot fetch internal integrations (#10501) 2019-07-24 11:52:55 +02:00
invite.js Refactored common lib import to use destructuring (#11835) 2020-05-22 19:22:20 +01:00
label.js Refactored common lib import to use destructuring (#11835) 2020-05-22 19:22:20 +01:00
member-stripe-customer.js Added upsert method to stripe models 2019-10-09 16:24:51 +07:00
member.js 🐛 Fixed searching for free/paid members 2020-07-06 09:09:08 +01:00
mobiledoc-revision.js Added mobiledoc revisions functionality 2018-10-09 15:31:09 +02:00
permission.js Updated var declarations to const/let and no lists 2020-04-29 16:51:13 +01:00
post.js 🐛 Fixed cache invalidation for published posts with no content 2020-07-15 17:41:24 +12:00
posts-meta.js Moved core/server/lib/url-utils to core/shared/url-utils (#11856) 2020-05-28 11:57:02 +01:00
role.js Refactored common lib import to use destructuring (#11835) 2020-05-22 19:22:20 +01:00
session.js Removed user_id constraint when upserting session (#10085) 2018-10-30 16:15:48 +07:00
settings.js Improved settings validation (#12048) 2020-07-15 17:11:27 +02:00
stripe-customer-subscription.js Prefixed stripe_customers_subscriptions with members 2019-10-09 16:24:51 +07:00
tag-public.js Added plugin based author and public tag models in API v2 (#10284) 2019-01-03 20:30:35 +01:00
tag.js Refactored common lib import to use destructuring (#11835) 2020-05-22 19:22:20 +01:00
user.js refactored 'lib/image' imports to use destructuring (#11847) 2020-05-26 19:11:23 +01:00
webhook.js Updated var declarations to const/let and no lists 2020-04-29 16:51:13 +01:00