Skip to content

feat: multi-tenancy database filters, duplicate username auth, and empty-state UX enhancements#10

Merged
austinchima merged 2 commits into
mainfrom
feature/multi-tenancy-and-ux-upgrades
May 29, 2026
Merged

feat: multi-tenancy database filters, duplicate username auth, and empty-state UX enhancements#10
austinchima merged 2 commits into
mainfrom
feature/multi-tenancy-and-ux-upgrades

Conversation

@austinchima

Copy link
Copy Markdown
Owner

🛠️ Summary of Implementation

This Pull Request introduces enterprise-grade multi-tenancy, refactored authentication policies, real-time profile editing, and comprehensive UI/UX fixes across the frontend and backend. It resolves all outstanding compilation blocks and cleans up compiler warnings across the solution.


🚀 Key Enhancements Added

1. Global Multi-Tenancy & Database Isolation

  • Global Query Filters: Integrated IHttpContextAccessor into ApplicationDbContext to dynamically extract the NameIdentifier claim. All database queries for Product, Order, SalesHistory, Customer, and ReorderRequest are now automatically filtered by the current user's ID (e.UserId == CurrentUserId).
  • Implicit Stamping: Overrode SaveChangesAsync in ApplicationDbContext to automatically inject the authenticated UserId on new entity creations.
  • Production Sandbox: Completely disabled the automated developer database seeder on startup to support clean multi-tenant isolation.
  • Design-Time Migrations: Aligned the design-time factory (ApplicationDbContextFactory.cs) to support IHttpContextAccessor using default accessors, enabling seamless schema updates via dotnet ef.

2. Authenticated Profile & Duplicate Username Support

  • Email-Centric Signups: Configured RequireUniqueEmail = true and updated NormalizedUserName to be non-unique. Users can now sign up with duplicate display usernames (e.g. two separate users named admin under different email addresses) with zero database index conflicts.
  • Dynamic Profile Updates: Added a PUT endpoint for username updates. On username change, the backend regenerates and signs a fresh JWT token to update the client session in real-time.
  • Profile Sync: Bound the frontend layout state dynamically to refresh user details across all pages immediately upon token update.

3. Frontend UI/UX Refactoring

  • Empty State Layouts: Fixed squished text wrapping on the Order Ledger and Product Inventory empty states by expanding the layout constraints from a narrow max-w-[280px] to a spacious max-w-md, optimizing spacing and typography.
  • Promise-Based Modals: Refactored ConfirmationModal to support synchronous loader spinners and disabled button actions during async operations, auto-closing only upon successful backend API completion.

4. Compiler Clean-up

  • Test Context Resolution: Resolved test compile-time failures in CreateOrderCommandHandlerTests by mocking IHttpContextAccessor for database contexts.
  • Null-Safety: Resolved nullable warning dereferences in GetOrdersQuery.cs using safe-navigation checks (o.Customer?.Name ?? "Unknown Customer").

🔍 Verification & Integrity

  • Verified clean schema updates locally via dotnet ef database update.
  • All project layers (API, Application, Infrastructure, Tests) build and compile with 100% success.

@vercel

vercel Bot commented May 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mysupplychain Ready Ready Preview, Comment May 29, 2026 12:57am

@austinchima austinchima temporarily deployed to feature/multi-tenancy-and-ux-upgrades - mysupplychain-api PR #10 May 29, 2026 00:56 — with Render Destroyed
@austinchima austinchima merged commit 7ae36bb into main May 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant