feat: add API endpoints for creating inspections from templates and sharing documents

This commit is contained in:
2026-05-18 14:43:11 +04:00
parent 5570527e69
commit 2d6e3c5734
3 changed files with 583 additions and 0 deletions
+241
View File
@@ -368,6 +368,9 @@
},
{
"name": "Document print / download"
},
{
"name": "Document share"
}
],
"paths": {
@@ -18229,6 +18232,169 @@
}
}
},
"/api/inspections/from-template": {
"post": {
"tags": [
"Inspections"
],
"summary": "Create inspection from a template (DVI flow).",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"template_id": {
"type": "integer"
},
"title": {
"type": "string"
},
"customer_id": {
"type": "integer"
},
"vehicle_id": {
"type": "integer"
},
"department_id": {
"type": "integer"
},
"employee_id": {
"type": "integer"
},
"order_number": {
"type": "string"
},
"date": {
"type": "string"
},
"time": {
"type": "string"
},
"odometer": {
"type": "integer"
},
"note": {
"type": "string"
},
"inspection_category_id": {
"type": "integer"
}
}
},
"example": {
"template_id": 1,
"title": "Pre-Service Inspection",
"customer_id": 1,
"vehicle_id": 1,
"department_id": 1,
"employee_id": 1,
"order_number": "INSP-001",
"date": "2026-03-31",
"time": "09:00:00",
"odometer": 12500,
"note": "Initial walk-around notes.",
"inspection_category_id": 1
}
}
}
},
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"title": {
"type": "string"
},
"customer_id": {
"type": "integer"
},
"vehicle_id": {
"type": "integer"
},
"department_id": {
"type": "integer"
},
"employee_id": {
"type": "integer"
},
"order_number": {
"type": "string"
},
"date": {
"type": "string"
},
"time": {
"type": "string"
},
"odometer": {
"type": "integer"
},
"note": {
"type": "string"
},
"inspection_category_id": {
"type": "integer"
},
"template_id": {
"type": "integer"
},
"status": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"updated_at": {
"type": "string",
"format": "date-time"
}
}
}
}
},
"example": {
"message": "Inspection created successfully",
"data": {
"id": 1,
"title": "Pre-Service Inspection",
"customer_id": 1,
"vehicle_id": 1,
"department_id": 1,
"employee_id": 1,
"order_number": "INSP-001",
"date": "2026-03-31",
"time": "09:00:00",
"odometer": 12500,
"note": "Initial walk-around notes.",
"inspection_category_id": 1,
"template_id": 1,
"status": "in_progress",
"created_at": "2026-03-31T10:00:00.000000Z",
"updated_at": "2026-03-31T10:00:00.000000Z"
}
}
}
}
}
}
}
},
"/api/inspections/{id}": {
"put": {
"tags": [
@@ -56330,6 +56496,81 @@
}
}
}
},
"/api/documents/share": {
"post": {
"tags": [
"Document share"
],
"summary": "POST /api/documents/share",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"document_type": {
"type": "string"
},
"document_id": {
"type": "integer"
},
"channel": {
"type": "string"
},
"email": {
"type": "string"
},
"phone": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"example": {
"document_type": "invoice",
"document_id": 1,
"channel": "email",
"email": "customer@example.com",
"phone": "+971500000000",
"message": "Please find your document."
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"share_url": {
"type": "string"
},
"whatsapp_url": {
"type": "string"
},
"expires_at": {
"type": "string",
"format": "date-time"
}
}
},
"example": {
"share_url": "https://example.com/share/abc",
"whatsapp_url": "https://wa.me/971500000000?text=...",
"expires_at": "2026-05-19T12:00:00+00:00"
}
}
}
}
}
}
}
}
}