Files
unsupervised-scheduler/docs/features/availability-management.md
James Griffin 0fbafc9d18
Some checks failed
CI / Coding Standards (push) Failing after 2m31s
CI / PHPStan (push) Failing after 50s
CI / Tests (PHP 8.1) (push) Successful in 50s
CI / Tests (PHP 8.2) (push) Successful in 48s
CI / Tests (PHP 8.3) (push) Successful in 40s
CI / No Debug Code (push) Successful in 2s
Initial plugin scaffold: lesson scheduling WordPress plugin
- Custom DB tables for availability slots and lesson bookings
- Instructor (wp-admin) and student (front-end) roles with custom capabilities
- REST API under us-scheduler/v1 for availability CRUD and booking
- [us_booking] and [us_student_login] shortcodes for student front end
- PHPUnit + Brain\Monkey unit test suite (29 tests)
- Gitea Actions CI: lint, PHPStan, tests on PHP 8.1/8.2/8.3, no-debug check
- Feature docs under docs/features/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 12:44:46 -03:00

1.9 KiB

Feature: Availability Management

Overview

Instructors define date/time windows during which they are available for lessons. Students book from these windows.

Data Model — {prefix}us_availability

Column Type Notes
id BIGINT UNSIGNED Primary key
instructor_id BIGINT UNSIGNED WordPress user ID
start_dt DATETIME Slot start — stored as Y-m-d H:i:s
end_dt DATETIME Slot end — stored as Y-m-d H:i:s
is_booked TINYINT(1) 0 = available, 1 = booked
created_at DATETIME Insertion time

Admin Interface

Instructors access My Availability in wp-admin (?page=us-availability).

  • Add a slot: provide start and end datetime
  • Delete a slot: only allowed if is_booked = 0

REST API

Method Endpoint Permission
GET /wp-json/us-scheduler/v1/availability book_lesson
POST /wp-json/us-scheduler/v1/availability manage_availability
DELETE /wp-json/us-scheduler/v1/availability/{id} manage_availability + slot owner

GET supports query params: instructor_id, from (datetime), to (datetime).

Implementation

  • Repository: Unsupervised\Schedular\Data\AvailabilityRepository
  • Model: Unsupervised\Schedular\Model\AvailabilitySlot
  • Admin controller: Unsupervised\Schedular\Admin\AvailabilityController
  • REST endpoint: Unsupervised\Schedular\Api\AvailabilityEndpoint

Tests

  • tests/Unit/Data/AvailabilityRepositoryTest.php
  • tests/Unit/Model/AvailabilitySlotTest.php