Open chaaals opened 5 days ago
API Concerns:
- the FE libraries (which idk anything about) might have a different way of displaying data so I'd have to adjust the response/request body models to that (not just assume its a 2d array of cell data). So, I can't definitively say that the models above will be the final.
- I'd argue a PUT is not needed since report generation is our goal. I'd need an explanation as to why this was put. Same with DEL. Is this essential to FE functionality?
New endpoints:
GET /api/report/:id/comments
POST /api/report/:id/comments
Let's add delete later nalang, researched if may delete feature on PowerBI, seems like for owner/admin lang siya.
Routes
### Parameters > | name | type | data type | description | > |-----------|-----------|-------------------------|-----------------------------------------------------------------------| > | id | required | string | Unique ID of report | ### Responses > | http code | content-type | response | > |---------------|-----------------------------------|---------------------------------------------------------------------| > | `201` | `text/plain;charset=UTF-8` | `Configuration created successfully` | > | `400` | `application/json` | `{"code":"400","message":"Bad Request"}` | ### Returns All Reports in JSON format ```json { "reports": [ { "id": "810beb92-641e-4212-a300-da69db05101d", "report_name": "Report 1" }, { "id": "810beb92-641e-4212-a300-da69db05101d", "report_name": "Report 1" }, ... ] } ```GET
/api/report
(lists all reports)
### Parameters > | name | type | data type | description | > |-----------|-----------|-------------------------|-----------------------------------------------------------------------| > | id | required | string | Unique ID of report | ### Responses > | http code | content-type | response | > |---------------|-----------------------------------|---------------------------------------------------------------------| > | `201` | `text/plain;charset=UTF-8` | `Configuration created successfully` | > | `400` | `application/json` | `{"code":"400","message":"Bad Request"}` | ### Returns Report Details ```json { "report": { "id": "810beb92-641e-4212-a300-da69db05101d", "report_name": "Report 1" "data": [ [ { "cell_id": "1xxxxxx", "value": "", "remarks": "" }, { "cell_id": "1xxxxxx", "value": "", "remarks": "" }, { "cell_id": "1xxxxxx", "value": "", "remarks": "" } ... rest of the cells ], [ { "cell_id": "2xxxxxx", "value": "", "remarks": "" }, { "cell_id": "2xxxxxx", "value": "", "remarks": "" }, { "cell_id": "2xxxxxx", "value": "", "remarks": "" } ... rest of the cells ] ] } } ```GET
/api/report/:id
(views a report)
### Parameters > | name | type | data type | description | > |-----------|-----------|-------------------------|-----------------------------------------------------------------------| > | id | required | string | Unique ID of report | ### Request Body > | name | type | data type | description | > |-----------|-----------|-------------------------|-----------------------------------------------------------------------| > | data | required | object (JSON) | Updated report data | ### Responses > | http code | content-type | response | > |---------------|-----------------------------------|---------------------------------------------------------------------| > | `201` | `text/plain;charset=UTF-8` | `Configuration created successfully` | > | `400` | `application/json` | `{"code":"400","message":"Bad Request"}` | ### Returns Success message and new report details ```json { "message": "Successfully updated report 810beb92-641e-4212-a300-da69db05101d", "report_details": "" } ```PUT
/api/report/:id
(update a report)
### Parameters > | name | type | data type | description | > |-----------|-----------|-------------------------|-----------------------------------------------------------------------| > | id | required | string | Unique ID of report | ### Responses > | http code | content-type | response | > |---------------|-----------------------------------|---------------------------------------------------------------------| > | `201` | `text/plain;charset=UTF-8` | `Configuration created successfully` | > | `400` | `application/json` | `{"code":"400","message":"Bad Request"}` | ### Returns ```json { "message": "Successfully deleted report 810beb92-641e-4212-a300-da69db05101d", } ```DEL
/api/report/:id
(delete a reports)
### Request Body > | name | type | data type | description | > |-----------|-----------|-------------------------|-----------------------------------------------------------------------| > | data | required | object (JSON) | Uncleaned CSV data | ### Responses > | http code | content-type | response | > |---------------|-----------------------------------|---------------------------------------------------------------------| > | `201` | `text/plain;charset=UTF-8` | `Configuration created successfully` | > | `400` | `application/json` | `{"code":"400","message":"Bad Request"}` | ### Returns ```json { "report": { "id": "810beb92-641e-4212-a300-da69db05101d", "report_name": "Report 1" "data": [ [ { "cell_id": "1xxxxxx", "value": "", "remarks": "" }, { "cell_id": "1xxxxxx", "value": "", "remarks": "" }, { "cell_id": "1xxxxxx", "value": "", "remarks": "" } ... rest of the cells ], [ { "cell_id": "2xxxxxx", "value": "", "remarks": "" }, { "cell_id": "2xxxxxx", "value": "", "remarks": "" }, { "cell_id": "2xxxxxx", "value": "", "remarks": "" } ... rest of the cells ] ] } } ```POST
/api/make-report
(generate a report)
### Parameters > | name | type | data type | description | > |-----------|-----------|-------------------------|-----------------------------------------------------------------------| > | id | required | string | Unique ID of report | ### Responses > | http code | content-type | response | > |---------------|-----------------------------------|---------------------------------------------------------------------| > | `201` | `text/plain;charset=UTF-8` | `Configuration created successfully` | > | `400` | `application/json` | `{"code":"400","message":"Bad Request"}` | ### Implementation Details Pre-requisites: HTML Template of report 1. User fetches this endpoint with a path. 2. Backend retrieves report information from DB 3. Details are inserted to HTML Template 4. Convert HTML to PDF 5. Return the file for downloadGET
/api/download-report/:id
(download a report)