Embed assets and fix offline/sync/pricing issues
This commit is contained in:
@@ -9,14 +9,14 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrEmptyQuote = errors.New("quote cannot be empty")
|
||||
ErrEmptyQuote = errors.New("quote cannot be empty")
|
||||
ErrComponentNotFound = errors.New("component not found")
|
||||
ErrNoPriceAvailable = errors.New("no price available for component")
|
||||
)
|
||||
|
||||
type QuoteService struct {
|
||||
componentRepo *repository.ComponentRepository
|
||||
statsRepo *repository.StatsRepository
|
||||
componentRepo *repository.ComponentRepository
|
||||
statsRepo *repository.StatsRepository
|
||||
pricingService *pricing.Service
|
||||
}
|
||||
|
||||
@@ -43,11 +43,11 @@ type QuoteItem struct {
|
||||
}
|
||||
|
||||
type QuoteValidationResult struct {
|
||||
Valid bool `json:"valid"`
|
||||
Items []QuoteItem `json:"items"`
|
||||
Errors []string `json:"errors"`
|
||||
Warnings []string `json:"warnings"`
|
||||
Total float64 `json:"total"`
|
||||
Valid bool `json:"valid"`
|
||||
Items []QuoteItem `json:"items"`
|
||||
Errors []string `json:"errors"`
|
||||
Warnings []string `json:"warnings"`
|
||||
Total float64 `json:"total"`
|
||||
}
|
||||
|
||||
type QuoteRequest struct {
|
||||
@@ -61,6 +61,9 @@ func (s *QuoteService) ValidateAndCalculate(req *QuoteRequest) (*QuoteValidation
|
||||
if len(req.Items) == 0 {
|
||||
return nil, ErrEmptyQuote
|
||||
}
|
||||
if s.componentRepo == nil || s.pricingService == nil {
|
||||
return nil, errors.New("offline mode: quote calculation not available")
|
||||
}
|
||||
|
||||
result := &QuoteValidationResult{
|
||||
Valid: true,
|
||||
|
||||
Reference in New Issue
Block a user