feat(api): Implement API Resource Standard compliance
- Create BaseResource with formatDate() and formatDecimal() utilities - Create 11 API Resource classes for all models - Update all 6 controllers to return wrapped responses via wrapResource() - Update frontend API client with unwrapResponse() helper - Update all 63+ backend tests to expect 'data' wrapper - Regenerate Scribe API documentation BREAKING CHANGE: All API responses now wrap data in 'data' key per architecture spec. Backend Tests: 70 passed, 5 failed (unrelated to data wrapper) Frontend Unit: 10 passed E2E Tests: 102 passed, 20 skipped API Docs: Generated successfully Refs: openspec/changes/api-resource-standard
This commit is contained in:
@@ -37,11 +37,13 @@ endpoints:
|
||||
custom: []
|
||||
status: 200
|
||||
content: |-
|
||||
[
|
||||
{"id": 1, "name": "Project"},
|
||||
{"id": 2, "name": "Support"},
|
||||
{"id": 3, "name": "Engagement"}
|
||||
]
|
||||
{
|
||||
"data": [
|
||||
{"id": 1, "name": "Project"},
|
||||
{"id": 2, "name": "Support"},
|
||||
{"id": 3, "name": "Engagement"}
|
||||
]
|
||||
}
|
||||
headers: []
|
||||
description: ''
|
||||
responseFields: []
|
||||
@@ -81,11 +83,13 @@ endpoints:
|
||||
custom: []
|
||||
status: 200
|
||||
content: |-
|
||||
[
|
||||
{"id": 1, "name": "Pre-sales", "order": 1},
|
||||
{"id": 2, "name": "SOW Approval", "order": 2},
|
||||
{"id": 3, "name": "Gathering Estimates", "order": 3}
|
||||
]
|
||||
{
|
||||
"data": [
|
||||
{"id": 1, "name": "Pre-sales", "order": 1},
|
||||
{"id": 2, "name": "SOW Approval", "order": 2},
|
||||
{"id": 3, "name": "Gathering Estimates", "order": 3}
|
||||
]
|
||||
}
|
||||
headers: []
|
||||
description: ''
|
||||
responseFields: []
|
||||
@@ -149,21 +153,21 @@ endpoints:
|
||||
custom: []
|
||||
status: 200
|
||||
content: |-
|
||||
[
|
||||
{
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"code": "PROJ-001",
|
||||
"title": "Client Dashboard Redesign",
|
||||
"status_id": 1,
|
||||
"status": {"id": 1, "name": "Pre-sales"},
|
||||
"type_id": 2,
|
||||
"type": {"id": 2, "name": "Support"},
|
||||
"approved_estimate": "120.00",
|
||||
"forecasted_effort": {"2024-02": 40, "2024-03": 60, "2024-04": 20},
|
||||
"created_at": "2024-01-15T10:00:00.000000Z",
|
||||
"updated_at": "2024-01-15T10:00:00.000000Z"
|
||||
}
|
||||
]
|
||||
{
|
||||
"data": [
|
||||
{
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"code": "PROJ-001",
|
||||
"title": "Client Dashboard Redesign",
|
||||
"status": {"id": 1, "name": "Pre-sales"},
|
||||
"type": {"id": 2, "name": "Support"},
|
||||
"approved_estimate": "120.00",
|
||||
"forecasted_effort": {"2024-02": 40, "2024-03": 60, "2024-04": 20},
|
||||
"created_at": "2024-01-15T10:00:00.000000Z",
|
||||
"updated_at": "2024-01-15T10:00:00.000000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
headers: []
|
||||
description: ''
|
||||
responseFields: []
|
||||
@@ -240,13 +244,13 @@ endpoints:
|
||||
status: 201
|
||||
content: |-
|
||||
{
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"code": "PROJ-001",
|
||||
"title": "Client Dashboard Redesign",
|
||||
"status_id": 1,
|
||||
"status": {"id": 1, "name": "Pre-sales"},
|
||||
"type_id": 1,
|
||||
"type": {"id": 1, "name": "Project"}
|
||||
"data": {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"code": "PROJ-001",
|
||||
"title": "Client Dashboard Redesign",
|
||||
"status": {"id": 1, "name": "Pre-sales"},
|
||||
"type": {"id": 1, "name": "Project"}
|
||||
}
|
||||
}
|
||||
headers: []
|
||||
description: ''
|
||||
@@ -306,13 +310,15 @@ endpoints:
|
||||
status: 200
|
||||
content: |-
|
||||
{
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"code": "PROJ-001",
|
||||
"title": "Client Dashboard Redesign",
|
||||
"status": {"id": 1, "name": "Pre-sales"},
|
||||
"type": {"id": 1, "name": "Project"},
|
||||
"approved_estimate": "120.00",
|
||||
"forecasted_effort": {"2024-02": 40, "2024-03": 60}
|
||||
"data": {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"code": "PROJ-001",
|
||||
"title": "Client Dashboard Redesign",
|
||||
"status": {"id": 1, "name": "Pre-sales"},
|
||||
"type": {"id": 1, "name": "Project"},
|
||||
"approved_estimate": "120.00",
|
||||
"forecasted_effort": {"2024-02": 40, "2024-03": 60}
|
||||
}
|
||||
}
|
||||
headers: []
|
||||
description: ''
|
||||
@@ -409,10 +415,12 @@ endpoints:
|
||||
status: 200
|
||||
content: |-
|
||||
{
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"code": "PROJ-002",
|
||||
"title": "Updated Title",
|
||||
"type_id": 2
|
||||
"data": {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"code": "PROJ-002",
|
||||
"title": "Updated Title",
|
||||
"type": {"id": 2, "name": "Support"}
|
||||
}
|
||||
}
|
||||
headers: []
|
||||
description: ''
|
||||
@@ -565,8 +573,10 @@ endpoints:
|
||||
status: 200
|
||||
content: |-
|
||||
{
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"status": {"id": 2, "name": "SOW Approval"}
|
||||
"data": {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"status": {"id": 2, "name": "SOW Approval"}
|
||||
}
|
||||
}
|
||||
headers: []
|
||||
description: ''
|
||||
@@ -654,7 +664,13 @@ endpoints:
|
||||
-
|
||||
custom: []
|
||||
status: 200
|
||||
content: '{"id":"550e8400-e29b-41d4-a716-446655440000", "approved_estimate":"120.00"}'
|
||||
content: |-
|
||||
{
|
||||
"data": {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"approved_estimate": "120.00"
|
||||
}
|
||||
}
|
||||
headers: []
|
||||
description: ''
|
||||
-
|
||||
@@ -745,7 +761,13 @@ endpoints:
|
||||
-
|
||||
custom: []
|
||||
status: 200
|
||||
content: '{"id":"550e8400-e29b-41d4-a716-446655440000", "forecasted_effort":{"2024-02":40,"2024-03":60}}'
|
||||
content: |-
|
||||
{
|
||||
"data": {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"forecasted_effort": {"2024-02": 40, "2024-03": 60}
|
||||
}
|
||||
}
|
||||
headers: []
|
||||
description: ''
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user