Skip to content

Commit 9b02e91

Browse files
authored
Update README.md
1 parent ee744ea commit 9b02e91

File tree

1 file changed

+191
-2
lines changed

1 file changed

+191
-2
lines changed

README.md

Lines changed: 191 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,191 @@
1-
# AFKs
2-
FInal Programming Project for Programming VI asignature
1+
# AFKs Team
2+
- Isaias Rojas Condarco
3+
- Diego Michel Roca
4+
- Santiago Quiroga Salazar
5+
6+
## Project Overview
7+
The Project is an API-driven solution designed to streamline the operations of a beverage distribution company. It manages inventory, processes customer orders, and handles delivery logistics using a fleet of trucks and vans. The system ensures efficient order handling, vehicle allocation, and real-time status updates for customers.
8+
9+
## Features
10+
- **Order Management**
11+
- Customers can place orders for multiple beverages.
12+
- Track the status of each order in real time.
13+
- Reject orders if insufficient vehicle capacity is available.
14+
- **Vehicle Management**
15+
- Manage a fleet of trucks and vans with varying capacities.
16+
- Allocate vehicles based on order size and availability.
17+
- Ensure each order is delivered by a single vehicle.
18+
- **Inventory Management**
19+
- Maintain up-to-date records of beverage stock in the warehouse.
20+
- **User Notifications**
21+
- Inform customers about the status of their orders.
22+
- **Data Persistence**
23+
- Store all relevant information in a reliable database.
24+
- **Continuous Integration**
25+
- Automated builds and tests to ensure code quality.
26+
- **Unit Testing**
27+
- Comprehensive tests with over 80% code coverage.
28+
29+
## Technologies Used
30+
- **Backend Framework:** [ASP.NET](https://dotnet.microsoft.com/en-us/apps/aspnet)
31+
- **Data Access:** [Dapper](https://www.learndapper.com/)
32+
- **Database:** PostgreSQL.
33+
- **Version Control:** Git.
34+
- **Continuous Integration:** GitHub Actions.
35+
- **Testing Framework:** xUnit.
36+
37+
## Architecture
38+
- **API Layer:** Handles HTTP requests and responses.
39+
- **Core Layer:** Contains business logic for order and vehicle management.
40+
- **Infrastructure Layer:** Interacts with the database using Dapper.
41+
- **Database:** Stores all persistent data including orders, vehicles, and inventory.
42+
43+
## Installation
44+
45+
### Prerequisites
46+
- [.NET SDK](https://dotnet.microsoft.com/download) installed
47+
- PostgreSQL
48+
- Docker
49+
- Git
50+
51+
### Steps
52+
- **Clone the Repository**
53+
```bash
54+
git clone https://github.com/Programming6-projects/AFKs.git
55+
```
56+
- **Clean Docker (If Necessary)**
57+
```bash
58+
docker container ls -a
59+
docker container rm <container id>
60+
docker image ls -a
61+
docker image rm <image id>
62+
docker volume ls
63+
docker volume rm <volume id>
64+
```
65+
- **Run Database Migrations**
66+
```bash
67+
docker compose up
68+
```
69+
- **Start the Application**
70+
```bash
71+
dotnet run --project Pepsi.API
72+
```
73+
74+
## API Documentation
75+
76+
## Base URL
77+
```
78+
http://localhost:5225/swagger/index.html
79+
```
80+
81+
## Endpoints
82+
83+
### Orders
84+
- **POST**
85+
- **Request Body:**
86+
```json
87+
{
88+
"clientId": 0,
89+
"client": {
90+
"name": "string",
91+
"address": "string",
92+
"region": "string"
93+
},
94+
"vehicleId": 0,
95+
"vehicle": {
96+
"type": "string",
97+
"capacity": 0,
98+
"isAvailable": true
99+
},
100+
"items": [
101+
{
102+
"orderId": 0,
103+
"productId": 0,
104+
"product": {
105+
"name": "string",
106+
"price": 0,
107+
"weight": 0
108+
},
109+
"quantity": 0,
110+
"unitPrice": 0
111+
}
112+
],
113+
"totalVolume": 0,
114+
"orderDate": "2024-09-19T23:19:04.463Z",
115+
"deliveryDate": "2024-09-19T23:19:04.463Z",
116+
"status": 0
117+
}
118+
```
119+
- **Responses:**
120+
- `201 Created` – Order successfully created.
121+
- `400 Bad Request` – Invalid input.
122+
- `409 Conflict` – No available vehicles.
123+
- **GET**
124+
- **Responses:**
125+
- `200 OK` – Returns order status.
126+
- `404 Not Found` – Order does not exist.
127+
- `500 internal Server Error`
128+
129+
### Clients
130+
- **POST**
131+
- **Request Body:**
132+
133+
```json
134+
{
135+
"name": "string",
136+
"address": "string",
137+
"region": "string"
138+
}
139+
```
140+
- **Responses:**
141+
- `201 Created` – Order successfully created.
142+
- `400 Bad Request` – Invalid input.
143+
- `409 Conflict` – No available vehicles.
144+
- **GET**
145+
- **Responses:**
146+
- `200 OK` – List of available vehicles.
147+
148+
## Additional Endpoints
149+
- **Order Per Client ID**
150+
151+
## Database
152+
- **Entities:**
153+
- **Clients:** Stores customer information.
154+
- **Orders:** Stores order details.
155+
- **OrderItem:** Stores products within an order.
156+
- **Vehicles:** Stores vehicle details and availability.
157+
- **Products:** Stores product information.
158+
- **ProductStocks:** Tracks stock levels.
159+
- **Initialization:**
160+
- On application start, the system reads the vehicle data file `.json` to populate the `Vehicles` table for the day (if it was already loaded, then it does nothing).
161+
162+
## Testing
163+
- **Running Tests:**
164+
```bash
165+
dotnet test
166+
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Threshold=80
167+
```
168+
169+
## Continuous Integration
170+
- **Setup:**
171+
- CI is configured using GitHub Actions.
172+
- **Pipeline Steps:**
173+
- Restore dependencies
174+
- Check code.
175+
- Run tests.
176+
- Build the application.
177+
178+
## Design Principles & Patterns
179+
- **SOLID Principles**: Ensures maintainable and scalable code by following:
180+
- **Single Responsibility Principle (SRP)**
181+
- **Open/Closed Principle (OCP)**
182+
- **Liskov Substitution Principle (LSP)**
183+
- **Interface Segregation Principle (ISP)**
184+
- **Dependency Inversion Principle (DIP)**
185+
- **KISS (Keep It Simple, Stupid)**: Encourages simplicity in design to avoid unnecessary complexity.
186+
- **DRY (Don’t Repeat Yourself)**: Avoids code duplication by centralizing logic to make the system easier to maintain and extend.
187+
- **YAGNI (You Ain’t Gonna Need It)**: Prevents overengineering by focusing only on current requirements instead of future speculation.
188+
- **Repository Pattern**: Abstracts data access logic, providing a clean separation between business logic and data layer, making the system easier to maintain and test.
189+
- **Factory Pattern**: Provides a way to create objects without specifying the exact class of object that will be created, promoting flexibility and decoupling.
190+
- **Dependency Injection**: Facilitates testing and loose coupling by injecting dependencies into components rather than creating them inside, improving flexibility and code reusability.
191+
- **Singleton Pattern**: Ensures a class has only one instance, useful for managing shared resources or global configurations.

0 commit comments

Comments
 (0)