mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
feat(crm): add crm-data-access library with initial component and tests
- Introduced the crm-data-access library with a basic component. - Added necessary configuration files, including ESLint and TypeScript settings. - Implemented unit tests for the component to ensure functionality. Refs: #5254
This commit is contained in:
9
.vscode/settings.json
vendored
9
.vscode/settings.json
vendored
@@ -87,6 +87,11 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"nxConsole.generateAiAgentRules": true,
|
"nxConsole.generateAiAgentRules": true,
|
||||||
"chat.mcp.enabled": true,
|
"chat.mcp.discovery.enabled": {
|
||||||
"chat.mcp.discovery.enabled": true
|
"claude-desktop": true,
|
||||||
|
"windsurf": true,
|
||||||
|
"cursor-global": true,
|
||||||
|
"cursor-workspace": true
|
||||||
|
},
|
||||||
|
"chat.mcp.access": "all"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,128 +1,136 @@
|
|||||||
# Tech Stack Documentation
|
# Tech Stack Documentation
|
||||||
|
|
||||||
## Core Technologies
|
## Core Technologies
|
||||||
|
|
||||||
### Frontend Framework
|
### Frontend Framework
|
||||||
|
|
||||||
- **[Angular](https://angular.dev/overview)** (Latest Version)
|
- **[Angular](https://angular.dev/overview)** (Latest Version)
|
||||||
- Modern web framework for building scalable single-page applications
|
- Modern web framework for building scalable single-page applications
|
||||||
- Leverages TypeScript for enhanced type safety and developer experience
|
- Leverages TypeScript for enhanced type safety and developer experience
|
||||||
|
|
||||||
### State Management
|
### State Management
|
||||||
|
|
||||||
- **[NgRx](https://ngrx.io/docs)**
|
- **[NgRx](https://ngrx.io/docs)**
|
||||||
- Redux-inspired state management for Angular applications
|
- Redux-inspired state management for Angular applications
|
||||||
- Provides predictable state container and powerful dev tools
|
- Provides predictable state container and powerful dev tools
|
||||||
- Used for managing complex application state and side effects
|
- Used for managing complex application state and side effects
|
||||||
|
|
||||||
### Styling
|
### Styling
|
||||||
|
|
||||||
- **[Tailwind CSS](https://tailwindcss.com/)**
|
- **[Tailwind CSS](https://tailwindcss.com/)**
|
||||||
- Utility-first CSS framework
|
- Utility-first CSS framework
|
||||||
- Enables rapid UI development with pre-built classes
|
- Enables rapid UI development with pre-built classes
|
||||||
- Highly customizable through configuration
|
- Highly customizable through configuration
|
||||||
|
|
||||||
## Development Tools
|
## Development Tools
|
||||||
|
|
||||||
### Language
|
### Language
|
||||||
|
|
||||||
- **[TypeScript](https://www.typescriptlang.org/docs/handbook/intro.html)**
|
- **[TypeScript](https://www.typescriptlang.org/docs/handbook/intro.html)**
|
||||||
- Strongly typed programming language
|
- Strongly typed programming language
|
||||||
- Provides enhanced IDE support and compile-time error checking
|
- Provides enhanced IDE support and compile-time error checking
|
||||||
- Used throughout the entire application
|
- Used throughout the entire application
|
||||||
|
|
||||||
### Runtime
|
### Runtime
|
||||||
|
|
||||||
- **[Node.js](https://nodejs.org/docs/latest-v22.x/api/index.html)**
|
- **[Node.js](https://nodejs.org/docs/latest-v22.x/api/index.html)**
|
||||||
- JavaScript runtime environment
|
- JavaScript runtime environment
|
||||||
- Used for development server and build tools
|
- Used for development server and build tools
|
||||||
- Required for running npm scripts and development tools
|
- Required for running npm scripts and development tools
|
||||||
|
|
||||||
### Testing Framework
|
### Testing Framework
|
||||||
|
|
||||||
- **[Jest](https://jestjs.io/docs/getting-started)**
|
- **[Jest](https://jestjs.io/docs/getting-started)**
|
||||||
|
|
||||||
- Primary testing framework
|
- Primary testing framework
|
||||||
- Used for unit and integration tests
|
- Used for unit and integration tests
|
||||||
- Provides snapshot testing capabilities
|
- Provides snapshot testing capabilities
|
||||||
|
|
||||||
- **[Spectator](https://ngneat.github.io/spectator/)**
|
- **[Spectator](https://ngneat.github.io/spectator/)**
|
||||||
- Angular testing utility library
|
- Angular testing utility library
|
||||||
- Simplifies component testing
|
- Simplifies component testing
|
||||||
- Reduces boilerplate in test files
|
- Reduces boilerplate in test files
|
||||||
|
|
||||||
### UI Development
|
### UI Development
|
||||||
|
|
||||||
- **[Storybook](https://storybook.js.org/docs/get-started/frameworks/angular)**
|
- **[Storybook](https://storybook.js.org/docs/get-started/frameworks/angular)**
|
||||||
- UI component development environment
|
- UI component development environment
|
||||||
- Enables isolated component development
|
- Enables isolated component development
|
||||||
- Serves as living documentation for components
|
- Serves as living documentation for components
|
||||||
|
|
||||||
### Utilities
|
### Utilities
|
||||||
|
|
||||||
- **[date-fns](https://date-fns.org/docs/Getting-Started)**
|
- **[date-fns](https://date-fns.org/docs/Getting-Started)**
|
||||||
- Modern JavaScript date utility library
|
- Modern JavaScript date utility library
|
||||||
- Used for consistent date formatting and manipulation
|
- Used for consistent date formatting and manipulation
|
||||||
- Tree-shakeable to optimize bundle size
|
- Tree-shakeable to optimize bundle size
|
||||||
- **[Lodash](https://lodash.com/)**
|
- **[Lodash](https://lodash.com/)**
|
||||||
- Utility library for common JavaScript tasks
|
- Utility library for common JavaScript tasks
|
||||||
- **[UUID](https://www.npmjs.com/package/uuid)**
|
- **[UUID](https://www.npmjs.com/package/uuid)**
|
||||||
- Generates unique identifiers
|
- Generates unique identifiers
|
||||||
- **[Zod](https://github.com/colinhacks/zod)**
|
- **[Zod](https://github.com/colinhacks/zod)**
|
||||||
- TypeScript-first schema validation library
|
- TypeScript-first schema validation library
|
||||||
|
|
||||||
## Additional Technical Areas
|
## Additional Technical Areas
|
||||||
|
|
||||||
### Authentication & Authorization
|
### Authentication & Authorization
|
||||||
|
|
||||||
- **[angular-oauth2-oidc](https://github.com/manfredsteyer/angular-oauth2-oidc)**
|
- **[angular-oauth2-oidc](https://github.com/manfredsteyer/angular-oauth2-oidc)**
|
||||||
- Simplifies implementing OAuth2 and OIDC authentication in Angular.
|
- Simplifies implementing OAuth2 and OIDC authentication in Angular.
|
||||||
- **[angular-oauth2-oidc-jwks](https://github.com/manfredsteyer/angular-oauth2-oidc)**
|
- **[angular-oauth2-oidc-jwks](https://github.com/manfredsteyer/angular-oauth2-oidc)**
|
||||||
- Adds JWKS support for secure token management.
|
- Adds JWKS support for secure token management.
|
||||||
|
|
||||||
### Real-Time Communication
|
### Real-Time Communication
|
||||||
|
|
||||||
- **[@microsoft/signalr](https://www.npmjs.com/package/@microsoft/signalr)**
|
- **[@microsoft/signalr](https://www.npmjs.com/package/@microsoft/signalr)**
|
||||||
- Provides real-time communication between client and server components.
|
- Provides real-time communication between client and server components.
|
||||||
|
|
||||||
### Barcode Scanning
|
### Barcode Scanning
|
||||||
|
|
||||||
- **[Scandit Web Data Capture Barcode](https://www.scandit.com/documentation/web/)**
|
- **[Scandit Web Data Capture Barcode](https://www.scandit.com/documentation/web/)**
|
||||||
- Robust barcode scanning capabilities integrated into the application.
|
- Robust barcode scanning capabilities integrated into the application.
|
||||||
- **[Scandit Web Data Capture Core](https://www.scandit.com/documentation/web/)**
|
- **[Scandit Web Data Capture Core](https://www.scandit.com/documentation/web/)**
|
||||||
- Core library supporting the barcode scanning features.
|
- Core library supporting the barcode scanning features.
|
||||||
|
|
||||||
### Tooling
|
### Tooling
|
||||||
|
|
||||||
- **[Nx](https://nx.dev/)**
|
- **[Nx](https://nx.dev/)**
|
||||||
- Powerful monorepo tool for Angular and other frontend applications.
|
- Powerful monorepo tool for Angular and other frontend applications.
|
||||||
- **[Husky](https://typicode.github.io/husky/#/)**
|
- **[Husky](https://typicode.github.io/husky/#/)**
|
||||||
- Manages Git hooks for consistent developer workflows.
|
- Manages Git hooks for consistent developer workflows.
|
||||||
- **[ESLint](https://eslint.org/) & [Prettier](https://prettier.io/)**
|
- **[ESLint](https://eslint.org/) & [Prettier](https://prettier.io/)**
|
||||||
- Linting and formatting tools to maintain consistent code quality.
|
- Linting and formatting tools to maintain consistent code quality.
|
||||||
- **[Storybook](https://storybook.js.org/)**
|
- **[Storybook](https://storybook.js.org/)**
|
||||||
- Isolated component development and living documentation environment.
|
- Isolated component development and living documentation environment.
|
||||||
|
|
||||||
## Development Environment Setup
|
## Domain Libraries
|
||||||
|
|
||||||
1. **Required Software**
|
### Customer Relationship Management (CRM)
|
||||||
|
|
||||||
- Node.js (Latest LTS version)
|
- **`@isa/crm/data-access`**
|
||||||
- npm (comes with Node.js)
|
- Handles data access logic for customer-related features.
|
||||||
- Git
|
- Contains services for fetching and managing customer data.
|
||||||
|
|
||||||
2. **IDE Recommendations**
|
## Development Environment Setup
|
||||||
|
|
||||||
- Visual Studio Code with following extensions:
|
1. **Required Software**
|
||||||
- Angular Language Service
|
|
||||||
- ESLint
|
- Node.js (Latest LTS version)
|
||||||
- Prettier
|
- npm (comes with Node.js)
|
||||||
- Tailwind CSS IntelliSense
|
- Git
|
||||||
|
|
||||||
3. **Getting Started**
|
2. **IDE Recommendations**
|
||||||
```bash
|
|
||||||
npm install # Install dependencies
|
- Visual Studio Code with following extensions:
|
||||||
npm run start # Start development server
|
- Angular Language Service
|
||||||
npm run test # Run tests
|
- ESLint
|
||||||
npm run storybook # Start Storybook
|
- Prettier
|
||||||
```
|
- Tailwind CSS IntelliSense
|
||||||
|
|
||||||
|
3. **Getting Started**
|
||||||
|
```bash
|
||||||
|
npm install # Install dependencies
|
||||||
|
npm run start # Start development server
|
||||||
|
npm run test # Run tests
|
||||||
|
npm run storybook # Start Storybook
|
||||||
|
```
|
||||||
|
|||||||
7
libs/crm/data-access/README.md
Normal file
7
libs/crm/data-access/README.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# crm-data-access
|
||||||
|
|
||||||
|
This library was generated with [Nx](https://nx.dev).
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
Run `nx test crm-data-access` to execute the unit tests.
|
||||||
34
libs/crm/data-access/eslint.config.cjs
Normal file
34
libs/crm/data-access/eslint.config.cjs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
const nx = require('@nx/eslint-plugin');
|
||||||
|
const baseConfig = require('../../../eslint.config.js');
|
||||||
|
|
||||||
|
module.exports = [
|
||||||
|
...baseConfig,
|
||||||
|
...nx.configs['flat/angular'],
|
||||||
|
...nx.configs['flat/angular-template'],
|
||||||
|
{
|
||||||
|
files: ['**/*.ts'],
|
||||||
|
rules: {
|
||||||
|
'@angular-eslint/directive-selector': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
type: 'attribute',
|
||||||
|
prefix: 'crm',
|
||||||
|
style: 'camelCase',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'@angular-eslint/component-selector': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
type: 'element',
|
||||||
|
prefix: 'crm',
|
||||||
|
style: 'kebab-case',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.html'],
|
||||||
|
// Override or add rules here
|
||||||
|
rules: {},
|
||||||
|
},
|
||||||
|
];
|
||||||
20
libs/crm/data-access/project.json
Normal file
20
libs/crm/data-access/project.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "crm-data-access",
|
||||||
|
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||||
|
"sourceRoot": "libs/crm/data-access/src",
|
||||||
|
"prefix": "crm",
|
||||||
|
"projectType": "library",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"test": {
|
||||||
|
"executor": "@nx/vite:test",
|
||||||
|
"outputs": ["{options.reportsDirectory}"],
|
||||||
|
"options": {
|
||||||
|
"reportsDirectory": "../../../coverage/libs/crm/data-access"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nx/eslint:lint"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
libs/crm/data-access/src/index.ts
Normal file
1
libs/crm/data-access/src/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './lib/crm-data-access/crm-data-access.component';
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<p>CrmDataAccess works!</p>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { CrmDataAccessComponent } from './crm-data-access.component';
|
||||||
|
|
||||||
|
describe('CrmDataAccessComponent', () => {
|
||||||
|
let component: CrmDataAccessComponent;
|
||||||
|
let fixture: ComponentFixture<CrmDataAccessComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [CrmDataAccessComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(CrmDataAccessComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'crm-crm-data-access',
|
||||||
|
imports: [CommonModule],
|
||||||
|
templateUrl: './crm-data-access.component.html',
|
||||||
|
styleUrl: './crm-data-access.component.css',
|
||||||
|
})
|
||||||
|
export class CrmDataAccessComponent {}
|
||||||
13
libs/crm/data-access/src/test-setup.ts
Normal file
13
libs/crm/data-access/src/test-setup.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import '@angular/compiler';
|
||||||
|
import '@analogjs/vitest-angular/setup-zone';
|
||||||
|
|
||||||
|
import {
|
||||||
|
BrowserTestingModule,
|
||||||
|
platformBrowserTesting,
|
||||||
|
} from '@angular/platform-browser/testing';
|
||||||
|
import { getTestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
getTestBed().initTestEnvironment(
|
||||||
|
BrowserTestingModule,
|
||||||
|
platformBrowserTesting(),
|
||||||
|
);
|
||||||
30
libs/crm/data-access/tsconfig.json
Normal file
30
libs/crm/data-access/tsconfig.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"importHelpers": true,
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"module": "preserve"
|
||||||
|
},
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"strictInputAccessModifiers": true,
|
||||||
|
"typeCheckHostBindings": true,
|
||||||
|
"strictTemplates": true
|
||||||
|
},
|
||||||
|
"files": [],
|
||||||
|
"include": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.lib.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.spec.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
27
libs/crm/data-access/tsconfig.lib.json
Normal file
27
libs/crm/data-access/tsconfig.lib.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../../dist/out-tsc",
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true,
|
||||||
|
"inlineSources": true,
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/test-setup.ts",
|
||||||
|
"jest.config.ts",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"vite.config.ts",
|
||||||
|
"vite.config.mts",
|
||||||
|
"vitest.config.ts",
|
||||||
|
"vitest.config.mts",
|
||||||
|
"src/**/*.test.tsx",
|
||||||
|
"src/**/*.spec.tsx",
|
||||||
|
"src/**/*.test.js",
|
||||||
|
"src/**/*.spec.js",
|
||||||
|
"src/**/*.test.jsx",
|
||||||
|
"src/**/*.spec.jsx"
|
||||||
|
],
|
||||||
|
"include": ["src/**/*.ts"]
|
||||||
|
}
|
||||||
29
libs/crm/data-access/tsconfig.spec.json
Normal file
29
libs/crm/data-access/tsconfig.spec.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../../dist/out-tsc",
|
||||||
|
"types": [
|
||||||
|
"vitest/globals",
|
||||||
|
"vitest/importMeta",
|
||||||
|
"vite/client",
|
||||||
|
"node",
|
||||||
|
"vitest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"vite.config.ts",
|
||||||
|
"vite.config.mts",
|
||||||
|
"vitest.config.ts",
|
||||||
|
"vitest.config.mts",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"src/**/*.spec.ts",
|
||||||
|
"src/**/*.test.tsx",
|
||||||
|
"src/**/*.spec.tsx",
|
||||||
|
"src/**/*.test.js",
|
||||||
|
"src/**/*.spec.js",
|
||||||
|
"src/**/*.test.jsx",
|
||||||
|
"src/**/*.spec.jsx",
|
||||||
|
"src/**/*.d.ts"
|
||||||
|
],
|
||||||
|
"files": ["src/test-setup.ts"]
|
||||||
|
}
|
||||||
27
libs/crm/data-access/vite.config.mts
Normal file
27
libs/crm/data-access/vite.config.mts
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/// <reference types='vitest' />
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import angular from '@analogjs/vite-plugin-angular';
|
||||||
|
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
||||||
|
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
||||||
|
|
||||||
|
export default defineConfig(() => ({
|
||||||
|
root: __dirname,
|
||||||
|
cacheDir: '../../../node_modules/.vite/libs/crm/data-access',
|
||||||
|
plugins: [angular(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
||||||
|
// Uncomment this if you are using workers.
|
||||||
|
// worker: {
|
||||||
|
// plugins: [ nxViteTsPaths() ],
|
||||||
|
// },
|
||||||
|
test: {
|
||||||
|
watch: false,
|
||||||
|
globals: true,
|
||||||
|
environment: 'jsdom',
|
||||||
|
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
||||||
|
setupFiles: ['src/test-setup.ts'],
|
||||||
|
reporters: ['default'],
|
||||||
|
coverage: {
|
||||||
|
reportsDirectory: '../../../coverage/libs/crm/data-access',
|
||||||
|
provider: 'v8' as const,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}));
|
||||||
@@ -48,6 +48,7 @@
|
|||||||
"@isa/core/notifications": ["libs/core/notifications/src/index.ts"],
|
"@isa/core/notifications": ["libs/core/notifications/src/index.ts"],
|
||||||
"@isa/core/storage": ["libs/core/storage/src/index.ts"],
|
"@isa/core/storage": ["libs/core/storage/src/index.ts"],
|
||||||
"@isa/core/tabs": ["libs/core/tabs/src/index.ts"],
|
"@isa/core/tabs": ["libs/core/tabs/src/index.ts"],
|
||||||
|
"@isa/crm/data-access": ["libs/crm/data-access/src/index.ts"],
|
||||||
"@isa/icons": ["libs/icons/src/index.ts"],
|
"@isa/icons": ["libs/icons/src/index.ts"],
|
||||||
"@isa/oms/data-access": ["libs/oms/data-access/src/index.ts"],
|
"@isa/oms/data-access": ["libs/oms/data-access/src/index.ts"],
|
||||||
"@isa/oms/feature/return-details": [
|
"@isa/oms/feature/return-details": [
|
||||||
|
|||||||
Reference in New Issue
Block a user