# Sojorn Development TODO List

**Last Updated**: January 30, 2026  
**Status**: Ready for 100% Go Backend Migration  
**Estimated Effort**: ~12 hours total

---

## 🎯 **High Priority Tasks** (Critical for 100% Go Backend)

### **1. Implement Beacon Voting Endpoints** ⚡
**Location**: `go-backend/internal/handlers/post_handler.go`  
**Status**: Not Started  
**Effort**: 2 hours

**Tasks:**
- [ ] Add `VouchBeacon` handler method
- [ ] Add `ReportBeacon` handler method  
- [ ] Add `RemoveBeaconVote` handler method
- [ ] Implement database operations for beacon votes
- [ ] Add proper error handling and validation

**Implementation Details:**
```go
func (h *PostHandler) VouchBeacon(c *gin.Context) {
    // Get user ID from context
    // Get beacon ID from params
    // Check if user already voted
    // Add vote to database
    // Update beacon confidence score
    // Return success response
}
```

### **2. Add Beacon Voting Routes** ⚡
**Location**: `go-backend/cmd/api/main.go`  
**Status**: Not Started  
**Effort**: 30 minutes

**Tasks:**
- [ ] Add `POST /beacons/:id/vouch` route
- [ ] Add `POST /beacons/:id/report` route
- [ ] Add `DELETE /beacons/:id/vouch` route
- [ ] Ensure proper middleware (auth, rate limiting)

**Routes to Add:**
```go
authorized.POST("/beacons/:id/vouch", postHandler.VouchBeacon)
authorized.POST("/beacons/:id/report", postHandler.ReportBeacon)
authorized.DELETE("/beacons/:id/vouch", postHandler.RemoveBeaconVote)
```

### **3. Update Flutter Beacon API** ⚡
**Location**: `sojorn_app/lib/services/api_service.dart`  
**Status**: Not Started  
**Effort**: 1 hour

**Tasks:**
- [ ] Replace empty `vouchBeacon()` method
- [ ] Replace empty `reportBeacon()` method
- [ ] Replace empty `removeBeaconVote()` method
- [ ] Add proper error handling
- [ ] Update method signatures to match Go API

**Current State:**
```dart
// These methods are empty stubs that need implementation:
Future<void> vouchBeacon(String beaconId) async {
  // Migrate to Go API - EMPTY STUB
}

Future<void> reportBeacon(String beaconId) async {
  // Migrate to Go API - EMPTY STUB
}

Future<void> removeBeaconVote(String beaconId) async {
  // Migrate to Go API - EMPTY STUB
}
```

---

## ⚠️ **Medium Priority Tasks** (Cleanup & Technical Debt)

### **4. Remove Supabase Function Proxy**
**Location**: `go-backend/internal/handlers/function_proxy.go`  
**Status**: Not Started  
**Effort**: 1 hour

**Tasks:**
- [ ] Delete `function_proxy.go` file
- [ ] Remove function proxy handler instantiation
- [ ] Remove `/functions/:name` route from `main.go`
- [ ] Remove related environment variables
- [ ] Test that no functionality is broken

**Files to Remove:**
- `go-backend/internal/handlers/function_proxy.go`
- `go-backend/cmd/supabase-migrate/` (entire directory)

### **5. Clean Up Supabase Dependencies**
**Location**: Multiple files  
**Status**: Not Started  
**Effort**: 2 hours

**Tasks:**
- [ ] Remove `SupabaseID` field from `internal/models/user.go`
- [ ] Remove Supabase environment variables from `.env.example`
- [ ] Update configuration struct in `internal/config/config.go`
- [ ] Remove any remaining Supabase imports
- [ ] Update middleware comments that reference Supabase

**Environment Variables to Remove:**
```bash
# SUPABASE_URL
# SUPABASE_KEY  
# SUPABASE_SERVICE_ROLE_KEY
```

### **6. Update Outdated TODO Comments**
**Location**: `sojorn_app/lib/services/api_service.dart`  
**Status**: Not Started  
**Effort**: 30 minutes

**Tasks:**
- [ ] Remove comment "Beacon voting still Supabase RPC or migrate?"
- [ ] Remove comment "Summary didn't mention beacon voting endpoint"
- [ ] Update any other misleading Supabase references
- [ ] Ensure all comments reflect current Go backend state

### **7. End-to-End Testing**
**Location**: Entire application  
**Status**: Not Started  
**Effort**: 2 hours

**Tasks:**
- [ ] Test beacon voting flow end-to-end
- [ ] Verify all core features work without Supabase
- [ ] Test media uploads to R2
- [ ] Test E2EE chat functionality
- [ ] Test push notifications
- [ ] Performance testing
- [ ] Security verification

---

## 🔧 **Low Priority Tasks** (UI Polish & Code Cleanup)

### **8. Fix Video Comments TODO**
**Location**: `sojorn_app/lib/widgets/video_comments_sheet.dart`  
**Status**: Not Started  
**Effort**: 1 hour

