Complete implementation of the Goa Government e-Licensing platform with: Backend: - NestJS API with JWT authentication - PostgreSQL database with Knex ORM - Redis caching and session management - MinIO document storage - Hyperledger Besu blockchain integration - Multi-department workflow system - Comprehensive API tests (266/282 passing) Frontend: - Angular 21 with standalone components - Angular Material + TailwindCSS UI - Visual workflow builder - Document upload with progress tracking - Blockchain explorer integration - Role-based dashboards (Admin, Department, Citizen) - E2E tests with Playwright (37 tests) Infrastructure: - Docker Compose orchestration - Blockscout blockchain explorer - Development and production configurations
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { RequestType } from '../enums';
|
|
import { REQUEST_NUMBER_PREFIX } from '../constants';
|
|
|
|
export class RequestNumberUtil {
|
|
/**
|
|
* Generate unique request number
|
|
* Format: {PREFIX}-{YEAR}-{SEQUENCE}
|
|
* Example: RL-2024-000001
|
|
*/
|
|
static generate(requestType: RequestType, sequence: number): string {
|
|
const prefix = REQUEST_NUMBER_PREFIX[requestType] || 'RQ';
|
|
const year = new Date().getFullYear();
|
|
const paddedSequence = sequence.toString().padStart(6, '0');
|
|
return `${prefix}-${year}-${paddedSequence}`;
|
|
}
|
|
|
|
/**
|
|
* Parse request number to extract components
|
|
*/
|
|
static parse(requestNumber: string): {
|
|
prefix: string;
|
|
year: number;
|
|
sequence: number;
|
|
} | null {
|
|
const match = requestNumber.match(/^([A-Z]+)-(\d{4})-(\d+)$/);
|
|
if (!match) return null;
|
|
|
|
return {
|
|
prefix: match[1],
|
|
year: parseInt(match[2], 10),
|
|
sequence: parseInt(match[3], 10),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Validate request number format
|
|
*/
|
|
static isValid(requestNumber: string): boolean {
|
|
return /^[A-Z]+-\d{4}-\d{6}$/.test(requestNumber);
|
|
}
|
|
}
|