How projected1/deel-challenge works
┌─ API Layer ─────────────────────┐
• (routes.mjs) │
• Middleware Layer ──────────────┤
• (getProfile.mjs) │
• Controller Layer ─────────────┤
• (Various controllers) │
• Service Layer ───────────────┤
• (Business Logic) │
• Repository Layer ────────────┤
• (Data Access) │
• Database Layer ─────────────┘
Component Details
a) External Interface:
• REST endpoints from the README (/contracts, /jobs, /balances, /admin)
• Authentication header (profile_id)
• Controllers (Rectangle): adminController, balanceController, contractController, jobController
• Services (Hexagon): Corresponding service files for business logic
• Error Handling (Triangle): Custom error classes
Request flow through the system:
Client Request → API Routes → Middleware → Controller → Service → Repository → Database
Key Technical Elements
• Node.js/Express.js framework
• Sequelize ORM
• SQLite database
• Authentication middleware
Additional Elements
Include:
• Database schema relationships (Profile ↔ Contract ↔ Job)
• Authentication flow
• Error handling paths
• Important business rules (e.g., 25% deposit limit, payment conditions)
Specific Implementation Details
Specialized components for:
• Balance management
• Contract status handling
• Job payment processing
• Admin statistics calculation