forked from ANYTECHS/clips-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiagnose-and-fix.sh
More file actions
115 lines (100 loc) · 3.53 KB
/
Copy pathdiagnose-and-fix.sh
File metadata and controls
115 lines (100 loc) · 3.53 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
#!/bin/bash
echo "=========================================="
echo "Git Diagnostic and Fix Script"
echo "=========================================="
echo ""
echo "1. Checking current branch..."
CURRENT_BRANCH=$(git branch --show-current)
echo " Current branch: $CURRENT_BRANCH"
echo ""
echo "2. Checking for uncommitted changes..."
if [[ -n $(git status -s) ]]; then
echo " ⚠️ Found uncommitted changes:"
git status -s
echo ""
echo " Staging all changes..."
git add -A
echo " ✅ Changes staged"
else
echo " ✅ No uncommitted changes"
fi
echo ""
echo "3. Checking if commit exists..."
LAST_COMMIT=$(git log -1 --oneline 2>/dev/null)
if [ -z "$LAST_COMMIT" ]; then
echo " ⚠️ No commits found!"
else
echo " Last commit: $LAST_COMMIT"
fi
echo ""
echo "4. Creating commit if needed..."
if [[ -n $(git status -s) ]] || [ -z "$LAST_COMMIT" ]; then
echo " Creating commit..."
git commit -m "feat(payouts): add secure fiat payout method storage with encryption
Implements encrypted storage for bank account information:
- PayoutMethod model with AES-256-GCM encrypted fields
- PayoutMethodService with encryption/decryption
- REST API endpoints with JWT authentication
- Data sanitization and soft delete
- Comprehensive test suite and documentation"
if [ $? -eq 0 ]; then
echo " ✅ Commit created successfully"
else
echo " ❌ Commit failed"
exit 1
fi
else
echo " ✅ Commit already exists"
fi
echo ""
echo "5. Checking/creating feature branch..."
if [ "$CURRENT_BRANCH" = "main" ]; then
echo " Currently on main, creating feature branch..."
git checkout -b feature/fiat-payout-encryption
CURRENT_BRANCH="feature/fiat-payout-encryption"
echo " ✅ Switched to feature/fiat-payout-encryption"
elif [ "$CURRENT_BRANCH" != "feature/fiat-payout-encryption" ]; then
echo " On branch $CURRENT_BRANCH, switching to feature branch..."
git checkout -b feature/fiat-payout-encryption 2>/dev/null || git checkout feature/fiat-payout-encryption
CURRENT_BRANCH="feature/fiat-payout-encryption"
else
echo " ✅ Already on feature/fiat-payout-encryption"
fi
echo ""
echo "6. Fetching remote..."
git fetch origin
echo ""
echo "7. Checking commits ahead of main..."
COMMITS_AHEAD=$(git rev-list --count origin/main..HEAD 2>/dev/null || echo "0")
echo " Commits ahead of main: $COMMITS_AHEAD"
if [ "$COMMITS_AHEAD" = "0" ]; then
echo " ⚠️ No commits ahead of main!"
echo ""
echo " Checking if we need to commit changes from main..."
git diff --name-only origin/main
fi
echo ""
echo "8. Pushing to remote..."
echo " Executing: git push -u origin feature/fiat-payout-encryption"
git push -u origin feature/fiat-payout-encryption
if [ $? -eq 0 ]; then
echo " ✅ Push successful!"
else
echo " ❌ Push failed!"
echo ""
echo " Trying force push (if branch exists remotely)..."
git push -u origin feature/fiat-payout-encryption --force-with-lease
fi
echo ""
echo "9. Verifying remote branch..."
git ls-remote --heads origin feature/fiat-payout-encryption
echo ""
echo "=========================================="
echo "Summary:"
echo "=========================================="
echo "Branch: $(git branch --show-current)"
echo "Last commit: $(git log -1 --oneline)"
echo "Commits ahead: $(git rev-list --count origin/main..HEAD 2>/dev/null || echo '0')"
echo ""
echo "Next step: Run this to create PR:"
echo "gh pr create --title 'feat(payouts): add secure fiat payout method storage with encryption' --base main"