-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathverify-admin-analytics.sh
More file actions
executable file
·132 lines (110 loc) · 6.28 KB
/
verify-admin-analytics.sh
File metadata and controls
executable file
·132 lines (110 loc) · 6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
# Admin Analytics Verification Script
# This script verifies that the admin analytics module is properly installed
echo "╔══════════════════════════════════════════════════════════════════════════════╗"
echo "║ Admin Analytics Module - Installation Verification ║"
echo "╚══════════════════════════════════════════════════════════════════════════════╝"
echo ""
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Counters
PASSED=0
FAILED=0
# Function to check file exists
check_file() {
if [ -f "$1" ]; then
echo -e "${GREEN}✓${NC} $2"
((PASSED++))
else
echo -e "${RED}✗${NC} $2 - File not found: $1"
((FAILED++))
fi
}
# Function to check directory exists
check_dir() {
if [ -d "$1" ]; then
echo -e "${GREEN}✓${NC} $2"
((PASSED++))
else
echo -e "${RED}✗${NC} $2 - Directory not found: $1"
((FAILED++))
fi
}
# Function to check string in file
check_string_in_file() {
if grep -q "$2" "$1" 2>/dev/null; then
echo -e "${GREEN}✓${NC} $3"
((PASSED++))
else
echo -e "${RED}✗${NC} $3 - String not found in $1"
((FAILED++))
fi
}
echo "📁 Checking Module Structure..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
BASE_PATH="backend/src/modules/admin-analytics"
check_dir "$BASE_PATH" "Module directory exists"
check_dir "$BASE_PATH/dto" "DTO directory exists"
echo ""
echo "📄 Checking Core Files..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
check_file "$BASE_PATH/admin-analytics.module.ts" "Module file"
check_file "$BASE_PATH/admin-analytics.controller.ts" "Controller file"
check_file "$BASE_PATH/admin-analytics.service.ts" "Service file"
check_file "$BASE_PATH/dto/dashboard-analytics.dto.ts" "DTO file"
check_file "$BASE_PATH/index.ts" "Index file"
echo ""
echo "🧪 Checking Test Files..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
check_file "$BASE_PATH/admin-analytics.controller.spec.ts" "Controller tests"
check_file "$BASE_PATH/admin-analytics.service.spec.ts" "Service tests"
echo ""
echo "📖 Checking Documentation..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
check_file "$BASE_PATH/README.md" "README documentation"
check_file "$BASE_PATH/QUICKSTART.md" "Quick start guide"
check_file "$BASE_PATH/TESTING.md" "Testing guide"
check_file "$BASE_PATH/ARCHITECTURE.md" "Architecture documentation"
check_file "$BASE_PATH/IMPLEMENTATION_SUMMARY.md" "Implementation summary"
check_file "ISSUE_RESOLVED.md" "Issue resolution summary"
echo ""
echo "🔗 Checking Integration..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
check_string_in_file "backend/src/app.module.ts" "AdminAnalyticsModule" "Module imported in app.module.ts"
check_string_in_file "backend/src/app.module.ts" "admin-analytics/admin-analytics.module" "Module path correct in app.module.ts"
echo ""
echo "🔍 Checking Code Quality..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
check_string_in_file "$BASE_PATH/admin-analytics.controller.ts" "@UseGuards(JwtAuthGuard, AdminGuard)" "Security guards applied"
check_string_in_file "$BASE_PATH/admin-analytics.controller.ts" "@Controller('admin/analytics')" "Controller route correct"
check_string_in_file "$BASE_PATH/admin-analytics.service.ts" "getDashboardAnalytics" "Dashboard method exists"
check_string_in_file "$BASE_PATH/admin-analytics.service.ts" "Promise.all" "Parallel execution implemented"
echo ""
echo "╔══════════════════════════════════════════════════════════════════════════════╗"
echo "║ VERIFICATION RESULTS ║"
echo "╚══════════════════════════════════════════════════════════════════════════════╝"
echo ""
echo -e "Tests Passed: ${GREEN}$PASSED${NC}"
echo -e "Tests Failed: ${RED}$FAILED${NC}"
echo ""
if [ $FAILED -eq 0 ]; then
echo -e "${GREEN}✅ ALL CHECKS PASSED!${NC}"
echo ""
echo "The admin analytics module is properly installed and ready to use."
echo ""
echo "Next steps:"
echo " 1. Start your backend server: cd backend && npm run start:dev"
echo " 2. Get an admin JWT token"
echo " 3. Test the endpoints: curl -X GET http://localhost:3000/admin/analytics/dashboard -H \"Authorization: Bearer YOUR_TOKEN\""
echo ""
echo "For detailed instructions, see: backend/src/modules/admin-analytics/QUICKSTART.md"
exit 0
else
echo -e "${RED}❌ SOME CHECKS FAILED!${NC}"
echo ""
echo "Please review the failed checks above and ensure all files are properly created."
exit 1
fi