54 lines
2.5 KiB
Markdown
54 lines
2.5 KiB
Markdown
# Car Service Database
|
|
|
|
PostgreSQL database and web dashboard for a car service workshop, managed with Docker Compose.
|
|
|
|
## Start
|
|
|
|
```powershell
|
|
docker compose up -d
|
|
```
|
|
|
|
Open the web dashboard at [http://localhost:3000](http://localhost:3000).
|
|
|
|
The dashboard's **Vehicles** view provides a dedicated vehicle register containing make, model, model year, engine, transmission, fuel type, color, VIN, license plate, mileage, owner, and service-record count. The **Service records** form stores these vehicle details and can autofill them, along with the customer, when an existing VIN or license plate is entered. Customer contact information can also be autofilled by customer email or by a unique customer name. Names are not unique, so duplicate names are allowed; when a name matches multiple customers, the form asks for an email instead of choosing one incorrectly. It supports adding, listing, and editing service records with service date, VIN, license plate number, car mileage, customer, technician, complaint, and status. Adding a record creates or updates the linked customer and vehicle, technician, and service order in one transaction.
|
|
|
|
The **Accounts** view supports reading, adding, editing, and deleting users with `read`, `add`, and `delete` rights. A default `admin` account is created automatically, and the last administrator cannot be deleted. These permissions are currently stored as staff access profiles; login/session enforcement can be added when authentication is required.
|
|
|
|
Check that the database is ready:
|
|
|
|
```powershell
|
|
docker compose ps
|
|
docker compose exec car-service-db pg_isready -U car_service_app -d car_service
|
|
```
|
|
|
|
Connect with `psql` inside the container:
|
|
|
|
```powershell
|
|
docker compose exec car-service-db psql -U car_service_app -d car_service
|
|
```
|
|
|
|
The default connection values are:
|
|
|
|
- Host: `localhost`
|
|
- Port: `5432`
|
|
- Database: `car_service`
|
|
- User: `car_service_app`
|
|
- Password: `change-me-in-production`
|
|
|
|
To use different values, create a `.env` file next to `docker-compose.yml`:
|
|
|
|
```dotenv
|
|
POSTGRES_DB=car_service
|
|
POSTGRES_USER=car_service_app
|
|
POSTGRES_PASSWORD=use-a-strong-password
|
|
POSTGRES_PORT=5432
|
|
```
|
|
|
|
The schema is loaded from `init.sql` the first time the named volume is created. To recreate the database from scratch, including all data:
|
|
|
|
```powershell
|
|
docker compose down -v
|
|
docker compose up -d
|
|
```
|
|
|
|
Do not use the default password in production. Restrict the published port or place the database on a private Docker network when an application is added. |