feat(api): adaptar cliente al contrato v1.1
- feature_types: nueva tabla local + tipo FeatureType + upsert en applyBundle + getFeatureTypes(); FeatureDetail muestra badge del tipo con su color. - feature: columnas feature_type_id + is_active (migración BD v3); feature.update acepta ambas; toggle "Activa" en el detalle con badge "inactiva" cuando corresponde. - templates: ahora catálogo global asignado por pivot — getTemplates() ya no filtra por project_id (informativo); phase_id eliminado del tipo y del pick. - Formulario de inspección: soporta fields[].group (secciones), question (etiqueta principal), help (texto de ayuda) y required (validación al guardar con aviso de campos faltantes). - Bundle: tipa issue_tasks correctamente como IssueTask[]. - docs/: sincronizados openapi.yaml y MOBILE_APP_BRIEF.md v1.1 del backend. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+59
-6
@@ -1,11 +1,37 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
title: ConstruProgress Mobile API
|
||||
version: "1.0.0"
|
||||
version: "1.1.0"
|
||||
description: >
|
||||
Offline-first sync API for the mobile app. Auth via Laravel Sanctum bearer
|
||||
tokens (ability `mobile-sync`). All protected endpoints require
|
||||
`Authorization: Bearer <token>`. See docs/MOBILE_SYNC_PROTOCOL.md.
|
||||
|
||||
|
||||
## Changelog (from v1.0)
|
||||
|
||||
|
||||
- Inspection templates are now **global** and assigned to projects via
|
||||
pivot. `bundle.templates` and `/templates` return templates *assigned* to
|
||||
the accessible projects (no longer filtered by `project_id`).
|
||||
`template.phase_id` was **removed**. `project_id` remains in the schema
|
||||
for compatibility but no longer determines visibility.
|
||||
|
||||
- Template `fields[]` items may include `group` (section), `question` (short
|
||||
prompt shown at inspection time) and `help` (long help text).
|
||||
|
||||
- New entities in the bundle: `feature_types` (global catalogue),
|
||||
`issue_tasks`, `issue_comments`.
|
||||
|
||||
- `feature` gains `feature_type_id`, `is_active`; `issue` gains `type`.
|
||||
|
||||
- New `/sync` ops: `issue.update`, `issue_task.create`, `issue_task.update`,
|
||||
`issue_comment.create`. `feature.update` accepts `is_active` and
|
||||
`feature_type_id`; `issue.create`/`update` accept `type`.
|
||||
|
||||
- `POST /media` `parent_entity` also accepts `issue_task` and `issue_comment`.
|
||||
|
||||
- `deleted` tombstones include `issue_tasks` and `issue_comments`.
|
||||
servers:
|
||||
- url: /api/v1
|
||||
security:
|
||||
@@ -85,7 +111,12 @@ paths:
|
||||
"403": { description: Not a member of the project }
|
||||
/templates:
|
||||
get:
|
||||
summary: Inspection templates for accessible projects (with version/hash)
|
||||
summary: Global inspection templates ASSIGNED to any accessible project (via pivot)
|
||||
description: >
|
||||
Templates are a global catalogue. This endpoint returns the templates
|
||||
that have been *assigned* (via `inspection_template_project` pivot) to
|
||||
any of the user's accessible projects. Each item includes `version`
|
||||
(updated_at timestamp) and `hash` for change detection.
|
||||
parameters:
|
||||
- name: since
|
||||
in: query
|
||||
@@ -183,11 +214,33 @@ components:
|
||||
phases: { type: array, items: { type: object } }
|
||||
layers: { type: array, items: { type: object } }
|
||||
features: { type: array, items: { type: object } }
|
||||
feature_types:
|
||||
type: array
|
||||
description: Global catalogue of feature types (id, name, color)
|
||||
items: { type: object }
|
||||
inspections: { type: array, items: { type: object } }
|
||||
issues: { type: array, items: { type: object } }
|
||||
issue_tasks: { type: array, items: { type: object } }
|
||||
issue_comments: { type: array, items: { type: object } }
|
||||
templates: { type: array, items: { type: object } }
|
||||
issues:
|
||||
type: array
|
||||
description: >
|
||||
Includes `type` (defect|safety|quality|documentation|other),
|
||||
`status` (open|in_review|resolved|closed),
|
||||
`priority` (low|medium|high|critical).
|
||||
items: { type: object }
|
||||
issue_tasks:
|
||||
type: array
|
||||
description: Checklist tasks per issue.
|
||||
items: { type: object }
|
||||
issue_comments:
|
||||
type: array
|
||||
description: Comment thread per issue.
|
||||
items: { type: object }
|
||||
templates:
|
||||
type: array
|
||||
description: >
|
||||
Templates assigned to this project via pivot (no longer filtered by
|
||||
project_id). Each item exposes version/hash for change detection and
|
||||
`fields[]` where each field may include `group`, `question`, `help`.
|
||||
items: { type: object }
|
||||
media: { type: array, items: { type: object } }
|
||||
deleted:
|
||||
type: object
|
||||
|
||||
Reference in New Issue
Block a user