checkpoint: goals feature, wallet balance, and goals/wallet detail UI
- Add goals feature (models, migrations, API, web pages) - Add reserved/centralized wallet balance service - Add wallet detail page and overview components - Add new UI components (progress, multi-select, FAB) - Remove stray empty -H/-d files from working tree
This commit is contained in:
156
GOALS_TROUBLESHOOTING.md
Executable file
156
GOALS_TROUBLESHOOTING.md
Executable file
@@ -0,0 +1,156 @@
|
||||
# Goals Feature - Troubleshooting
|
||||
|
||||
## ❌ Error: "Cannot POST /api/goals"
|
||||
|
||||
### **Cause:**
|
||||
The backend server needs to be restarted to load the new Goals module.
|
||||
|
||||
### **Solution:**
|
||||
|
||||
**Step 1: Stop the backend server**
|
||||
```bash
|
||||
# In the terminal running the API
|
||||
# Press Ctrl+C to stop
|
||||
```
|
||||
|
||||
**Step 2: Restart the backend**
|
||||
```bash
|
||||
cd apps/api
|
||||
npm run dev
|
||||
```
|
||||
|
||||
**Step 3: Verify the server started correctly**
|
||||
Look for these messages:
|
||||
```
|
||||
[Nest] INFO [NestFactory] Starting Nest application...
|
||||
[Nest] INFO [InstanceLoader] GoalsModule dependencies initialized
|
||||
[Nest] INFO [RoutesResolver] GoalsController {/api/goals}:
|
||||
[Nest] INFO [RouterExplorer] Mapped {/api/goals, POST} route
|
||||
[Nest] INFO [RouterExplorer] Mapped {/api/goals, GET} route
|
||||
[Nest] INFO [RouterExplorer] Mapped {/api/goals/stats, GET} route
|
||||
[Nest] INFO [RouterExplorer] Mapped {/api/goals/:id, GET} route
|
||||
[Nest] INFO [RouterExplorer] Mapped {/api/goals/:id, PATCH} route
|
||||
[Nest] INFO [RouterExplorer] Mapped {/api/goals/:id, DELETE} route
|
||||
[Nest] INFO [RouterExplorer] Mapped {/api/goals/:id/allocations, POST} route
|
||||
[Nest] INFO [RouterExplorer] Mapped {/api/goals/:id/allocations/:allocationId, DELETE} route
|
||||
```
|
||||
|
||||
**Step 4: Test the endpoint**
|
||||
```bash
|
||||
# In a new terminal, test if the endpoint exists:
|
||||
curl -X GET http://localhost:3001/api/goals \
|
||||
-H "Authorization: Bearer YOUR_TOKEN"
|
||||
|
||||
# Should return: 401 Unauthorized (if no token) or [] (empty array if authenticated)
|
||||
# Should NOT return: 404 Not Found or "Cannot POST /api/goals"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ Verification Checklist
|
||||
|
||||
After restarting the backend:
|
||||
|
||||
- [ ] Backend server running on port 3001
|
||||
- [ ] Console shows "GoalsModule dependencies initialized"
|
||||
- [ ] Console shows "GoalsController {/api/goals}" routes
|
||||
- [ ] Frontend can create goals without "Cannot POST" error
|
||||
- [ ] Goals appear in the dashboard
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Additional Checks
|
||||
|
||||
### **Check 1: Module is registered**
|
||||
File: `apps/api/src/app.module.ts`
|
||||
```typescript
|
||||
imports: [
|
||||
// ... other modules
|
||||
GoalsModule, // ← Should be here
|
||||
],
|
||||
```
|
||||
|
||||
### **Check 2: Controller is exported**
|
||||
File: `apps/api/src/goals/goals.module.ts`
|
||||
```typescript
|
||||
@Module({
|
||||
imports: [PrismaModule],
|
||||
controllers: [GoalsController], // ← Should be here
|
||||
providers: [GoalsService],
|
||||
exports: [GoalsService],
|
||||
})
|
||||
```
|
||||
|
||||
### **Check 3: Database migration ran**
|
||||
```bash
|
||||
cd apps/api
|
||||
npx prisma migrate status
|
||||
|
||||
# Should show:
|
||||
# ✓ 20251022141924_add_goals_feature
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Common Issues
|
||||
|
||||
### **Issue: Module not found**
|
||||
**Error:** `Cannot find module './goals/goals.module'`
|
||||
**Fix:** Make sure all files were created correctly
|
||||
|
||||
### **Issue: Prisma client not updated**
|
||||
**Error:** `Property 'goal' does not exist on type 'PrismaClient'`
|
||||
**Fix:**
|
||||
```bash
|
||||
cd apps/api
|
||||
npx prisma generate
|
||||
npm run build
|
||||
```
|
||||
|
||||
### **Issue: Port already in use**
|
||||
**Error:** `Error: listen EADDRINUSE: address already in use :::3001`
|
||||
**Fix:**
|
||||
```bash
|
||||
# Find and kill the process using port 3001
|
||||
lsof -ti:3001 | xargs kill -9
|
||||
|
||||
# Then restart
|
||||
npm run dev
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📞 Quick Test
|
||||
|
||||
Once backend is restarted, test in browser console:
|
||||
```javascript
|
||||
// Open browser console (F12)
|
||||
// Make sure you're logged in
|
||||
|
||||
fetch('http://localhost:3001/api/goals', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('token')}`
|
||||
}
|
||||
})
|
||||
.then(r => r.json())
|
||||
.then(console.log)
|
||||
|
||||
// Should return: []
|
||||
// Should NOT return: 404 or "Cannot GET /api/goals"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ Success Indicators
|
||||
|
||||
You'll know it's working when:
|
||||
1. ✅ Backend console shows Goals routes mapped
|
||||
2. ✅ No "Cannot POST /api/goals" error
|
||||
3. ✅ Create goal dialog submits successfully
|
||||
4. ✅ Goals appear in the dashboard
|
||||
5. ✅ Stats cards show correct numbers
|
||||
|
||||
---
|
||||
|
||||
**TL;DR: Restart the backend server!** 🔄
|
||||
Reference in New Issue
Block a user