How joaovictorbarrera/assetmanagementsystem works
1. High-level shape
- This repository is a two-part system: an Angular frontend in client/ and an ASP.NET Core API backend in server/.
- The frontend is the user-facing portal; the backend owns business rules, authentication, persistence, and data shaping.
2. Frontend application shell
- The Angular app is organized around a root app config/routes setup (app.config.ts, app.routes.ts) and a shared main layout (core/layout/main-layout).
- The layout splits into persistent navigation pieces like navbar and sidebar, with page content swapped by routing.
3. Frontend feature pages
- The main user flows are separated into pages for dashboard, inventory, requests, review, users, login, and unauthorized.
- Each page has its own local table/row components, which suggests the UI is table-driven and feature-specific rather than a single generic grid.
4. Frontend reusable UI layer
- Shared components under core/components cover common interactions: drawers for create/detail forms, search bar, dropdown, submit button, table header/pagination/wrapper, page header/wrapper, and a loading spinner.
- This indicates a design centered on reusable presentation blocks and slide-out detail/edit experiences.
5. Frontend data contract layer
- The Angular client defines DTOs under core/DTOs for assets, checkout requests, users, and shared pagination structures.
- These DTOs mirror the backend response/request shapes, making the API contract an explicit architectural boundary.
6. Frontend state, behavior, and cross-cutting concerns
- API access is split into dedicated services under core/services/api for assets, auth, checkout requests, and users.
- Event services (core/services/events) likely coordinate refresh/update signals between drawers, tables, and pages; utility services handle drawers and page loading.
- Guards (auth.guard.ts, role.guard.ts) and the HTTP interceptor enforce authentication and role-based access on the client side.
7. Backend API boundary
- The backend exposes REST-style controllers for assets, auth, checkout requests, users, plus an EchoController for basic connectivity/testing.
- ApiControllerBase suggests a shared controller foundation for consistent routing or response handling.
8. Backend application/services layer
- Business logic is centralized in Services/ with separate services for assets, checkout requests, users, and token generation.
- ServiceResult indicates service methods return structured success/failure outcomes instead of throwing domain details directly through controllers.
9. Backend repository/data access layer
- Models/Repositories provides repositories for assets, checkout requests, and users, which sit beneath the services.
- This creates a clear separation: controllers handle HTTP, services enforce workflows, repositories handle persistence queries.
10. Backend domain model
- Core entities are Asset, AssetHistory, CheckoutRequest, and User.
- Enums define business state: asset category, condition, status; checkout request status and type; and user role.
11. Persistence and schema management
- AppDbContext, EF Core migrations, and seed data show a database-backed system with versioned schema evolution.
- Seed migrations populate initial users, assets, and requests, so the app likely boots with meaningful demo/operational data.
12. Auth and authorization flow
- Authentication is API-backed via AuthController, LoginRequest, and TokenDto, with token generation handled by TokenService.
- Authorization is role-aware on both sides: backend roles/enforcement helpers and frontend auth/role guards ensure restricted areas like user/admin workflows are protected.
13. Primary business flows
- Assets: list, create, update fields/status/category/condition, view detail and history, and fetch available assets.
- Checkout requests: create requests, list/filter them, assign assets, and inspect request detail.
- Users: create users, list users, and update active/role state.
- The dashboard/inventory/review pages are likely different views over these same domain objects and states.
14. Data flow between tiers
- User actions start in Angular pages/components, invoke API services, pass DTOs to the backend, and receive paginated or detail responses.
- The backend transforms entities into response DTOs/projections, applies business rules, persists through EF Core, and returns shaped data for table/drawer rendering.
15. Deployment/runtime boundaries
- The frontend is deployed on Vercel and the API on Railway, per the README links.
- The backend is an ASP.NET Core application with Swagger exposed for API exploration, while the client is an Angular app built and served separately.
Main entry points: app.config.ts App shell · services API services · components Shared UI · Services Services
Components 20
Angular client
User-facing SPA, shared UI, page flows, and API contract/services.
- App shell · Root app config, routes, and global shell entrypoints.
client/src/app/app.config.ts - Main layout · Persistent navbar/sidebar frame around routed pages.
client/src/app/core/layout/main-layout - Dashboard · Asset overview and summary table view.
client/src/app/pages/dashboard - Inventory · Asset inventory browsing and row actions.
client/src/app/pages/inventory - Requests · Checkout request list and management flow.
client/src/app/pages/requests - Review · Request review/approval workflow view.
client/src/app/pages/review - Users · User administration and role/active-state management.
client/src/app/pages/users - Login & access · Login and unauthorized access screens.
client/src/app/pages/login - Shared UI · Drawers, tables, headers, pagination, search, dropdowns, and loading states.
client/src/app/core/components - DTOs · Client-side request/response models for assets, checkout requests, users, and pagination.
client/src/app/core/DTOs - API services · Typed API clients plus event/util services for refresh, drawer, and loading coordination.
client/src/app/core/services - Guards & auth · Route guards and HTTP interceptor enforcing authentication and roles.
client/src/app/core/guards
ASP.NET Core API
REST API, business services, repositories, and persistence.
- Controllers · HTTP boundary for assets, auth, checkout requests, users, and echo.
server/Controllers - Services · Workflow and validation layer for assets, checkout requests, users, and tokens.
server/Services - Repositories · Persistence-focused repositories for domain entities.
server/Models/Repositories - Domain model · Core entities and business states for assets, requests, and users.
server/Models/Entities - Server DTOs · API request, response, and projection shapes used at the HTTP boundary.
server/DTOs - Auth flow · Login request handling and token generation/role claims.
server/DTOs/Auth - Db context · EF Core context, migrations, and seed data for schema and initial records.
server/Data/AppDbContext.cs - Hosting setup · Program startup and service/web app extensions wiring the API runtime.
server/Program.cs
Connections 29
- App shell → Main layout: renders · The routed app is framed by the persistent main layout.
- App shell → Dashboard: routes to · Root routes include the dashboard page.
- App shell → Inventory: routes to · Root routes include the inventory page.
- App shell → Requests: routes to · Root routes include the requests page.
- App shell → Review: routes to · Root routes include the review page.
- App shell → Users: routes to · Root routes include the users page.
- App shell → Login & access: routes to · Root routes include login and unauthorized screens.
- Main layout → Shared UI: uses · Layout composes shared navigation and page primitives.
- Dashboard → API services: loads data via · Dashboard page fetches assets and refresh signals through services.
- Inventory → API services: loads data via · Inventory page uses asset API and UI coordination services.
- Requests → API services: loads data via · Requests page uses checkout request API and events services.
- Review → API services: loads data via · Review page uses checkout request API and events services.
- Users → API services: loads data via · Users page uses user API and events services.
- Dashboard → Shared UI: composes · Feature pages assemble shared table and page components.
- Inventory → Shared UI: composes · Feature pages assemble shared table and page components.
- Requests → Shared UI: composes · Feature pages assemble shared table and page components.
- Review → Shared UI: composes · Feature pages assemble shared table and page components.
- Users → Shared UI: composes · Feature pages assemble shared table and page components.
- API services → DTOs: uses · API services serialize and deserialize typed DTOs.
- Guards & auth → App shell: protects routes · Guards and interceptor enforce authenticated and role-aware access.
- Hosting setup → Controllers: wires · Startup config exposes the HTTP endpoints.
- Controllers → Services: delegates to · Controllers pass requests into application services.
- Services → Repositories: queries · Services use repositories for persistence and retrieval.
- Repositories → Db context: persists via · Repositories run through the EF Core context.
- Services → Domain model: operates on · Business rules are centered on entities and enums.
- Controllers → Server DTOs: accepts/returns · HTTP endpoints shape inputs and outputs with DTOs.
- Services → Auth flow: issues tokens · Token service supports login and authorization flow.
- API services → Controllers: calls API · Angular API clients communicate with the backend REST endpoints.
- Login & access → Auth flow: authenticates against · Login UI uses the auth endpoint and token response.