CoachPortal

Database Structure

Data Model & Database Structure

Based on our platform selection of Bubble.io, we've defined the database structure for the CoachPortal application. The structure includes User and Appointment models with all required fields and relationships to support the coach appointment management functionality.

Data Model

User

  • name: text
  • email: email
  • role: text ("coach", "admin")

Appointment

  • coach: User (reference)
  • client_name: text
  • date: date
  • time: time
  • duration: number (minutes)
  • notes: text

Relationship:

One-to-Many: One User (Coach) can have multiple Appointments

Database Implementation

In Bubble.io, we'll implement the data model using the platform's built-in database system. Below is the configuration for each data type in the Bubble.io database:

User Data Type

Field NameTypeDescription
nameTextFull name of the user
emailEmailEmail address (used for login)
roleTextEither "coach" or "admin"
passwordPasswordAutomatically handled by Bubble's authentication

Note: The User data type will be configured to use Bubble.io's built-in authentication system.

Appointment Data Type

Field NameTypeDescription
coachUser (reference)Reference to the coach user
client_nameTextName of the client
dateDateDate of the appointment
timeTimeStart time of the appointment
durationNumberDuration in minutes
notesTextAdditional notes about the appointment
created_dateDate/TimeAutomatically set when record is created

Implementation Notes

  • In Bubble.io, references between data types are automatically managed.
  • We'll utilize Bubble's built-in privacy rules to ensure coaches only see their own appointments.
  • Date and time fields can be combined in the UI while maintaining separate database fields for flexibility.
  • Additional helper fields (like calendar_datetime) may be added for easier calendar integration.

Security & Privacy Rules

Proper security rules are essential to ensure data privacy and access control within the CoachPortal application. Below are the security rules we'll implement in Bubble.io to protect user data and enforce the requirement that coaches can only see their own appointments.

User Data Privacy Rules

ActionAdminCoachNot Logged In
CreateYesNoNo (except for signup)
ReadAll usersOnly selfNo
UpdateAll usersOnly self (limited fields)No
DeleteAll usersNoNo

Appointment Data Privacy Rules

ActionAdminCoachNot Logged In
CreateYes (for any coach)Yes (only with self as coach)No
ReadAll appointmentsOnly when coach = current userNo
UpdateAll appointmentsOnly when coach = current userNo
DeleteAll appointmentsOnly when coach = current userNo

Implementation in Bubble.io

In Bubble.io, these privacy rules will be implemented using the platform's built-in privacy rules editor:

  1. For the User data type, we'll set up rules to restrict visibility and modification.
  2. For the Appointment data type, we'll create a "only when coach = current user" condition for coach access.
  3. Admin users will have unrestricted access configured through role-based permissions.
  4. We'll implement additional validation in workflows to ensure coaches can only create appointments for themselves.

© 2023 CoachPortal. All rights reserved.