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
+159
View File
@@ -11624,6 +11624,84 @@
}
]
},
{
"name": "Create inspection from a template (DVI flow).",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"template_id\": 1,\n \"title\": \"Pre-Service Inspection\",\n \"customer_id\": 1,\n \"vehicle_id\": 1,\n \"department_id\": 1,\n \"employee_id\": 1,\n \"order_number\": \"INSP-001\",\n \"date\": \"2026-03-31\",\n \"time\": \"09:00:00\",\n \"odometer\": 12500,\n \"note\": \"Initial walk-around notes.\",\n \"inspection_category_id\": 1\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base_url}}/api/inspections/from-template",
"host": [
"{{base_url}}"
],
"path": [
"api",
"inspections",
"from-template"
]
},
"description": "Required: template_id, title, customer_id, vehicle_id, department_id, employee_id, order_number, date, time (H:i:s). Optional: odometer, note, inspection_category_id. Available only when inspections.use_dvi_flow is enabled."
},
"response": [
{
"name": "201 Created",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{base_url}}/api/inspections/from-template",
"host": [
"{{base_url}}"
],
"path": [
"api",
"inspections",
"from-template"
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"message\": \"Inspection created successfully\",\n \"data\": {\n \"id\": 1,\n \"title\": \"Pre-Service Inspection\",\n \"customer_id\": 1,\n \"vehicle_id\": 1,\n \"department_id\": 1,\n \"employee_id\": 1,\n \"order_number\": \"INSP-001\",\n \"date\": \"2026-03-31\",\n \"time\": \"09:00:00\",\n \"odometer\": 12500,\n \"note\": \"Initial walk-around notes.\",\n \"inspection_category_id\": 1,\n \"template_id\": 1,\n \"status\": \"in_progress\",\n \"created_at\": \"2026-03-31T10:00:00.000000Z\",\n \"updated_at\": \"2026-03-31T10:00:00.000000Z\"\n }\n}"
}
]
},
{
"name": "Update the specified inspection.",
"request": {
@@ -43839,6 +43917,87 @@
}
],
"description": "Unified PDF endpoint. Query/body: type = inspection | estimate | job_card | invoice | payment_received | expense | purchase_order | bill | payment_made; id = record id; mode = print (inline) | download (attachment)."
},
{
"name": "Document share",
"item": [
{
"name": "POST /api/documents/share",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{auth_token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"document_type\": \"invoice\",\n \"document_id\": 1,\n \"channel\": \"email\",\n \"email\": \"customer@example.com\",\n \"phone\": \"+971500000000\",\n \"message\": \"Please find your document.\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base_url}}/api/documents/share",
"host": [
"{{base_url}}"
],
"path": [
"api",
"documents",
"share"
]
}
},
"response": [
{
"name": "200 OK",
"originalRequest": {
"method": "POST",
"header": [],
"url": {
"raw": "{{base_url}}/api/documents/share",
"host": [
"{{base_url}}"
],
"path": [
"api",
"documents",
"share"
]
}
},
"status": "OK",
"code": 200,
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": "{\n \"share_url\": \"https://example.com/share/abc\",\n \"whatsapp_url\": \"https://wa.me/971500000000?text=...\",\n \"expires_at\": \"2026-05-19T12:00:00+00:00\"\n}"
}
]
}
],
"description": "Generates a tokenized share URL (and WhatsApp link) for a document; optionally emails it. Body: document_type, document_id, channel (email|link), email (required if channel=email), phone, message."
}
],
"auth": {