turash/bugulma/backend/internal/routes/routes.go
Damir Mukimov 000eab4740
Major repository reorganization and missing backend endpoints implementation
Repository Structure:
- Move files from cluttered root directory into organized structure
- Create archive/ for archived data and scraper results
- Create bugulma/ for the complete application (frontend + backend)
- Create data/ for sample datasets and reference materials
- Create docs/ for comprehensive documentation structure
- Create scripts/ for utility scripts and API tools

Backend Implementation:
- Implement 3 missing backend endpoints identified in gap analysis:
  * GET /api/v1/organizations/{id}/matching/direct - Direct symbiosis matches
  * GET /api/v1/users/me/organizations - User organizations
  * POST /api/v1/proposals/{id}/status - Update proposal status
- Add complete proposal domain model, repository, and service layers
- Create database migration for proposals table
- Fix CLI server command registration issue

API Documentation:
- Add comprehensive proposals.md API documentation
- Update README.md with Users and Proposals API sections
- Document all request/response formats, error codes, and business rules

Code Quality:
- Follow existing Go backend architecture patterns
- Add proper error handling and validation
- Match frontend expected response schemas
- Maintain clean separation of concerns (handler -> service -> repository)
2025-11-25 06:01:16 +01:00

72 lines
2.7 KiB
Go

package routes
import (
"bugulma/backend/internal/handler"
"bugulma/backend/internal/service"
"github.com/gin-gonic/gin"
)
// RegisterAllRoutes registers all application routes organized by domain
func RegisterAllRoutes(
router *gin.Engine,
orgHandler *handler.OrganizationHandler,
siteHandler *handler.SiteHandler,
resourceHandler *handler.ResourceFlowHandler,
proposalHandler *handler.ProposalHandler,
matchingHandler *handler.MatchingHandler,
authHandler *handler.AuthHandler,
sharedAssetHandler *handler.SharedAssetHandler,
geospatialHandler *handler.GeospatialHandler,
analyticsHandler *handler.AnalyticsHandler,
aiHandler *handler.AIHandler,
heritageHandler *handler.HeritageHandler,
graphHandler *handler.GraphHandler,
graphTraversalHandler *handler.GraphTraversalHandler,
websocketService *service.WebSocketService,
) {
// Public routes (no authentication required)
public := router.Group("/api/v1")
// Additional public routes for compatibility
apiRoutes := router.Group("/api")
// Protected routes (authentication required)
protected := router.Group("/api/v1")
// TODO: Add authentication middleware when available
// Register routes by domain
RegisterAuthRoutes(public, authHandler)
RegisterUserRoutes(protected, orgHandler)
RegisterOrganizationRoutes(public, protected, orgHandler)
RegisterSiteRoutes(public, protected, siteHandler)
RegisterResourceRoutes(public, protected, resourceHandler)
RegisterProposalRoutes(public, protected, proposalHandler)
RegisterMatchingRoutes(public, protected, matchingHandler)
RegisterSharedAssetRoutes(public, protected, sharedAssetHandler)
RegisterGeospatialRoutes(public, geospatialHandler)
RegisterAnalyticsRoutes(public, analyticsHandler)
RegisterAIRoutes(public, aiHandler)
RegisterHeritageRoutes(public, heritageHandler)
RegisterGraphRoutes(public, protected, graphHandler, graphTraversalHandler)
// Register graph routes under /api for frontend compatibility
RegisterGraphRoutesForAPI(apiRoutes, graphHandler)
RegisterWebSocketRoutes(protected, websocketService)
}
// RegisterGraphRoutesForAPI registers graph routes under /api path for frontend compatibility
func RegisterGraphRoutesForAPI(apiRoutes *gin.RouterGroup, graphHandler *handler.GraphHandler) {
// Public read-only routes under /api for frontend compatibility
if graphHandler != nil {
graph := apiRoutes.Group("/graph")
{
graph.GET("/organizations/:organizationId/network", graphHandler.GetOrganizationNetwork)
graph.GET("/shortest-path", graphHandler.FindShortestPath)
graph.GET("/spatial-proximity", graphHandler.GetSpatialProximity)
graph.GET("/matching-opportunities", graphHandler.GetMatchingOpportunities)
graph.GET("/statistics", graphHandler.GetGraphStatistics)
}
}
}