30 lines
769 B
Go
30 lines
769 B
Go
package deals
|
|
|
|
import (
|
|
"context"
|
|
|
|
"crm-core/internal/domain/deals"
|
|
)
|
|
|
|
type Repository interface {
|
|
Create(ctx context.Context, deal deals.Deal) (deals.Deal, error)
|
|
Update(ctx context.Context, deal deals.Deal) (deals.Deal, error)
|
|
Get(ctx context.Context, tenantID, id string) (deals.Deal, error)
|
|
List(ctx context.Context, tenantID string, filters ListFilters) ([]deals.Deal, error)
|
|
MoveStage(ctx context.Context, tenantID, id, stageID string) (deals.Deal, error)
|
|
Close(ctx context.Context, tenantID, id string, status deals.Status) (deals.Deal, error)
|
|
}
|
|
|
|
type Service struct {
|
|
repo Repository
|
|
}
|
|
|
|
func NewService(repo Repository) *Service {
|
|
return &Service{repo: repo}
|
|
}
|
|
|
|
type ListFilters struct {
|
|
Status *deals.Status
|
|
StageID *string
|
|
AccountID *string
|
|
}
|