add some features

This commit is contained in:
2026-04-22 21:37:07 +02:00
parent bdd06105dd
commit c10e259ae8
20 changed files with 2101 additions and 1030 deletions
+160
View File
@@ -7,6 +7,166 @@ import { validateParam } from '../middleware/validateParams.js';
const router = Router();
/**
* @openapi
* /api/v1/reports:
* get:
* summary: List reports
* tags:
* - Reports
* security:
* - bearerAuth: []
* - cookieAuth: []
* parameters:
* - name: status
* in: query
* required: false
* schema:
* type: string
* - name: templateCode
* in: query
* required: false
* schema:
* type: string
* - name: limit
* in: query
* required: false
* schema:
* type: integer
* default: 100
* maximum: 500
* - name: offset
* in: query
* required: false
* schema:
* type: integer
* default: 0
* responses:
* 200:
* description: List of reports
* post:
* summary: Submit report
* tags:
* - Reports
* security:
* - bearerAuth: []
* - cookieAuth: []
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required:
* - id
* - reportNumber
* - templateCode
* - templateVersion
* - answers
* properties:
* id:
* type: string
* reportNumber:
* type: string
* templateCode:
* type: string
* templateVersion:
* type: integer
* status:
* type: string
* answers:
* type: object
* responses:
* 201:
* description: Report submitted
* 400:
* description: Invalid input
* /api/v1/reports/{reportId}:
* get:
* summary: Get report details
* tags:
* - Reports
* security:
* - bearerAuth: []
* - cookieAuth: []
* parameters:
* - name: reportId
* in: path
* required: true
* schema:
* type: string
* pattern: '^[a-zA-Z0-9_-]{1,100}$'
* responses:
* 200:
* description: Report details
* 404:
* description: Report not found
* delete:
* summary: Delete report
* tags:
* - Reports
* security:
* - bearerAuth: []
* - cookieAuth: []
* parameters:
* - name: reportId
* in: path
* required: true
* schema:
* type: string
* pattern: '^[a-zA-Z0-9_-]{1,100}$'
* responses:
* 200:
* description: Report deleted
* /api/v1/reports/{reportId}/images:
* get:
* summary: Get report images
* tags:
* - Reports
* security:
* - bearerAuth: []
* - cookieAuth: []
* parameters:
* - name: reportId
* in: path
* required: true
* schema:
* type: string
* pattern: '^[a-zA-Z0-9_-]{1,100}$'
* responses:
* 200:
* description: Report images
* /api/v1/reports/{reportId}/images/{recordId}/{fileName}:
* delete:
* summary: Delete report image
* tags:
* - Reports
* security:
* - bearerAuth: []
* - cookieAuth: []
* parameters:
* - name: reportId
* in: path
* required: true
* schema:
* type: string
* pattern: '^[a-zA-Z0-9_-]{1,100}$'
* - name: recordId
* in: path
* required: true
* schema:
* type: string
* - name: fileName
* in: path
* required: true
* schema:
* type: string
* pattern: '^[a-zA-Z0-9_.-]{1,500}$'
* responses:
* 200:
* description: Image deleted
*/
/*
* Report submission accepts the full local report payload (answers, template
* binding, status) and stores it server-side. This bridges the offline-first