126 lines
2.2 KiB
Markdown
126 lines
2.2 KiB
Markdown
# AeroResolve Backend
|
|
|
|
test1
|
|
NestJS REST API for AeroResolve.
|
|
|
|
## Current Modules
|
|
|
|
| Module | Status | Description |
|
|
| ------------- | ----------- | ---------------------------------------- |
|
|
| `health` | Implemented | Health check |
|
|
| `database` | Implemented | PostgreSQL / TypeORM setup |
|
|
| `master-data` | Implemented | CRUD and seed data for lookup categories |
|
|
| `cohort` | Implemented | Cohort CRUD, pagination, status update |
|
|
|
|
## Prerequisites
|
|
|
|
- Node.js 18+
|
|
- npm
|
|
- PostgreSQL
|
|
|
|
## Install
|
|
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
## Environment Files
|
|
|
|
The app loads environment files based on `NODE_ENV`:
|
|
|
|
```text
|
|
.env.local
|
|
.env.dev
|
|
.env.test
|
|
.env.uat
|
|
```
|
|
|
|
Required values:
|
|
|
|
```text
|
|
PORT=3001
|
|
CORS_ORIGIN=http://localhost:5174
|
|
DB_HOST=localhost
|
|
DB_PORT=5432
|
|
DB_USER=<postgres-user>
|
|
DB_PASSWORD=<postgres-password>
|
|
DB_NAME=<database-name>
|
|
DB_SYNCHRONIZE=true
|
|
DB_SSL=false
|
|
```
|
|
|
|
## Run
|
|
|
|
```bash
|
|
# Local
|
|
npm run local
|
|
npm run start:local
|
|
|
|
# Dev
|
|
npm run dev
|
|
npm run start:dev
|
|
|
|
# UAT
|
|
npm run uat
|
|
npm run start:uat
|
|
```
|
|
|
|
## API
|
|
|
|
Base URL:
|
|
|
|
```text
|
|
http://localhost:3001/api
|
|
```
|
|
|
|
Swagger:
|
|
|
|
```text
|
|
http://localhost:3001/docs
|
|
```
|
|
|
|
## Endpoints
|
|
|
|
| Method | Path |
|
|
| -------- | -------------------------------- |
|
|
| `GET` | `/api/health` |
|
|
| `GET` | `/api/master-data/:category` |
|
|
| `POST` | `/api/master-data/:category` |
|
|
| `GET` | `/api/master-data/:category/:id` |
|
|
| `PUT` | `/api/master-data/:category/:id` |
|
|
| `DELETE` | `/api/master-data/:category/:id` |
|
|
| `GET` | `/api/cohorts?page=1&limit=10` |
|
|
| `POST` | `/api/cohorts` |
|
|
| `GET` | `/api/cohorts/:id` |
|
|
| `PUT` | `/api/cohorts/:id` |
|
|
| `PATCH` | `/api/cohorts/:id/status` |
|
|
| `DELETE` | `/api/cohorts/:id` |
|
|
|
|
## Seed Master Data
|
|
|
|
```bash
|
|
npm run seed:local
|
|
npm run seed:dev
|
|
npm run seed:test
|
|
npm run seed:uat
|
|
```
|
|
|
|
Seeded categories:
|
|
|
|
- `MEMBERSHIP_TIER`
|
|
- `CUSTOMER_VALUE`
|
|
- `REGION`
|
|
- `TRIP_PURPOSE`
|
|
- `CABIN_CLASS`
|
|
- `PASSENGER_TYPE`
|
|
- `ANCILLARY_PURCHASE`
|
|
- `REVENUE_SEGMENT`
|
|
|
|
## Planned Next
|
|
|
|
- Tenant foundation
|
|
- Auth / RBAC
|
|
- Audit logging
|
|
- Policy / regulation engine backend
|
|
- Compensation engine
|