curl --request DELETE \
--url https://api.example.com/api/time-blocks/:id{
"message": "<string>"
}curl --request DELETE \
--url https://api.example.com/api/time-blocks/:id{
"message": "<string>"
}Authorization: Bearer <token>
doctor - Can delete their own time blocks onlyadmin - Can delete any time block42"TimeBlock deleted successfully"{
"error": "Unauthorized"
}
{
"error": "Access denied"
}
{
"error": "TimeBlock not found"
}
{
"error": "Cannot delete time block with existing appointment"
}
curl -X DELETE https://api.example.com/api/time-blocks/42 \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"message": "TimeBlock deleted successfully"
}
onDelete: Restrict constraint on appointments - time blocks with booked appointments cannot be deletedAppointment model has a foreign key constraint on timeBlockId with onDelete: Restrict. This means: