Overview
TheCardPlan model stores customer submissions for pre-defined pricing card plans. It captures customer information and their selected plan tier (Budget, Business, or Professional).
Schema Definition
The CardPlan schema is defined using Mongoose and includes the following structure:Schema Fields
Customer’s full name
Customer’s email address for communication
Customer’s phone number
Type of website being requested (e.g., “E-commerce”, “Portfolio”, “Business”)
Selected pricing tier. Must be one of:
Budget- Entry-level planBusiness- Mid-tier planProfessional- Premium plan
Price of the selected plan in Rands
Customer’s budget for the project in Rands. A value of
0 indicates an uncapped or no budget constraint.Timestamp when the plan was submitted. Automatically set to current date/time if not provided
Example Document
Validators
Plan Type Enum Validation
TheplanType field uses Mongoose’s built-in enum validator to ensure only valid plan types are accepted:
Usage in API
The CardPlan model is primarily used in the/api/card-plan endpoint:
Creating a Card Plan
Request Example
Response Example
Model Location
Source file:/server/models/CardPlan.js
Related Endpoints
- POST /api/card-plan - Submit a card plan selection
Plan Types
Budget Plan
Entry-level plan suitable for basic websites with essential features.Business Plan
Mid-tier plan for growing businesses requiring additional functionality and customization.Professional Plan
Premium plan offering comprehensive features and advanced capabilities.Notes
- The model includes strict enum validation for
planTypeto prevent invalid plan selections - When a card plan is submitted, an email notification is automatically sent to the configured recipient
- All prices are stored in South African Rands (R)
- The
budgetfield defaults to0, which represents an uncapped budget - The model uses
createdAtinstead ofdatefor timestamp tracking - Unlike CustomPlan, this model does not use the
mongoose.models.CardPlancheck pattern