This service is designed to facilitate the scheduling of coaching sessions, addressing a core need in the coaching industry for efficient and conflict-free session management. It allows coaches and their clients to book sessions seamlessly, ensuring that there are no overlaps in the coach's schedule.
- Session Scheduling: Clients can schedule sessions with coaches, specifying the coach, client, start time, and duration of the session.
- Conflict Avoidance: The service automatically checks for any scheduling conflicts. If a proposed session time overlaps with an existing session for the same coach, it will not be booked.
- Robust Validation: All session requests are validated for completeness and integrity of information, ensuring that all necessary data is provided and formatted correctly.
- HTTP Status Codes: The service responds with appropriate HTTP status codes. A 201 Created status is returned for successful session creation, and a 422 Unprocessable Entity status is returned in cases of invalid requests.
- Framework: Ruby on Rails 3.0.6
- Database: SQLite
- Testing: RSpec for unit and controller testing
coach_hash_id (String): Unique identifier for the coach. client_hash_id (String): Unique identifier for the client. start (DateTime): The start time of the session. duration (Integer): Duration of the session in minutes.
CoachingSessionsController handles the session creation request:
Uses before_action to validate session parameters. Renders JSON responses with appropriate HTTP status codes based on request validity.
Custom validation in the CoachingSession model checks for overlapping session times, ensuring that each coach can only have one session at any given time slot.
- Install Dependencies: Ensure Ruby and Rails 3.0.6 are installed.
- Database Setup: Run rake db:migrate to set up the SQLite database.
- Testing: Run bundle exec rspec to execute the test suite.
To create a new coaching session, send a POST request with the required parameters (coach_hash_id, client_hash_id, start, duration) to the endpoint designated for session creation.