159 lines
3.7 KiB
Markdown
159 lines
3.7 KiB
Markdown
# TekDek Employees API Documentation
|
|
|
|
## Base URL
|
|
|
|
```
|
|
https://your-domain.com/api
|
|
```
|
|
|
|
## Endpoints
|
|
|
|
### List All Employees
|
|
|
|
```
|
|
GET /api/employees
|
|
```
|
|
|
|
**Response: 200 OK**
|
|
|
|
```json
|
|
{
|
|
"success": true,
|
|
"data": [
|
|
{
|
|
"id": "550e8400-e29b-41d4-a716-446655440000",
|
|
"slug": "daedalus",
|
|
"name": "Daedalus",
|
|
"title": "Chief Architect",
|
|
"role": "Architecture & Systems Design",
|
|
"tagline": "The master builder who sees the whole labyrinth.",
|
|
"bio": "Daedalus is the architectural mind behind TekDek...",
|
|
"mythology": "Named for the mythological master craftsman...",
|
|
"avatar_url": null,
|
|
"accent_color": "#C4A24E",
|
|
"symbol": "labyrinth",
|
|
"skills": ["System Architecture", "Database Design", "API Specification", "Technical Planning", "Code Review"],
|
|
"quote": "A well-designed system is indistinguishable from inevitability.",
|
|
"sort_order": 1,
|
|
"created_at": "2025-07-27 00:00:00",
|
|
"updated_at": "2025-07-27 00:00:00"
|
|
}
|
|
],
|
|
"count": 3
|
|
}
|
|
```
|
|
|
|
### Get Employee by Slug
|
|
|
|
```
|
|
GET /api/employees/:slug
|
|
```
|
|
|
|
**Parameters:**
|
|
| Parameter | Type | Description |
|
|
|-----------|--------|--------------------------------------------|
|
|
| slug | string | URL-safe identifier (lowercase, a-z, 0-9, hyphens) |
|
|
|
|
**Response: 200 OK**
|
|
|
|
```json
|
|
{
|
|
"success": true,
|
|
"data": {
|
|
"id": "550e8400-e29b-41d4-a716-446655440001",
|
|
"slug": "talos",
|
|
"name": "Talos",
|
|
"title": "Lead Backend Engineer",
|
|
"role": "Backend Engineering & Implementation",
|
|
"tagline": "The bronze guardian who never stops running.",
|
|
"bio": "Talos is the engine room of TekDek...",
|
|
"mythology": "Named for the giant bronze automaton...",
|
|
"avatar_url": null,
|
|
"accent_color": "#7B8794",
|
|
"symbol": "gear",
|
|
"skills": ["PHP", "MySQL", "REST APIs", "Testing", "Performance Optimization", "Server Infrastructure"],
|
|
"quote": "If it compiles but can't survive production, it doesn't exist.",
|
|
"sort_order": 2,
|
|
"created_at": "2025-07-27 00:00:00",
|
|
"updated_at": "2025-07-27 00:00:00"
|
|
}
|
|
}
|
|
```
|
|
|
|
**Response: 404 Not Found**
|
|
|
|
```json
|
|
{
|
|
"success": false,
|
|
"error": "Employee 'unknown-slug' not found."
|
|
}
|
|
```
|
|
|
|
**Response: 400 Bad Request** (invalid slug format)
|
|
|
|
```json
|
|
{
|
|
"success": false,
|
|
"error": "Invalid slug format. Use lowercase letters, numbers, and hyphens (1-50 chars)."
|
|
}
|
|
```
|
|
|
|
## Error Responses
|
|
|
|
All errors follow the same structure:
|
|
|
|
```json
|
|
{
|
|
"success": false,
|
|
"error": "Description of what went wrong."
|
|
}
|
|
```
|
|
|
|
| Code | Meaning |
|
|
|------|----------------------|
|
|
| 200 | Success |
|
|
| 400 | Invalid input |
|
|
| 404 | Not found |
|
|
| 405 | Method not allowed |
|
|
| 500 | Server error |
|
|
|
|
## Headers
|
|
|
|
All responses include:
|
|
|
|
- `Content-Type: application/json; charset=utf-8`
|
|
- `Access-Control-Allow-Origin: *`
|
|
- `Cache-Control: public, max-age=300, s-maxage=600`
|
|
- `X-Content-Type-Options: nosniff`
|
|
|
|
## CORS
|
|
|
|
Full CORS support. Preflight `OPTIONS` requests return `204 No Content` with appropriate headers.
|
|
|
|
## Caching
|
|
|
|
Responses are cache-friendly with 5-minute browser cache and 10-minute CDN cache. Employee data changes infrequently.
|
|
|
|
## Setup
|
|
|
|
```bash
|
|
# Install dependencies
|
|
composer install
|
|
|
|
# Run migrations
|
|
mysql -u root -p tekdek < database/migrations/001_create_employees_table.sql
|
|
|
|
# Seed data
|
|
mysql -u root -p tekdek < database/seeds/001_seed_employees.sql
|
|
|
|
# Run tests
|
|
composer test
|
|
|
|
# Set environment variables
|
|
export DB_HOST=127.0.0.1
|
|
export DB_PORT=3306
|
|
export DB_NAME=tekdek
|
|
export DB_USER=root
|
|
export DB_PASS=yourpassword
|
|
```
|