Add application workflow and lead analytics
Test and publish / test (push) Successful in 2m33s
Test and publish / publish (push) Successful in 11m9s

This commit is contained in:
2026-10-23 20:45:48 +01:00
parent d0074aea46
commit 1147bc5697
35 changed files with 4337 additions and 131 deletions
+33 -1
View File
@@ -112,6 +112,21 @@ func (r *mutationResolver) PromoteJobLead(ctx context.Context, id int) (*models.
return services.PromoteJobLead(r.Store.DB, uint(id), time.Now())
}
// BulkDismissJobLeads is the resolver for the bulkDismissJobLeads field.
func (r *mutationResolver) BulkDismissJobLeads(ctx context.Context, ids []int) ([]*models.JobLead, error) {
return services.BulkLeadState(r.Store.DB, ids, services.LeadNew, services.LeadDismissed)
}
// BulkRestoreJobLeads is the resolver for the bulkRestoreJobLeads field.
func (r *mutationResolver) BulkRestoreJobLeads(ctx context.Context, ids []int) ([]*models.JobLead, error) {
return services.BulkLeadState(r.Store.DB, ids, services.LeadDismissed, services.LeadNew)
}
// BulkPromoteJobLeads is the resolver for the bulkPromoteJobLeads field.
func (r *mutationResolver) BulkPromoteJobLeads(ctx context.Context, ids []int) ([]*models.JobLead, error) {
return services.BulkPromoteJobLeads(r.Store.DB, ids, time.Now())
}
// UpdateJobSearchProfile is the resolver for the updateJobSearchProfile field.
func (r *mutationResolver) UpdateJobSearchProfile(ctx context.Context, input model.UpdateJobSearchProfileInput) (*models.JobSearchProfile, error) {
profile, err := services.LoadJobSearchProfile(r.Store.DB)
@@ -173,7 +188,7 @@ func (r *queryResolver) JobSources(ctx context.Context) ([]*models.JobSource, er
}
// JobLeads is the resolver for the jobLeads field.
func (r *queryResolver) JobLeads(ctx context.Context, state *string, includeUnmatched *bool) ([]*models.JobLead, error) {
func (r *queryResolver) JobLeads(ctx context.Context, state *string, includeUnmatched *bool, filters *model.JobLeadFilters) ([]*models.JobLead, error) {
// Omit, not Select: every column but the description, which is tens of
// kilobytes a row and is fetched one lead at a time through jobLead. A
// client that asks for description here gets "".
@@ -186,6 +201,23 @@ func (r *queryResolver) JobLeads(ctx context.Context, state *string, includeUnma
// about it; `matched` only decides what the inbox offers.
query = query.Where("(matched = ? OR state <> ?)", true, services.LeadNew)
}
if filters != nil {
if filters.SourceKind != nil && strings.TrimSpace(*filters.SourceKind) != "" {
query = query.Where("source_kind = ?", strings.TrimSpace(*filters.SourceKind))
}
if filters.MinScore != nil {
query = query.Where("score >= ?", *filters.MinScore)
}
if filters.MaxScore != nil {
query = query.Where("score <= ?", *filters.MaxScore)
}
if filters.Location != nil && strings.TrimSpace(*filters.Location) != "" {
query = query.Where("location ILIKE ?", "%"+strings.TrimSpace(*filters.Location)+"%")
}
if filters.Company != nil && strings.TrimSpace(*filters.Company) != "" {
query = query.Where("company ILIKE ?", "%"+strings.TrimSpace(*filters.Company)+"%")
}
}
var leads []*models.JobLead
// Best first, unscored after scored, newest first within a score. The
// limit is a backstop for includeUnmatched on a database holding several