API Surface
The Facilities Service exposes both REST and GraphQL APIs for managing facility resources.
Base URLs
| Environment | URL |
|---|---|
| Production | https://facilities-api.digiwedge.com/api |
| UAT | https://facilities-api.uat.digiwedge.com/api |
| Local | http://localhost:3106/api |
Authentication
All endpoints require JWT authentication:
curl -H "Authorization: Bearer <token>" \
https://facilities-api.uat.digiwedge.com/api/facility-resources?tenantId=1
REST Endpoints
Facility Resources
| Method | Endpoint | Description |
|---|---|---|
GET | /facility-resources | List resources (paginated, filtered) |
GET | /facility-resources/:id | Get single resource |
POST | /facility-resources | Create resource |
PUT | /facility-resources/:id | Update resource |
DELETE | /facility-resources/:id | Soft delete resource |
Maintenance Logs
| Method | Endpoint | Description |
|---|---|---|
GET | /maintenance-logs | List maintenance logs |
GET | /maintenance-logs/:id | Get single log |
POST | /maintenance-logs | Create log |
PUT | /maintenance-logs/:id | Update log |
DELETE | /maintenance-logs/:id | Delete log |
Resource Usage
| Method | Endpoint | Description |
|---|---|---|
GET | /resource-usage | List usage records |
GET | /resource-usage/:id | Get single record |
POST | /resource-usage | Create usage record |
PUT | /resource-usage/:id | Update record |
DELETE | /resource-usage/:id | Delete record |
Facility Reservations
| Method | Endpoint | Description |
|---|---|---|
GET | /facility-reservations | List reservations |
GET | /facility-reservations/:id | Get reservation by ID |
POST | /facility-reservations | Create reservation |
POST | /facility-reservations/:id/reschedule | Reschedule reservation |
POST | /facility-reservations/:id/cancel | Cancel reservation |
POST | /facility-reservations/:id/no-show | Mark reservation no-show |
Reservation Series
| Method | Endpoint | Description |
|---|---|---|
GET | /facility-reservations/series | List reservation series |
GET | /facility-reservations/series/:id | Get series by ID |
POST | /facility-reservations/series | Create series |
PUT | /facility-reservations/series/:id | Update series |
POST | /facility-reservations/series/:id/cancel | Cancel series |
POST | /facility-reservations/series/:id/pause | Pause series |
POST | /facility-reservations/series/:id/resume | Resume series |
Availability
| Method | Endpoint | Description |
|---|---|---|
POST | /facility-resources/availability | Check availability for time window |
Query Parameters
Common Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tenantId | number | Yes | Tenant scope |
clubId | number | No | Club scope |
Pagination & Filtering
| Parameter | Type | Default | Description |
|---|---|---|---|
skip | number | 0 | Offset for pagination |
take | number | 25 | Limit (max 100) |
type | ResourceType | - | Filter by resource type |
search | string | - | Case-insensitive name search |
includeInactive | boolean | false | Include soft-deleted records |
Example Requests
List Resources
GET /facility-resources?tenantId=1&type=DRIVING_RANGE&take=10
Response:
[
{
"id": 1,
"tenantId": 1,
"clubId": 10,
"name": "Range A",
"type": "DRIVING_RANGE",
"active": true,
"maintenanceRequired": false
}
]
Create Maintenance Log
POST /maintenance-logs?tenantId=1&clubId=10
Content-Type: application/json
{
"resourceId": 1,
"maintenanceType": "GREENS",
"description": "Aeration and top dressing",
"startTime": "2025-01-02T06:00:00Z",
"endTime": "2025-01-02T14:00:00Z"
}
Check Availability
POST /facility-resources/availability
Content-Type: application/json
{
"tenantId": 1,
"clubId": 10,
"type": "SIMULATOR",
"start": "2025-01-02T10:00:00Z",
"end": "2025-01-02T12:00:00Z"
}
Response:
[
{
"resourceId": 5,
"name": "Simulator Bay 1",
"type": "SIMULATOR",
"available": true
},
{
"resourceId": 6,
"name": "Simulator Bay 2",
"type": "SIMULATOR",
"available": true
}
]
Error Responses
| Status | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Missing or invalid JWT |
| 404 | Not Found - Resource doesn't exist in scope |
| 500 | Internal Server Error |
{
"statusCode": 404,
"message": "Facility resource not found for tenant/club scope",
"error": "Not Found"
}