How dyani101/asiphe-fe-assessment works
Project Type and Purpose
• This is a single-page front-end application built with Angular (v14) generated by Angular CLI.
• It manages “customers” and “quotes” (spelled “qoutes” in code), exposing UI for listing, details, dialogs, and forms.
• It uses NgRx (store/actions/reducers/effects) for state management and local JSON files as data sources (assets/customers.json, assets/qoutes.json).
High-Level File Structure Analysis
• src/app
– app.module.ts, app-routing.module.ts: the root module and routing configuration.
– components/: feature modular components for customer and quote management (with their own modules, routing, views, styles, and specs).
– services/: HTTP/data services (QouteService) handling data fetch.
– store/: NgRx state management separated into customer and quote domains (actions, reducers, effects, selectors, state).
– models/: TypeScript interfaces/models for Customer and Quote.
• src/assets: local JSON data to simulate backend (customers.json, qoutes.json).
• environments/: environment.ts/prod: base URLs or flags (if real backend were used).
Core Components and Interactions
a. UI Layer (Components)
– CustomerManagementModule + QuoteManagementModule
– CustomerDetailComponent, dialogs (ConfirmDialog, CustomerDialog)
b. State Layer (NgRx Store)
– CustomerStore: customer.actions → customer.effects → service → customer.reducer → customer.selectors
– QuoteStore: analogous flow
c. Services Layer
– QouteService: fetches JSON from assets or calls HTTP API
d. Data Layer (Assets/Backend)
– Local JSON files or external REST endpoints
e. Angular Core
– Router: navigates between customer and quote views
– HttpClientModule: injected into services
Architectural Patterns and Design Principles
• Separation of Concerns: UI vs State vs Data Services.
• Redux Pattern via NgRx: unidirectional data flow (Actions → Effects → Reducers → Selectors → UI).
• Feature Modules: lazy-loadable modules for customer and quote management.
• Component-Based UI: small reusable components and dialogs.
• Environment-based configuration (prod vs dev).
What
• State Management (grouped): CustomerActions, CustomerEffects, CustomerReducer, CustomerSelectors; similarly for Quote.
• Services: QouteService (and any future CustomerService).
• Data Source: assets/customers.json & assets/qoutes.json or backend API.
– UI Components → dispatch Actions → Store
– Actions → Effects → Service calls → Data Source → Effects dispatch Success/Failure Actions
– Reducers update State → Selectors feed data back to Components
– Router directs navigation between feature modules
– Blue rectangles for UI components
– Yellow parallelograms for services
– Gray database symbols for JSON/REST data