2026-07-13 01:15:30 +00:00
|
|
|
package domain
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"errors"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var (
|
2026-07-13 08:59:13 +00:00
|
|
|
ErrNotFound = errors.New("scout not found")
|
|
|
|
|
ErrForbidden = errors.New("scout forbidden")
|
|
|
|
|
ErrValidation = errors.New("scout validation")
|
|
|
|
|
ErrNoCrawlerSession = errors.New("crawler session required when dev_mode enabled")
|
|
|
|
|
ErrTopicRemoved = errors.New("ScoutTopic CRUD removed")
|
|
|
|
|
ErrHasProducts = errors.New("brand has products; remove products first")
|
2026-07-13 01:15:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func NowNano() int64 { return time.Now().UTC().UnixNano() }
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
PathAPI = "api"
|
|
|
|
|
PathCrawler = "crawler"
|
|
|
|
|
|
|
|
|
|
OutreachNew = "new"
|
|
|
|
|
OutreachDrafted = "drafted"
|
|
|
|
|
OutreachPublished = "published"
|
|
|
|
|
OutreachSkipped = "skipped"
|
2026-07-13 08:59:13 +00:00
|
|
|
OutreachQueued = "queued"
|
2026-07-13 01:15:30 +00:00
|
|
|
|
|
|
|
|
ModeProduct = "product"
|
|
|
|
|
ModeTheme = "theme"
|
|
|
|
|
ModeActivity = "activity"
|
2026-07-13 08:59:13 +00:00
|
|
|
|
|
|
|
|
ClassificationSeekingHelp = "seeking_help"
|
|
|
|
|
ClassificationSeekingRecommendation = "seeking_recommendation"
|
|
|
|
|
ClassificationProviderOffer = "provider_offer"
|
|
|
|
|
ClassificationDiscussion = "discussion"
|
|
|
|
|
ClassificationAsking = "asking"
|
|
|
|
|
ClassificationAnnouncement = "announcement"
|
|
|
|
|
ClassificationNoise = "noise"
|
2026-07-13 01:15:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Brand struct {
|
|
|
|
|
ID string `bson:"_id" json:"id"`
|
|
|
|
|
OwnerUID int64 `bson:"owner_uid" json:"owner_uid"`
|
|
|
|
|
DisplayName string `bson:"display_name" json:"display_name"`
|
|
|
|
|
Brief string `bson:"brief" json:"brief"`
|
|
|
|
|
TargetAudience string `bson:"target_audience,omitempty" json:"target_audience,omitempty"`
|
|
|
|
|
Goals string `bson:"goals,omitempty" json:"goals,omitempty"`
|
|
|
|
|
CreatedAt int64 `bson:"created_at" json:"created_at"`
|
|
|
|
|
UpdatedAt int64 `bson:"updated_at" json:"updated_at"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Product struct {
|
|
|
|
|
ID string `bson:"_id" json:"id"`
|
|
|
|
|
OwnerUID int64 `bson:"owner_uid" json:"owner_uid"`
|
|
|
|
|
BrandID string `bson:"brand_id" json:"brand_id"`
|
|
|
|
|
Label string `bson:"label" json:"label"`
|
|
|
|
|
ProductContext string `bson:"product_context" json:"product_context"`
|
|
|
|
|
MatchTags []string `bson:"match_tags" json:"match_tags"`
|
|
|
|
|
PainPoints []string `bson:"pain_points" json:"pain_points"`
|
|
|
|
|
PlacementURL string `bson:"placement_url,omitempty" json:"placement_url,omitempty"`
|
|
|
|
|
CreatedAt int64 `bson:"created_at" json:"created_at"`
|
|
|
|
|
UpdatedAt int64 `bson:"updated_at" json:"updated_at"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ActiveBrand struct {
|
|
|
|
|
OwnerUID int64 `bson:"_id" json:"owner_uid"`
|
|
|
|
|
BrandID string `bson:"brand_id" json:"brand_id"`
|
|
|
|
|
UpdatedAt int64 `bson:"updated_at" json:"updated_at"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RunBrief struct {
|
2026-07-13 08:59:13 +00:00
|
|
|
Intent string `json:"intent"`
|
|
|
|
|
Mode string `json:"mode"`
|
|
|
|
|
BrandID string `json:"brand_id,omitempty"`
|
|
|
|
|
ProductID string `json:"product_id,omitempty"`
|
|
|
|
|
ProductLabel string `json:"product_label,omitempty"`
|
|
|
|
|
Pains []string `json:"pains"`
|
|
|
|
|
Tags []string `json:"tags"`
|
|
|
|
|
Periphery []string `json:"periphery"`
|
|
|
|
|
ScanTerms []string `json:"scan_terms"`
|
|
|
|
|
PlacementNote string `json:"placement_note,omitempty"`
|
|
|
|
|
ResponseStance string `json:"response_stance,omitempty"`
|
|
|
|
|
ThemeKey string `json:"theme_key,omitempty"`
|
|
|
|
|
ThemeLabel string `json:"theme_label,omitempty"`
|
|
|
|
|
ProductContext string `json:"product_context,omitempty"`
|
2026-07-13 01:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Post struct {
|
|
|
|
|
ID string `bson:"_id" json:"id"`
|
2026-07-13 08:59:13 +00:00
|
|
|
ExternalID string `bson:"external_id,omitempty" json:"external_id,omitempty"`
|
|
|
|
|
Permalink string `bson:"permalink,omitempty" json:"permalink,omitempty"`
|
2026-07-13 01:15:30 +00:00
|
|
|
OwnerUID int64 `bson:"owner_uid" json:"owner_uid"`
|
|
|
|
|
BrandID string `bson:"brand_id,omitempty" json:"brand_id,omitempty"`
|
|
|
|
|
Author string `bson:"author" json:"author"`
|
|
|
|
|
Text string `bson:"text" json:"text"`
|
|
|
|
|
SearchTag string `bson:"search_tag" json:"search_tag"`
|
|
|
|
|
Opportunity string `bson:"opportunity" json:"opportunity"`
|
|
|
|
|
OutreachStatus string `bson:"outreach_status" json:"outreach_status"`
|
|
|
|
|
DraftText string `bson:"draft_text,omitempty" json:"draft_text,omitempty"`
|
2026-07-13 08:59:13 +00:00
|
|
|
OutboxID string `bson:"outbox_id,omitempty" json:"outbox_id,omitempty"`
|
2026-07-13 01:15:30 +00:00
|
|
|
Score int `bson:"score" json:"score"`
|
2026-07-13 08:59:13 +00:00
|
|
|
Classification string `bson:"classification,omitempty" json:"classification,omitempty"`
|
2026-07-13 01:15:30 +00:00
|
|
|
MatchedProductID string `bson:"matched_product_id,omitempty" json:"matched_product_id,omitempty"`
|
|
|
|
|
MatchedProductLabel string `bson:"matched_product_label,omitempty" json:"matched_product_label,omitempty"`
|
|
|
|
|
MatchReason string `bson:"match_reason,omitempty" json:"match_reason,omitempty"`
|
|
|
|
|
ScoutMode string `bson:"scout_mode,omitempty" json:"scout_mode,omitempty"`
|
|
|
|
|
IntentSnippet string `bson:"intent_snippet,omitempty" json:"intent_snippet,omitempty"`
|
|
|
|
|
ThemeKey string `bson:"theme_key,omitempty" json:"theme_key,omitempty"`
|
|
|
|
|
ThemeLabel string `bson:"theme_label,omitempty" json:"theme_label,omitempty"`
|
|
|
|
|
ScanPath string `bson:"scan_path,omitempty" json:"scan_path,omitempty"` // api|crawler
|
|
|
|
|
CreatedAt int64 `bson:"created_at" json:"created_at"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Homework struct {
|
|
|
|
|
ThemeKey string `bson:"_id" json:"theme_key"`
|
|
|
|
|
OwnerUID int64 `bson:"owner_uid" json:"owner_uid"`
|
|
|
|
|
ThemeLabel string `bson:"theme_label" json:"theme_label"`
|
|
|
|
|
Purpose string `bson:"purpose" json:"purpose"`
|
|
|
|
|
Brief RunBrief `bson:"brief" json:"brief"`
|
|
|
|
|
CreatedAt int64 `bson:"created_at" json:"created_at"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type CrawlerSession struct {
|
2026-07-13 08:59:13 +00:00
|
|
|
OwnerUID int64 `bson:"_id" json:"owner_uid"`
|
|
|
|
|
StorageStateEnc string `bson:"storage_state_enc" json:"storage_state_enc"`
|
|
|
|
|
UpdatedAt int64 `bson:"updated_at" json:"updated_at"`
|
|
|
|
|
ExpiresAt int64 `bson:"expires_at" json:"expires_at"`
|
2026-07-13 01:15:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ImportDraft struct {
|
|
|
|
|
Label string `json:"label"`
|
|
|
|
|
ProductContext string `json:"product_context"`
|
|
|
|
|
PainPoints []string `json:"pain_points"`
|
|
|
|
|
MatchTags []string `json:"match_tags"`
|
|
|
|
|
PlacementURL string `json:"placement_url"`
|
|
|
|
|
SourceNote string `json:"source_note"`
|
|
|
|
|
}
|