mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 19:24:32 +00:00
132 lines
4.2 KiB
Markdown
132 lines
4.2 KiB
Markdown
# Prole Shop - Spring WebMVC Shopping Application
|
|
|
|
A comprehensive Spring Boot shopping application that supports both product sales and service bookings with calendar scheduling.
|
|
|
|
## Features
|
|
|
|
- **Product Catalog**: Browse and purchase physical products
|
|
- **Service Booking**: Book professional services with calendar scheduling
|
|
- **Shopping Cart**: Session-based shopping cart for products and services
|
|
- **Checkout Process**: Complete order processing with customer information
|
|
- **Shipping Estimation**: Automatic shipping cost calculation based on weight and order value
|
|
- **Calendar Integration**: View and book available time slots for services
|
|
- **Order Management**: Track orders with status and payment information
|
|
|
|
## Technology Stack
|
|
|
|
- **Spring Boot 3.1.0**: Main framework
|
|
- **Spring WebMVC**: Web layer
|
|
- **Spring Data JPA**: Data access layer
|
|
- **Thymeleaf**: Template engine
|
|
- **PostgreSQL**: Database (prole-db service)
|
|
- **Bootstrap 5**: UI framework
|
|
|
|
## Database Configuration
|
|
|
|
The application connects to the `prole-db` PostgreSQL database service defined in `cloudnative-pg-prole0-db.yaml`.
|
|
|
|
Connection details:
|
|
- **Host**: prole-db-rw
|
|
- **Port**: 5432
|
|
- **Database**: prole-db
|
|
- **User**: prole
|
|
- **Password**: Fr0b0zzg0bl!n!
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
www/
|
|
├── src/
|
|
│ ├── main/
|
|
│ │ ├── java/
|
|
│ │ │ └── org/prole/shop/
|
|
│ │ │ ├── ShopApplication.java
|
|
│ │ │ ├── controller/ # MVC Controllers
|
|
│ │ │ ├── model/ # JPA Entities
|
|
│ │ │ ├── repository/ # Data Repositories
|
|
│ │ │ └── service/ # Business Logic
|
|
│ │ └── resources/
|
|
│ │ ├── application.properties
|
|
│ │ ├── schema.sql # Database schema
|
|
│ │ ├── data.sql # Sample data
|
|
│ │ ├── templates/ # Thymeleaf templates
|
|
│ │ └── static/ # Static resources
|
|
│ └── test/
|
|
└── pom.xml
|
|
```
|
|
|
|
## Running the Application
|
|
|
|
1. Ensure the `prole-db` database service is running and accessible
|
|
2. Build the project:
|
|
```bash
|
|
cd www
|
|
mvn clean install
|
|
```
|
|
3. Run the application:
|
|
```bash
|
|
mvn spring-boot:run
|
|
```
|
|
4. Access the application at: http://localhost:8080
|
|
|
|
## Application Endpoints
|
|
|
|
- `/` - Home page with featured products and services
|
|
- `/products` - List all products
|
|
- `/products/{id}` - Product detail page
|
|
- `/services` - List all services
|
|
- `/services/{id}` - Service detail page with calendar booking
|
|
- `/cart` - Shopping cart view
|
|
- `/checkout` - Checkout form
|
|
- `/checkout/success` - Order confirmation
|
|
|
|
## Database Schema
|
|
|
|
The application uses the following main entities:
|
|
|
|
- **Product**: Physical products for sale
|
|
- **Service**: Professional services available for booking
|
|
- **ScheduleSlot**: Available time slots for services
|
|
- **CartItem**: Items in the shopping cart (session-based)
|
|
- **Order**: Customer orders
|
|
- **OrderItem**: Items within an order
|
|
|
|
## Payment Processing
|
|
|
|
Payment processing is currently a placeholder. The `OrderService.processPayment()` method simulates payment processing. Integration with an external payment processor (Stripe, PayPal, etc.) should be implemented in this method.
|
|
|
|
## Shipping Calculation
|
|
|
|
Shipping costs are calculated based on:
|
|
- Base shipping cost: $10.00
|
|
- Cost per kg: $2.00
|
|
- Free shipping threshold: $100.00
|
|
|
|
These values can be configured in `ShippingService.java`.
|
|
|
|
## Sample Data
|
|
|
|
The application includes sample data for development/testing:
|
|
- 6 sample products
|
|
- 6 sample services
|
|
- Sample schedule slots for services
|
|
|
|
## Development Notes
|
|
|
|
- The application uses session-based cart management
|
|
- Database schema is auto-created on startup (spring.jpa.hibernate.ddl-auto=update)
|
|
- Sample data is loaded from `data.sql` on startup
|
|
- Thymeleaf templates use Bootstrap 5 for styling
|
|
|
|
## Future Enhancements
|
|
|
|
- User authentication and accounts
|
|
- Order history and tracking
|
|
- Email notifications
|
|
- Payment processor integration (Stripe, PayPal, etc.)
|
|
- Advanced calendar features (recurring appointments, availability management)
|
|
- Product reviews and ratings
|
|
- Inventory management
|
|
- Admin dashboard
|
|
|