BIG: Contact overhaul
This one's a doozy.
This PR substantially overhauls several portions of the API to improve stability and clean up technical debt.
A snapshot of notable changes:
Contact migration
- Replace overgrown Member model and API with Contact model and API
- Support for multiple email addresses, with an editable primary email address
- Move from "First Name" "Last Name" columns to "Full Name" "Display Name" to improve cultural accommodation of different naming schemes
- Methods of contact (email addresses, phone numbers, postal addresses) now include fine-grained consent tracking which is opt-in by default.
Tags and Custom Fields
- Overhaul the Tag API to accommodate future implementation of CustomField groups
- Introduce CustomFields to enable non-technical users to define new data types
Imports
- ReviewableEvents are replaced with ImportEvents, which are unified with the new Contact model
- ImportEvent inference is overhauled to provide a pluggable interface for integrations that may have better insight on how to match contacts than the default implementation
- Overhaul the API to meet new standards for usage, validation, pagination.
Permissions and roles
- Separate the concept of a "person" from the concept of a "portal user" with two models: Contact and User
- Introduce the concept of a SecurityPrincipal (onto which roles and permissions are applied) to allow for future automation that isn't necessarily associated with a user
- Fine-grained permissions and role-based authentication with those permissions
Misc
- Introduce storing settings in the database, to allow for feature flags and user-editable settings without server access
- Consistent pagination support in lists (inspired by Stripe pagination)
- Prefixed unique IDs (e.g. Contact ids are
ct_xxxxxxxxxxxxxxxxx
) for new datatypes to improve debuggability and distinguish identifiers (inspired by Stripe and GitHub IDs) - Request and response validation with Pydantic models
See svdsa/home#42 for more details.
Edited by Derrick Liu