**Tasks:**
- [ ] Replace simulated API call with real `publishComment()` call
- [ ] Remove "TODO: Implement actual comment posting" comment
- [ ] Test comment posting functionality
- [ ] Ensure proper error handling

**Current State:**
```dart
// TODO: Implement actual comment posting
await Future.delayed(const Duration(seconds: 1)); // Simulate API call
```

**Should Become:**
```dart
await ApiService.instance.publishComment(postId: widget.postId, body: comment);
```

### **9. Implement Comment Reply Features**
**Location**: `sojorn_app/lib/widgets/threaded_comment_widget.dart`  
**Status**: Not Started  
**Effort**: 2 hours

**Tasks:**
- [ ] Implement actual reply submission in `_submitReply()`
- [ ] Add reply UI components
- [ ] Connect to backend reply API
- [ ] Remove "TODO: Implement actual reply submission" comment

### **10. Add Post Options Menu**
**Location**: `sojorn_app/lib/widgets/post_with_video_widget.dart`  
**Status**: Not Started  
**Effort**: 1 hour

**Tasks:**
- [ ] Implement post options menu functionality
- [ ] Add menu items (edit, delete, report, etc.)
- [ ] Remove "TODO: Show post options" comment
- [ ] Connect to backend APIs

### **11. Fix Profile Navigation**
**Location**: `sojorn_app/lib/widgets/sojorn_rich_text.dart`  
**Status**: Not Started  
**Effort**: 1 hour

**Tasks:**
- [ ] Implement profile navigation from mentions
- [ ] Remove "TODO: Implement profile navigation" comment
- [ ] Add proper navigation logic
- [ ] Test mention navigation

### **12. Clean Up Debug Code**
**Location**: `sojorn_app/lib/services/simple_e2ee_service.dart`  
**Status**: Not Started  
**Effort**: 1 hour

**Tasks:**
- [ ] Remove `_FORCE_KEY_ROTATION` debug flag
- [ ] Remove debug print statements
- [ ] Remove force reset methods for 208-bit key bug
- [ ] Clean up any remaining debug code

---

## ✅ **Already Completed Features** (For Reference)

### **Core Functionality**
- ✅ User authentication (JWT-based)
- ✅ Post creation, editing, deletion
- ✅ Feed and post retrieval
- ✅ Image/video uploads to R2
- ✅ **Comment system** (fully implemented)
- ✅ Follow/unfollow system
- ✅ E2EE chat (X3DH implementation)
- ✅ Push notifications (FCM)
- ✅ Search functionality
- ✅ Categories and user settings
- ✅ Chain posts functionality

### **Infrastructure**
- ✅ Go backend API with all core endpoints
- ✅ PostgreSQL database with proper schema
- ✅ Cloudflare R2 integration for media
- ✅ Nginx reverse proxy
- ✅ SSL/TLS configuration
- ✅ Systemd service management

---

## 📊 **Current Status Analysis**

### **What's Working Better Than Expected**
- **Comment System**: Fully implemented with Go backend (TODO was outdated)
- **Media Uploads**: Direct to R2, no Supabase dependency
- **Chain Posts**: Complete implementation
- **E2EE Chat**: Production-ready X3DH system

### **What Actually Needs Work**
- **Beacon Voting**: Only 3 missing endpoints (core feature)
- **Supabase Cleanup**: Mostly removing legacy code
- **UI Polish**: Fixing outdated TODO comments

### **Key Insight**
The codebase is **90% complete** for Go backend migration. Most TODO comments are outdated and refer to features that are already implemented. The beacon voting system is the only critical missing piece.

---

## 🚀 **Implementation Plan**

### **Day 1: Beacon Voting (4 hours)**
1. Implement beacon voting handlers (2h)
2. Add API routes (30m)
3. Update Flutter API methods (1h)
4. Test beacon voting flow (30m)

### **Day 2: Supabase Cleanup (3 hours)**
1. Remove function proxy (1h)
2. Clean up dependencies (2h)

### **Day 3: UI Polish (3 hours)**
1. Fix video comments TODO (1h)
2. Implement reply features (2h)

### **Day 4: Final Polish & Testing (2 hours)**
1. Add post options menu (1h)
2. End-to-end testing (1h)

---

## 🎯 **Success Criteria**

### **100% Go Backend Functionality**
- [ ] All features work without Supabase
- [ ] Beacon voting system operational
- [ ] No Supabase code or dependencies
- [ ] All TODO comments resolved or updated
- [ ] End-to-end testing passes

### **Code Quality**
- [ ] No debug code in production
- [ ] No outdated comments
- [ ] Clean, maintainable code
- [ ] Proper error handling
- [ ] Security best practices

---

## 📝 **Notes**

- **Most TODO comments are outdated** - features are already implemented
- **Beacon voting is the only critical missing feature**
- **Supabase cleanup is mostly removing legacy code**
- **UI polish items are nice-to-have, not blocking**

**Total estimated effort: ~12 hours to reach 100% Go backend functionality**

---

**Next Steps**: Start with high-priority beacon voting implementation, as it's the only critical missing feature for complete Go backend functionality.
