# CRPMS ERD and Setup

## ERD (what to draw on paper)

Use these entities with cardinalities:

1. `Service(ServiceCode PK, ServiceName, ServicePrice)`
2. `Car(PlateNumber PK, Type, Model, ManufacturingYear, DriverPhone, MechanicName)`
3. `ServiceRecord(RecordNumber PK, ServiceDate, PlateNumber FK, ServiceCode FK)`
4. `Payment(PaymentNumber PK, AmountPaid, PaymentDate, ReceiverName, RecordNumber FK)`
5. `User(UserId PK, Username, Password, FullName)`

Relationships:

- One `Car` can have many `ServiceRecord` rows (`1:N`).
- One `Service` can appear in many `ServiceRecord` rows (`1:N`).
- One `ServiceRecord` can have many `Payment` rows (`1:N`) or one payment depending on policy.
- `User` is used for system login and payment receiver identity.

## MongoDB Mapping

Database name: `CRPMS`.

Collections:

- `services`
- `cars`
- `servicerecords`
- `payments`
- `users`

## Seeded services

- Engine repair: `150000`
- Transmission repair: `80000`
- Oil Change: `60000`
- Chain replacement: `40000`
- Disc replacement: `400000`
- Wheel alignment: `5000`

## Login account

- Username: `chief`
- Password: `chief123`

