5.6 KiB
5.6 KiB
Quick Start: Skip & Add Approver Features
🚀 Setup (One-Time)
Step 1: Run Database Migration
# Connect to database
psql -U postgres -d re_workflow
# Run migration
\i Re_Backend/src/migrations/add_is_skipped_to_approval_levels.sql
# Verify columns added
\d approval_levels
# Should show: is_skipped, skipped_at, skipped_by, skip_reason
Step 2: Restart Backend
cd Re_Backend
npm run dev
📖 User Guide
How to Skip an Approver (Initiator/Approver)
- Go to Request Detail → Workflow tab
- Find the approver who is pending/in-review
- Click "Skip This Approver" button
- Enter reason (e.g., "On vacation")
- Click OK
Result:
- ✅ Approver marked as SKIPPED
- ✅ Next approver becomes active
- ✅ Notification sent to next approver
- ✅ Activity logged
How to Add New Approver (Initiator/Approver)
- Go to Request Detail → Quick Actions
- Click "Add Approver"
- Review Current Levels (shows all existing approvers with status)
- Select Approval Level (where to insert new approver)
- Enter TAT Hours (e.g., 48)
- Enter Email (use @ to search:
@john) - Click "Add at Level X"
Result:
- ✅ New approver inserted at chosen level
- ✅ Existing approvers shifted automatically
- ✅ TAT jobs scheduled if level is active
- ✅ Notification sent to new approver
- ✅ Activity logged
🎯 Examples
Example 1: Skip Non-Responding Approver
Scenario: Mike (Level 2) hasn't responded for 3 days, deadline approaching
Steps:
- Open request REQ-2025-001
- Go to Workflow tab
- Find Mike's card (Level 2 - In Review)
- Click "Skip This Approver"
- Reason: "Approver on extended leave - deadline critical"
- Confirm
Result:
Before: After:
Level 1: Sarah ✅ Level 1: Sarah ✅
Level 2: Mike ⏳ → Level 2: Mike ⏭️ (SKIPPED)
Level 3: Lisa ⏸️ Level 3: Lisa ⏳ (ACTIVE!)
Example 2: Add Finance Review
Scenario: Need Finance Manager approval between existing levels
Steps:
- Click "Add Approver" in Quick Actions
- See current levels:
- Level 1: Sarah (Approved)
- Level 2: Mike (In Review)
- Level 3: Lisa (Waiting)
- Select Level: 3 (to insert before Lisa)
- TAT Hours: 48
- Email:
@john→ Select "John Doe (john@finance.com)" - Click "Add at Level 3"
Result:
Before: After:
Level 1: Sarah ✅ Level 1: Sarah ✅
Level 2: Mike ⏳ Level 2: Mike ⏳
Level 3: Lisa ⏸️ → Level 3: John ⏸️ (NEW!)
Level 4: Lisa ⏸️ (shifted)
⚙️ API Reference
Skip Approver
POST /api/v1/workflows/:requestId/approvals/:levelId/skip
Headers:
Authorization: Bearer <token>
Body:
{
"reason": "Approver on vacation"
}
Response:
{
"success": true,
"message": "Approver skipped successfully"
}
Add Approver at Level
POST /api/v1/workflows/:requestId/approvers/at-level
Headers:
Authorization: Bearer <token>
Body:
{
"email": "john@example.com",
"tatHours": 48,
"level": 3
}
Response:
{
"success": true,
"message": "Approver added successfully",
"data": {
"levelId": "...",
"levelNumber": 3,
"approverName": "John Doe",
"tatHours": 48
}
}
🛡️ Permissions
| Action | Who Can Do It |
|---|---|
| Skip Approver | ✅ INITIATOR, ✅ APPROVER |
| Add Approver | ✅ INITIATOR, ✅ APPROVER |
| View Skip Reason | ✅ All participants |
⚠️ Limitations
| Limitation | Reason |
|---|---|
| Cannot skip approved levels | Data integrity |
| Cannot skip rejected levels | Already closed |
| Cannot skip already skipped levels | Already handled |
| Cannot skip future levels | Not yet active |
| Cannot add before completed levels | Would break workflow state |
| Must provide valid TAT (1-720h) | Business rules |
📊 Dashboard Impact
Skipped Approvers in Reports:
-- Count skipped approvers
SELECT COUNT(*)
FROM approval_levels
WHERE is_skipped = TRUE;
-- Find requests with skipped levels
SELECT r.request_number, al.level_number, al.approver_name, al.skip_reason
FROM workflow_requests r
JOIN approval_levels al ON r.request_id = al.request_id
WHERE al.is_skipped = TRUE;
KPIs Affected:
- Avg Approval Time - Skipped levels excluded from calculation
- Approver Response Rate - Skipped marked separately
- Workflow Bottlenecks - Identify frequently skipped approvers
🔍 Troubleshooting
"Cannot skip approver - level is already APPROVED"
- The level has already been approved
- You cannot skip completed levels
"Cannot skip future approval levels"
- You're trying to skip a level that hasn't been reached yet
- Only current level can be skipped
"Cannot add approver at level X. Minimum allowed level is Y"
- You're trying to add before a completed level
- Must add after all approved/rejected/skipped levels
"User is already a participant in this request"
- The user is already an approver, initiator, or spectator
- Cannot add same user twice
✅ Testing Checklist
- Run database migration
- Restart backend server
- Create test workflow with 3 approvers
- Approve Level 1
- Skip Level 2 (test skip functionality)
- Verify Level 3 becomes active
- Add new approver at Level 3 (test add functionality)
- Verify levels shifted correctly
- Check activity log shows both actions
- Verify notifications sent correctly
Ready to use! 🎉