Initial stage
This commit is contained in:
+137
@@ -0,0 +1,137 @@
|
||||
# Check List Proof of Concept
|
||||
|
||||
This repository contains a minimal proof-of-concept backend for the Check List hybrid reporting solution described in the project documentation.
|
||||
|
||||
## What is included
|
||||
|
||||
- Node.js REST API for template and configuration delivery
|
||||
- MariaDB schema for phase 1 configuration data
|
||||
- seed data with one sample inspection checklist template
|
||||
- lookup values, image policy, and export profile
|
||||
- setup instructions for local development
|
||||
|
||||
## Scope of this PoC
|
||||
|
||||
Included:
|
||||
- template list endpoint
|
||||
- active template endpoint
|
||||
- specific template version endpoint
|
||||
- lookup endpoints
|
||||
- image rule endpoint
|
||||
- export profile endpoint
|
||||
- generic application config endpoint
|
||||
- MariaDB schema and seed data
|
||||
|
||||
Not included:
|
||||
- report upload
|
||||
- authentication
|
||||
- admin UI
|
||||
- report draft storage backend
|
||||
- XLSX or ZIP generation
|
||||
- client-side offline application
|
||||
|
||||
The PoC keeps template content inside a JSON column to reduce initial complexity and speed up delivery. This is deliberate for phase 1 proof-of-concept work.
|
||||
|
||||
## Project structure
|
||||
|
||||
```text
|
||||
.
|
||||
├── package.json
|
||||
├── sql/
|
||||
│ ├── schema.sql
|
||||
│ └── seed.sql
|
||||
└── src/
|
||||
├── app.js
|
||||
├── server.js
|
||||
├── config/
|
||||
├── db/
|
||||
├── middleware/
|
||||
├── routes/
|
||||
├── services/
|
||||
└── utils/
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js 20+
|
||||
- MariaDB 10.6+
|
||||
|
||||
## Setup
|
||||
|
||||
1. Copy `.env.example` to `.env` and adjust the database credentials.
|
||||
2. Create the schema:
|
||||
|
||||
```sql
|
||||
SOURCE sql/schema.sql;
|
||||
```
|
||||
|
||||
3. Seed the sample data:
|
||||
|
||||
```sql
|
||||
SOURCE sql/seed.sql;
|
||||
```
|
||||
|
||||
4. Install dependencies:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
5. Start the API:
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
## API endpoints
|
||||
|
||||
### Service health
|
||||
|
||||
`GET /api/health`
|
||||
|
||||
### Templates
|
||||
|
||||
- `GET /api/templates`
|
||||
- `GET /api/templates/incoming-inspection`
|
||||
- `GET /api/templates/incoming-inspection/versions/1`
|
||||
|
||||
### Lookups
|
||||
|
||||
- `GET /api/lookups`
|
||||
- `GET /api/lookups/pass-fail`
|
||||
|
||||
### Configuration
|
||||
|
||||
- `GET /api/config/image-rules`
|
||||
- `GET /api/config/export`
|
||||
- `GET /api/config/app-config`
|
||||
|
||||
## Example response
|
||||
|
||||
`GET /api/templates/incoming-inspection`
|
||||
|
||||
```json
|
||||
{
|
||||
"code": "incoming-inspection",
|
||||
"name": "Incoming Inspection Checklist",
|
||||
"description": "PoC template for supplier or incoming goods quality inspection.",
|
||||
"version": 1,
|
||||
"status": "active",
|
||||
"publishedAt": "2026-04-09T10:00:00.000Z",
|
||||
"definition": {
|
||||
"templateId": "incoming-inspection",
|
||||
"templateName": "Incoming Inspection Checklist",
|
||||
"version": 1,
|
||||
"sections": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Recommended next step after this PoC
|
||||
|
||||
The next logical implementation layer is the client application that:
|
||||
- caches templates in IndexedDB,
|
||||
- renders forms dynamically from `definition`,
|
||||
- stores local drafts and image metadata,
|
||||
- applies validation rules before export,
|
||||
- generates XLSX and ZIP locally.
|
||||
Reference in New Issue
Block a user