mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
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)
58 lines
1.9 KiB
Go
58 lines
1.9 KiB
Go
package graph
|
|
|
|
// Config holds configuration for graph operations
|
|
type Config struct {
|
|
// Query limits
|
|
MaxChainLength int `json:"max_chain_length"` // Maximum length for resource chains
|
|
MaxPathHops int `json:"max_path_hops"` // Maximum hops for path finding
|
|
MaxNetworkSize int `json:"max_network_size"` // Maximum organizations in a network
|
|
MinNetworkSize int `json:"min_network_size"` // Minimum organizations in a network
|
|
DefaultResultLimit int `json:"default_result_limit"` // Default limit for query results
|
|
|
|
// Distance constraints
|
|
MaxChainDistanceKm float64 `json:"max_chain_distance_km"` // Maximum total distance for chains
|
|
MaxPathDistanceKm float64 `json:"max_path_distance_km"` // Maximum distance for paths
|
|
|
|
// Economic thresholds
|
|
MinChainValue float64 `json:"min_chain_value"` // Minimum economic value for chains
|
|
MinNetworkValue float64 `json:"min_network_value"` // Minimum value for networks
|
|
|
|
// Performance settings
|
|
QueryTimeoutSeconds int `json:"query_timeout_seconds"` // Query timeout in seconds
|
|
EnableGDS bool `json:"enable_gds"` // Enable Graph Data Science library
|
|
}
|
|
|
|
// DefaultConfig returns the default configuration
|
|
func DefaultConfig() *Config {
|
|
return &Config{
|
|
MaxChainLength: 5,
|
|
MaxPathHops: 4,
|
|
MaxNetworkSize: 20,
|
|
MinNetworkSize: 3,
|
|
DefaultResultLimit: 50,
|
|
MaxChainDistanceKm: 500.0,
|
|
MaxPathDistanceKm: 200.0,
|
|
MinChainValue: 1000.0,
|
|
MinNetworkValue: 5000.0,
|
|
QueryTimeoutSeconds: 30,
|
|
EnableGDS: false, // Default to false, enable if GDS is installed
|
|
}
|
|
}
|
|
|
|
// Validate validates the configuration
|
|
func (c *Config) Validate() error {
|
|
if c.MaxChainLength < 1 {
|
|
return ErrInvalidConfig
|
|
}
|
|
if c.MaxPathHops < 1 {
|
|
return ErrInvalidConfig
|
|
}
|
|
if c.MaxNetworkSize < c.MinNetworkSize {
|
|
return ErrInvalidConfig
|
|
}
|
|
if c.DefaultResultLimit < 1 {
|
|
return ErrInvalidConfig
|
|
}
|
|
return nil
|
|
}
|