Annan Raddad - #11
Open
RaddadZ wants to merge 15 commits into
Open
Conversation
… handling - Change database services from Singleton to Scoped lifetime for proper connection management - Make EnsureDb async Task instead of async void - Await EnsureDb call with proper scope disposal - Add global exception handler for production environments
…ions and rooms - Add ValidationException for structured error handling - Create ReservationExtensions with validation for booking rules (RE-001): - Room number format validation - Email domain validation - Start date must not be in past - Start date must be before end date - Duration constraints (1-30 days) - Create RoomExtensions with validation and move static methods from Room model - Update ReservationController to validate reserv
- Wrap overlap check and INSERT in a single transaction for atomicity - Query for existing reservations with date range overlap before inserting - Throw ValidationException if room is already booked for selected dates - Handle ValidationException in controller and return 409 Conflict - Use strict inequality for date comparison to allow same-day checkout/checkin - Ensure database connection is open before starting transaction
…authorization - Replace manual cookie checking with ASP.NET Core Cookie Authentication - Add [Authorize] and [AllowAnonymous] attributes to controller endpoints - Configure authentication middleware with secure cookie settings - Update StaffController to use SignInAsync/SignOutAsync for login/logout - Return 401/403 status codes instead of redirecting for API endpoints - Set cookie security based on environment (secure in production
… staff dashboard - Add pagination support to GetReservations endpoint with from date filter - Return pagination metadata in response headers (X-Total-Count, X-Page, X-Page-Size) - Create database indexes on Reservations table for query performance - Expose pagination headers in CORS configuration - Implement offset-based pagination in ReservationRepository with configurable page size (1-100) - Add staff login page with access code authentication
…igration system - Implement versioned database migrations using PRAGMA user_version - Add IsDirty boolean column to Rooms table in migration v3 - Create PATCH endpoint for Room with JsonPatchDocument support - Add RoomPatch model with IsDirty field and whitelist allowed patch paths - Block check-in if room is dirty with validation in ReservationController - Set room to dirty automatically on check-in in ReservationRepository - Add Set
…nd error reporting - Add ImportOptions configuration model with MaxFileSizeBytes and MaxRows limits - Create POST /api/rooms/import endpoint with multipart/form-data support - Implement streaming CSV parser with header detection and row limit enforcement - Validate file size, extension, room number format, state, and IsDirty fields - Check for duplicates against existing rooms and within CSV batch - Add BulkCreateRooms method in
…ter expired - Add AuthContext.tsx with AuthProvider and useAuth hook - Mount AuthProvider in index.tsx wrapping the app - Move Logout button to Layout.tsx top bar (visible when authenticated) - Auto-redirect /staff/login → /staff if already authed - Call logout() on 401 in checkAuth to clear expired HttpOnly cookie - Remove per-page checkAuth/logout calls in favor of shared context
- Add xUnit test project with coverlet and test SDK packages - Create ReservationValidationTests covering email, date, duration, and room number validation - Create RoomValidationTests covering room number format, length, and door number rules - Add .gitignore for test project bin/obj/user files - Reference main api project for testing Extensions and Models
…erations - Add Serilog with console sink configured from appsettings - Replace Console.WriteLine with Log.Fatal for startup errors - Add UseSerilogRequestLogging middleware for HTTP request logging - Inject ILogger<RoomController> and add structured logging for all room operations - Log warnings for validation failures, not found errors, and invalid formats - Log information for successful creates, updates, deletes with structured
There was a problem hiding this comment.
Copilot reviewed 37 out of 37 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…fLoginPage per copilot comment - Replace inline HTTPError handling with shared handleApiError utility - Use handleApiError in CheckInDialog catch block for check-in failures - Use handleApiError in StaffLoginPage catch block for login failures - Remove duplicate error parsing logic and HTTPError import from StaffLoginPage
…ollow-ups - Document initial polish decisions (scoped DI, DB seeding, exception middleware) - Record guest booking implementation (validation, Zod parsing, date handling) - Capture double-booking prevention with transaction-based overlap checks - Detail auth framework refactor to cookie authentication with role-based authorization - Document staff dashboard with pagination, filtering, and auth context - Record check-in flow with verification codes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Annan Raddad
I focused on pragmatic development, security, and coding standards over feature richness. I refactored where necessary to align with framework conventions, wrapped critical operations in transactions to prevent race conditions, and added database indexes for performance. I included an example implementation of structured logging, tracing on the import pipeline, and unit tests for validation. For the most part, trade‑offs are intentional, not overlooked. I've used devcontainers to develop and test the project.
Commits are separated by business logic, and I tried to keep them as readable and as small as possible.
In consecutive 3‑hour blocks:
In distributed extra 3 hours:
Task Report
The commit log is mostly a representation of the time I spent from the first commit, and it shows that I started with minor refactoring, then the implementation of RE‑001, followed by RE‑002, then more polishing before implementing RE‑003.
I took the full 3 hours, with most of my time spent on RE‑001, RE‑003, and RE‑005, along with their related polish work.
Lastly, I spent some time creating example implementations of structured logging and unit tests, which I think must be done to show production‑level readiness for a project I (virtually) own.
To Be Improved Notes
Security & hardening
AllowAnyOriginto known frontend origins; add request‑validation middleware and rate‑limiting onPOST /staff/loginto prevent brute‑force.staffAccessCodewith a secrets manager, introduce aStafftable with per‑user credentials plus audit trails for room‑cleanliness changes, and implement proper email sending (e.g., SendGrid, SES) instead of showing codes to staff.MAX_FILE_SIZE, binary content sniffing beyond the.csvextension, and a health‑check endpoint for orchestrators.Code quality & design
NotFoundException) with result types or similar; useFluentValidationfor declarative, testable rules instead of custom extension methods.Apiprefix to namespaces, pluralizing controller names, and placing DTOs in a dedicated folder.down‑migration‑script gaps and keep SQL queries optimized (e.g., prefer cursor‑based pagination overLIMIT/OFFSETand tighten queries where possible).UX & observability
Delivery & operations
Quick Look