Skip to content

Commit

Permalink
Refactored member controller to use model layer
Browse files Browse the repository at this point in the history
refs TryGhost/Members#105

- As members module has become a core part it makes sense to follow the same principles as in all other controllers and use the model directly instead of calling external services.
- Bumped @tryghost/members-api to 0.11.1 . New stripe-specific methods used in controllers are available starting with this version
- Exposing these new methods is a little hacky because there are no relationships setup on members_* tables. Left notes for future improvements once relations are introduced.
- We don't allow for chaging member's emails at the moment. For this reason had to modify JSON schema a little. It doesn't support OO inheritence: "This shortcoming is perhaps one of the biggest surprises of the combining operations in JSON schema: it does not behave like inheritance in an object-oriented language. " (ref. https://json-schema.org/understanding-json-schema/reference/combining.html#allof)
  • Loading branch information
naz committed Jan 15, 2020
1 parent 994056e commit 9925607
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion packages/admin-api-schema-historic/canary/members-edit.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,40 @@
"maxItems": 1,
"items": {
"type": "object",
"allOf": [{"$ref": "members#/definitions/member"}]
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"maxLength": 191,
"pattern": "^([^,]|$)"
},
"note": {
"type": "string",
"minLength": 0,
"maxLength": 2000
},
"subscribed": {
"type": "boolean"
},
"id": {
"strip": true
},
"email": {
"strip": true
},
"created_at": {
"strip": true
},
"created_by": {
"strip": true
},
"updated_at": {
"strip": true
},
"updated_by": {
"strip": true
}
}
}
}
},
Expand Down

0 comments on commit 9925607

Please sign in to comment.