- Add auth handlers (signup, login, logout, account management) with bcrypt - Add client, customer, service, scheduling, payment, question, answer handlers - Add dashboard, monthly report, and lead pipeline pages - Add UTF-8 middleware to force charset on HTML responses - Add config package with env-based overrides for DB path, secrets, endpoints - Add parser package for WhatsApp message ingestion - Add clean-arch layers: pkg/domain, pkg/repo, pkg/usecase for leads - Add cmd/migrate utility for DB migrations - Add Makefile, README, run-tests.sh, and dev scripts - Update docker-compose.yml with memory limits - Update .air.toml to exclude DB files and stop on errors - Update whatsapp-sync dependencies and add src/index.js entrypoint - Add whatsme standalone WhatsApp reader app (source only) - Untrack .opencode-sandbox/data/go-crm.db from git history - Expand root .gitignore: ngrok, tmp dirs, sandbox DBs, compiled binaries
29 lines
784 B
Go
29 lines
784 B
Go
// Package usecase implements application business logic.
|
|
package usecase
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go-crm/pkg/domain"
|
|
)
|
|
|
|
// LeadService coordinates lead-related business rules.
|
|
type LeadService struct {
|
|
Repo domain.LeadRepository
|
|
}
|
|
|
|
// NewLeadService constructs a LeadService with the given repository.
|
|
func NewLeadService(repo domain.LeadRepository) *LeadService {
|
|
return &LeadService{Repo: repo}
|
|
}
|
|
|
|
// ListAllLeads returns paginated leads for a client.
|
|
func (s *LeadService) ListAllLeads(ctx context.Context, clientID int64, limit, offset int) ([]domain.Lead, error) {
|
|
return s.Repo.ListAll(ctx, clientID, limit, offset)
|
|
}
|
|
|
|
// UpdateLead applies updates to a lead.
|
|
func (s *LeadService) UpdateLead(ctx context.Context, lead domain.Lead) error {
|
|
return s.Repo.Update(ctx, lead)
|
|
}
|