diff --git a/02_ProjectOrientedSessions/Session05/Session05.md b/02_ProjectOrientedSessions/Session05/Session05.md index b8582e8..8cc07d1 100644 --- a/02_ProjectOrientedSessions/Session05/Session05.md +++ b/02_ProjectOrientedSessions/Session05/Session05.md @@ -22,7 +22,7 @@ app.UseCors("Frontend"); ``` -# **Important Note Before Starting** +# Important Note Before Starting ## From now on, this session will be focused on the **frontend repository** diff --git a/02_ProjectOrientedSessions/Session08/New Roadmap.md b/02_ProjectOrientedSessions/Session08/New Roadmap.md new file mode 100644 index 0000000..be18433 --- /dev/null +++ b/02_ProjectOrientedSessions/Session08/New Roadmap.md @@ -0,0 +1,58 @@ + +## Roadmap + +### Setup + +Estimated Time: - days +#### Backend + +- [ ] A +#### Frontend +- [ ] A + + + + +### Profile Page + +#### Creating BankDetailTable +#### ADd data into ticket status +Add phone number in person +person table- make id not unique - add creatorId + +#### +#### Tabs Panel like that (FULL) +#### Account Detail Tab (FULL) +#### My Travels Tab (FULL) +#### List of Travelers Tab (FULL) +#### My Favorites Tab (LATER) +#### Support Tab (LATER) +#### Transactions Tab (FULL) - Add balance to table - inc/dec balance + + +### Buying Tickets +#### Transportation Search Result 3 links +#### Showing seat status +#### The Select Ticket Page - Three different kinds, for bus, train, airplane +##### The header to show details and total price +##### The part for selecting seats (only for bus) +##### the list of people below it + + +### README and documentation + +## Optional Enhancements + +- [ ] Generic – You can use general types to avoid repetition and make code flexible, esp. in API + +- [ ] Responsive UI – Make sure the interface adjusts nicely + +- [ ] Theme – Support light/dark or customizable appearance + +- [ ] Server Log – Keep track of what happens on the server + +- [ ] Index in database – Improve how fast things are found in the database + +- [ ] Optimizing Multithreading – Make background work smoother and faster + +- [ ] Repository Pattern – Organize how data is handled and accessed \ No newline at end of file diff --git a/02_ProjectOrientedSessions/Session08/SeatGenerator.py b/02_ProjectOrientedSessions/Session08/SeatGenerator.py new file mode 100644 index 0000000..75be5c0 --- /dev/null +++ b/02_ProjectOrientedSessions/Session08/SeatGenerator.py @@ -0,0 +1,56 @@ +vehicles = [ + {"id": 1, "title": "Volvo 9700", "type": 1, "capacity": 50}, + {"id": 2, "title": "Scania Touring", "type": 1, "capacity": 52}, + {"id": 3, "title": "TGV Duplex", "type": 2, "capacity": 510}, + {"id": 4, "title": "Shinkansen N700", "type": 2, "capacity": 1323}, + {"id": 5, "title": "Boeing 777", "type": 3, "capacity": 396}, + {"id": 6, "title": "Airbus A380", "type": 3, "capacity": 469} +] + +def generate_seats(vehicle): + seats = [] + vehicle_id = vehicle["id"] + capacity = vehicle["capacity"] + vtype = vehicle["type"] + vip_rows = 3 if capacity >= 50 else 1 + + if vtype == 1: # Bus: 2+2 layout + seats_per_row = 4 + elif vtype == 2: # Train: 2+2 layout + seats_per_row = 4 + elif vtype == 3: # Airplane: 3+4+3 (approx 10 per row) + seats_per_row = 10 + else: + seats_per_row = 4 # default + + rows = (capacity + seats_per_row - 1) // seats_per_row + + seat_id = 1 + for row in range(1, rows + 1): + for col in range(1, seats_per_row + 1): + if seat_id > capacity: + break + seat = { + "Id": seat_id, + "VehicleId": vehicle_id, + "Row": row, + "Column": col, + "IsVIP": row <= vip_rows, + "IsAvailable": True, + "Description": "" + } + seats.append(seat) + seat_id += 1 + return seats + +# Generate and print all +all_seats = [] +for v in vehicles: + seats = generate_seats(v) + all_seats.extend(seats) + +# Print as SQL INSERTs (optional) +for s in all_seats: + print(f"INSERT INTO Seats (Id, VehicleId, Row, Column, IsVIP, IsAvailable, Description) VALUES " + f"({s['Id']}, {s['VehicleId']}, {s['Row']}, {s['Column']}, {str(s['IsVIP']).lower()}, " + f"{str(s['IsAvailable']).lower()}, '{s['Description']}');") diff --git a/02_ProjectOrientedSessions/Session08/Session08 Backend.md b/02_ProjectOrientedSessions/Session08/Session08 Backend.md new file mode 100644 index 0000000..3d666cd --- /dev/null +++ b/02_ProjectOrientedSessions/Session08/Session08 Backend.md @@ -0,0 +1,49 @@ + + +# Fixes +- [ ] Check for missing `.ValueGeneratedOnAdd()` in all entity configuration. +- [ ] Adjust the database setup according to the second version of ERD +- [ ] Pay attention to the changes in logic and implementation of Person table (Id number is not unique anymore) +- [ ] Add actual data in `TicketStatus`, `Gender`, `TransactionTypes` +- [ ] Add data in `Seat`, `Person`, `TicketOrder`, `Transaction`, `Ticket` for test. It is recommended to write python code for generating data for Seat table, according to the data already stored in Transportation and related Vehicle data +- [ ] Fix claim extraction (`sub` → standardize JWT claim mapping). (`IUserContext` implmentation) + +### ✅ Profile Page (Account Info Tab) + +- [ ] Create `ProfileDto` to represent combined data for account, person, bank detail, balance. +- [ ] Add `GetProfileAsync` in `AccountRepository` and expose via `AccountController`. +- [ ] Implement: + - [ ] Edit Email (with validation): `EditEmailDto`, service method, and controller endpoint. + - [ ] Edit Password: `EditPasswordDto`, service and controller. + - [ ] Edit Person Info: `UpsertAccountPersonDto`, and endpoint to upsert personal data. + - [ ] Edit BankAccountDetail: `UpsertBankAccountDetailDto` and relevant logic. +- [ ] Add mapping for all Dtos and fix related properties like `CreatorAccountId`. + + +--- + +### ✅ List of Travelers + +- [ ] Add `GetPeople` endpoint in `AccountController`. +- [ ] Implement separation of `UpsertAccountPerson` and `UpsertPerson`. +- [ ] Adjust Dto: `PersonDto` (with `id`, `creatorAccountId`, `englishFirstName`, etc.). + + +--- + +### ✅ My Travels Tab + +- [ ] Create `TicketOrderSummaryDto` (includes cities, vehicle name, price, etc.). +- [ ] Add `GetTravels` in `AccountService`, and expose `GetMyTravels` in controller. + +--- + +### ✅ My Transactions Tab + +- [ ] Create `TransactionDto` and mapping. +- [ ] Add method to get transactions by `AccountId`. +- [ ] Expose `GetMyTransactions` in `AccountController`. +- [ ] Add modal to simulate balance top-up (manual input). +- [ ] Format amount text based on transaction type: green (+) for income, red (–) for expense. + +--- diff --git a/02_ProjectOrientedSessions/Session08/Session08 Frontend.md b/02_ProjectOrientedSessions/Session08/Session08 Frontend.md new file mode 100644 index 0000000..001b37e --- /dev/null +++ b/02_ProjectOrientedSessions/Session08/Session08 Frontend.md @@ -0,0 +1,52 @@ +## ✅ Frontend Profile Page Implementation Checklist + +### ⚙️ Tooling & Fixes +- [ ] Install and configure `react-hook-form` +--- +### 🔐 Account & Authentication +- [ ] Use Axios request interceptor to: + - [ ] Attach token to requests + - [ ] Handle logout logic +--- +### API +- [ ] Provide a method for each new endpoint implemented in backend +--- +### 🗂️ Additional Profile Tabs (initial setup) + +- [ ] Add empty pages/tabs for: + - [ ] `ProfileSummary` + - [ ] `MyTravels` + - [ ] `ListOfTravelers` + - [ ] Favorites + - [ ] Support + - [ ] `MyTransactions` +- [ ] Implement `ProfilePage` component +- [ ] Create prototype of `ProfilePage` and integrate with navbar. (Create a button or link to access `ProfilePage`, only when user is logged in) +- [ ] Define and adjust routes for profile and its tabs +- [ ] Implement route-based tab handling inside `ProfilePage` + +--- +### Profile Summary +#### 📦 DTOs / Models +- Add models for: + - [ ] `EditEmailDto` + - [ ] `EditPasswordDto` + - [ ] `PersonDto` + - [ ] `ProfileDto` + - [ ] `UpsertBankAccountDetailDto` + - [ ] Implement the process of showing and editing the data +--- +### 🧍 List of Travelers +- [ ] Implement `ListOfTravelers` page for showing, editing, and adding new people + +--- +### 💳 Transactions Module +- [ ] Add `TransactionDto` model +- [ ] Implement `MyTransactions` page +--- +### 🚆 Travel Module +- [ ] Add `TicketOrderSummaryDto`, `TravelerTicketDto` models +- [ ] Implement `MyTravels` page +- [ ] Implement `TravelOrderDetailsPage` + +--- diff --git a/02_ProjectOrientedSessions/Session08/Zustand.md b/02_ProjectOrientedSessions/Session08/Zustand.md deleted file mode 100644 index a71f6ad..0000000 --- a/02_ProjectOrientedSessions/Session08/Zustand.md +++ /dev/null @@ -1,16 +0,0 @@ -https://github.com/3lf/design-patterns-for-humans - - -pros: -- little boilerplate code -- doesn't rely on provider -- faster than context -- state merging by default -- extendable by default -- little opinionated -- - - - -State Management -current state? diff --git a/02_ProjectOrientedSessions/docs/AlibabaERD-Version02.pdf b/02_ProjectOrientedSessions/docs/AlibabaERD-Version02.pdf new file mode 100644 index 0000000..b47caad Binary files /dev/null and b/02_ProjectOrientedSessions/docs/AlibabaERD-Version02.pdf differ diff --git a/02_ProjectOrientedSessions/docs/AlibabaERD-Version02.vsdx b/02_ProjectOrientedSessions/docs/AlibabaERD-Version02.vsdx new file mode 100644 index 0000000..7900722 Binary files /dev/null and b/02_ProjectOrientedSessions/docs/AlibabaERD-Version02.vsdx differ diff --git a/02_ProjectOrientedSessions/docs/AlibabaERD.vsdx b/02_ProjectOrientedSessions/docs/AlibabaERD.vsdx index 2268376..b22d2b1 100644 Binary files a/02_ProjectOrientedSessions/docs/AlibabaERD.vsdx and b/02_ProjectOrientedSessions/docs/AlibabaERD.vsdx differ