Arkadii Ushakov - #12
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements reservation validation, double-booking prevention, and basic staff access features for the hotel reservation system. It adds backend validation logic, conflict detection to prevent overlapping reservations, a simple access code-based authentication mechanism, and a staff dashboard for viewing upcoming reservations.
Changes:
- Implemented reservation validation rules (date ranges, duration limits) with comprehensive unit tests
- Added conflict detection logic to prevent double-booking with integration tests
- Created staff authentication via access codes and a staff dashboard for viewing reservations
- Refactored toast notification hooks to prevent stale closure issues
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| api/Validators/ | New validation classes for rooms, reservations, and email addresses with comprehensive unit tests |
| api/Repositories/ | Added conflict detection method, improved error messages, and fixed date/time handling |
| api/Controllers/ | Enhanced request handling with better error responses and authentication checks |
| api/Program.cs | Changed database connection from Singleton to Scoped for better resource management |
| api/Models/ | Made Guest.Name nullable to accommodate flexible guest records |
| ui/src/utils/toasts.tsx | Refactored toast hooks to accept message as function parameter instead of constructor parameter |
| ui/src/staff/ | New StaffPage component for viewing upcoming reservations |
| ui/src/reservations/ | Updated to use new toast API and send dates in proper format |
| ui/src/LandingPage.tsx | Implemented login functionality with staff access code |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| type Reservation = { | ||
| id: string; | ||
| roomNumber: string; | ||
| guestEmail: string; | ||
| start: string; | ||
| end: string; | ||
| }; |
There was a problem hiding this comment.
Property name case mismatch: The C# API returns Reservation objects with PascalCase property names (Id, RoomNumber, GuestEmail, Start, End), but the TypeScript type expects camelCase property names (id, roomNumber, guestEmail, start, end). This will cause the properties to be undefined at runtime. Either the API should be configured to use camelCase serialization, or the TypeScript types should use PascalCase to match the JSON response.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| public InvalidRoomNumber(string invalidRoomNumber) | ||
| : base($"The value ${invalidRoomNumber} is not a valid") { } | ||
| : base($"The value {invalidRoomNumber} is not a valid") { } |
There was a problem hiding this comment.
The error message is incomplete and grammatically incorrect. It should end with "valid room number" or similar phrase instead of just "is not a valid".
| : base($"The value {invalidRoomNumber} is not a valid") { } | |
| : base($"The value {invalidRoomNumber} is not a valid room number") { } |
| using Microsoft.Data.Sqlite; | ||
| using Repositories; | ||
|
|
||
| namespace Tests.Integration.Repositories; |
There was a problem hiding this comment.
The namespace declaration is inconsistent with other test files in the same project. Other test files use Reservations.Tests.Unit.Validators but this integration test uses Tests.Integration.Repositories. For consistency and to match the project structure, this should be Reservations.Tests.Integration.Repositories.
| namespace Tests.Integration.Repositories; | |
| namespace Reservations.Tests.Integration.Repositories; |
Arkadii Ushakov
This PR implements reservation validation, double-booking prevention and basic staff access.
It adds overlap detection for reservations, a simple access code-based authentication, and an endpoint for retrieving today's and future reservations with guest details.
The focus was on delivering correct and maintainable functionality within the time constraints.
Task Status
Task Report
I worked within the 3-hour time constraint and focused on completing three tasks end-to-end.
Most of the time was spent on RE-001 and RE-002, ensuring validation logic and overlap detection were correct and covered with tests. RE-003 was implemented with a focus on backend functionality (authentication and reservations endpoint), while keeping the UI minimal.
Notes
Tried to keep the scope under control and stay pragmatic, also tried to avoid overengineering or making large architectural changes, focusing instead on delivering a clean and consistent solution within the existing structure.
I also tried to avoid changes that could trigger cascading fixes across the codebase because of given the time constraints.