diff --git a/README.md b/README.md index 9ec96c0..a679fb4 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ # Job tracker -A private tracker for job applications, served at `/jobs/` on adam-french.co.uk. It has three parts: +A private tracker for job applications, served at `/jobs/` on adam-french.co.uk. It has four main areas: - **Applications** (`/jobs/`): the list, the pipeline view and the Quick Reference snippets. +- **Dashboard** (`/jobs/dashboard`): funnel counts, conversion rates and time-to-milestone metrics. - **Leads inbox** (`/jobs/leads`): postings the server finds on Greenhouse, Lever and Ashby boards and in Adzuna and Reed searches, scored by Claude against a search profile. - **Capture userscript** (`web/public/job-capture.user.js`): adds the posting open in the browser. +Applications include explicit follow-up dates, contacts, activity history and structured posting metadata. The leads inbox supports filtering and bulk dismiss, restore and tracking actions. + It was split out of the `web_server` repo, where it lived inside the site's Go backend, Python service and Vue app. It is now one Go binary that serves its own Vue SPA. It runs as one container behind the site's nginx and borrows the site's login. ## Layout @@ -27,7 +30,7 @@ Everything is served under `BASE_PATH` (`/jobs`). nginx proxies the prefix throu | Path | Auth | What | |---|---|---| -| `/jobs/`, `/jobs/leads`, `/jobs/settings` | none (the data behind them is admin-only) | SPA | +| `/jobs/`, `/jobs/dashboard`, `/jobs/leads`, `/jobs/settings` | none (the data behind them is admin-only) | SPA | | `POST /jobs/api/graphql` | `@admin` on every field | everything the pages show and edit | | `/jobs/api/capture`, `/capture/status`, `/capture/extract` | bearer capture token | the userscript | | `/jobs/api/admin/capture-token` (GET/POST/DELETE) | admin | the token, from the Settings page | diff --git a/gqlgen.yml b/gqlgen.yml index 6107284..1193272 100644 --- a/gqlgen.yml +++ b/gqlgen.yml @@ -35,6 +35,11 @@ models: fields: deletedAt: resolver: false + events: + resolver: true + JobApplicationEvent: + model: + - adam-french.co.uk/job-tracker/internal/models.JobApplicationEvent JobAppReference: model: - adam-french.co.uk/job-tracker/internal/models.JobAppReference diff --git a/internal/claude/posting.go b/internal/claude/posting.go index ef44570..a738044 100644 --- a/internal/claude/posting.go +++ b/internal/claude/posting.go @@ -33,7 +33,11 @@ Return ONLY a JSON object with these exact keys: - "jobTitle": string - the role advertised, as the posting words it, without the company or location. "" if the page is not a job posting. - "company": string - the company that is hiring, not the job board hosting the advert. "" if it is not stated. - "location": string or null - where the job is based, e.g. "London, UK". -- "notes": string or null - one short line giving salary, contract type and working arrangement where the posting states them, e.g. "£70-85k, permanent, hybrid 2 days". null if it states none of them. +- "salaryRange": string or null - stated salary or range, without inventing currency. null if absent. +- "workArrangement": string or null - remote, hybrid or onsite, including useful detail. null if absent. +- "applicationSource": string or null - the board or source named by the page, e.g. LinkedIn or Greenhouse. null if absent. +- "requisitionId": string or null - the job/requisition/reference ID if stated. null if absent. +- "notes": string or null - one short line for contract type or other useful detail not covered above. null if absent. No text, no markdown, no explanation. Just the JSON object.` @@ -42,10 +46,14 @@ No text, no markdown, no explanation. Just the JSON object.` // filled in by hand, which is a better outcome than an error. The JSON tags // are also what the capture endpoint returns to the userscript. type JobPosting struct { - JobTitle string `json:"jobTitle"` - Company string `json:"company"` - Location *string `json:"location"` - Notes *string `json:"notes"` + JobTitle string `json:"jobTitle"` + Company string `json:"company"` + Location *string `json:"location"` + Notes *string `json:"notes"` + SalaryRange *string `json:"salaryRange,omitempty"` + WorkArrangement *string `json:"workArrangement,omitempty"` + ApplicationSource *string `json:"applicationSource,omitempty"` + RequisitionID *string `json:"requisitionId,omitempty"` } // tidy trims every field and turns a blank optional one into nil. A null @@ -55,6 +63,10 @@ func (p *JobPosting) tidy() error { p.Company = strings.TrimSpace(p.Company) p.Location = blankIsNil(p.Location) p.Notes = blankIsNil(p.Notes) + p.SalaryRange = blankIsNil(p.SalaryRange) + p.WorkArrangement = blankIsNil(p.WorkArrangement) + p.ApplicationSource = blankIsNil(p.ApplicationSource) + p.RequisitionID = blankIsNil(p.RequisitionID) return nil } diff --git a/internal/graph/generated.go b/internal/graph/generated.go index c180077..84deb49 100644 --- a/internal/graph/generated.go +++ b/internal/graph/generated.go @@ -32,6 +32,7 @@ func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { type Config = graphql.Config[ResolverRoot, DirectiveRoot, ComplexityRoot] type ResolverRoot interface { + JobApplication() JobApplicationResolver Mutation() MutationResolver Query() QueryResolver } @@ -41,6 +42,32 @@ type DirectiveRoot struct { } type ComplexityRoot struct { + Analytics struct { + AverageDaysToInterview func(childComplexity int) int + AverageDaysToOffer func(childComplexity int) int + AverageDaysToResponse func(childComplexity int) int + InterviewCount func(childComplexity int) int + InterviewRate func(childComplexity int) int + OfferCount func(childComplexity int) int + OfferRate func(childComplexity int) int + ResponseCount func(childComplexity int) int + ResponseRate func(childComplexity int) int + StatusCounts func(childComplexity int) int + TotalApplications func(childComplexity int) int + Transitions func(childComplexity int) int + } + + AnalyticsStatusCount struct { + Count func(childComplexity int) int + Status func(childComplexity int) int + } + + AnalyticsTransition struct { + Count func(childComplexity int) int + From func(childComplexity int) int + To func(childComplexity int) int + } + JobAppReference struct { Category func(childComplexity int) int CreatedAt func(childComplexity int) int @@ -52,17 +79,42 @@ type ComplexityRoot struct { } JobApplication struct { - AppliedAt func(childComplexity int) int - Company func(childComplexity int) int - CreatedAt func(childComplexity int) int - Description func(childComplexity int) int - ID func(childComplexity int) int - JobTitle func(childComplexity int) int - Location func(childComplexity int) int - Notes func(childComplexity int) int - Status func(childComplexity int) int - URL func(childComplexity int) int - UpdatedAt func(childComplexity int) int + ApplicationSource func(childComplexity int) int + AppliedAt func(childComplexity int) int + Company func(childComplexity int) int + ContactEmail func(childComplexity int) int + ContactName func(childComplexity int) int + ContactRole func(childComplexity int) int + CreatedAt func(childComplexity int) int + Description func(childComplexity int) int + Events func(childComplexity int) int + ID func(childComplexity int) int + JobTitle func(childComplexity int) int + LastContactedAt func(childComplexity int) int + Location func(childComplexity int) int + NextAction func(childComplexity int) int + NextActionAt func(childComplexity int) int + Notes func(childComplexity int) int + RequisitionID func(childComplexity int) int + ResumeVersion func(childComplexity int) int + SalaryRange func(childComplexity int) int + Status func(childComplexity int) int + URL func(childComplexity int) int + UpdatedAt func(childComplexity int) int + WorkArrangement func(childComplexity int) int + } + + JobApplicationEvent struct { + ContactEmail func(childComplexity int) int + ContactName func(childComplexity int) int + ContactRole func(childComplexity int) int + CreatedAt func(childComplexity int) int + ID func(childComplexity int) int + JobApplicationID func(childComplexity int) int + Kind func(childComplexity int) int + Note func(childComplexity int) int + OccurredAt func(childComplexity int) int + Source func(childComplexity int) int } JobLead struct { @@ -115,6 +167,10 @@ type ComplexityRoot struct { } Mutation struct { + AddJobApplicationEvent func(childComplexity int, applicationID int, input model.AddJobApplicationEventInput) int + BulkDismissJobLeads func(childComplexity int, ids []int) int + BulkPromoteJobLeads func(childComplexity int, ids []int) int + BulkRestoreJobLeads func(childComplexity int, ids []int) int CreateJobAppReference func(childComplexity int, input model.CreateJobAppReferenceInput) int CreateJobApplication func(childComplexity int, input model.CreateJobApplicationInput) int CreateJobSource func(childComplexity int, input model.CreateJobSourceInput) int @@ -134,14 +190,16 @@ type ComplexityRoot struct { } Query struct { - JobAppReferences func(childComplexity int) int - JobApplication func(childComplexity int, id int) int - JobApplications func(childComplexity int) int - JobLead func(childComplexity int, id int) int - JobLeadSyncStatus func(childComplexity int) int - JobLeads func(childComplexity int, state *string, includeUnmatched *bool) int - JobSearchProfile func(childComplexity int) int - JobSources func(childComplexity int) int + Analytics func(childComplexity int) int + JobAppReferences func(childComplexity int) int + JobApplication func(childComplexity int, id int) int + JobApplicationEvents func(childComplexity int, applicationID int) int + JobApplications func(childComplexity int) int + JobLead func(childComplexity int, id int) int + JobLeadSyncStatus func(childComplexity int) int + JobLeads func(childComplexity int, state *string, includeUnmatched *bool, filters *model.JobLeadFilters) int + JobSearchProfile func(childComplexity int) int + JobSources func(childComplexity int) int } } @@ -149,6 +207,9 @@ type ComplexityRoot struct { // region ************************** generated!.gotpl ************************** +type JobApplicationResolver interface { + Events(ctx context.Context, obj *models.JobApplication) ([]*models.JobApplicationEvent, error) +} type MutationResolver interface { CreateJobAppReference(ctx context.Context, input model.CreateJobAppReferenceInput) (*models.JobAppReference, error) UpdateJobAppReference(ctx context.Context, id int, input model.UpdateJobAppReferenceInput) (*models.JobAppReference, error) @@ -156,12 +217,16 @@ type MutationResolver interface { CreateJobApplication(ctx context.Context, input model.CreateJobApplicationInput) (*models.JobApplication, error) UpdateJobApplication(ctx context.Context, id int, input model.UpdateJobApplicationInput) (*models.JobApplication, error) DeleteJobApplication(ctx context.Context, id int) (bool, error) + AddJobApplicationEvent(ctx context.Context, applicationID int, input model.AddJobApplicationEventInput) (*models.JobApplicationEvent, error) CreateJobSource(ctx context.Context, input model.CreateJobSourceInput) (*models.JobSource, error) UpdateJobSource(ctx context.Context, id int, input model.UpdateJobSourceInput) (*models.JobSource, error) DeleteJobSource(ctx context.Context, id int) (bool, error) DismissJobLead(ctx context.Context, id int) (*models.JobLead, error) RestoreJobLead(ctx context.Context, id int) (*models.JobLead, error) PromoteJobLead(ctx context.Context, id int) (*models.JobLead, error) + BulkDismissJobLeads(ctx context.Context, ids []int) ([]*models.JobLead, error) + BulkRestoreJobLeads(ctx context.Context, ids []int) ([]*models.JobLead, error) + BulkPromoteJobLeads(ctx context.Context, ids []int) ([]*models.JobLead, error) UpdateJobSearchProfile(ctx context.Context, input model.UpdateJobSearchProfileInput) (*models.JobSearchProfile, error) RunJobLeadSync(ctx context.Context) (bool, error) ScoreJobLeads(ctx context.Context) (bool, error) @@ -171,8 +236,10 @@ type QueryResolver interface { JobAppReferences(ctx context.Context) ([]*models.JobAppReference, error) JobApplications(ctx context.Context) ([]*models.JobApplication, error) JobApplication(ctx context.Context, id int) (*models.JobApplication, error) + JobApplicationEvents(ctx context.Context, applicationID int) ([]*models.JobApplicationEvent, error) + Analytics(ctx context.Context) (*model.Analytics, error) JobSources(ctx context.Context) ([]*models.JobSource, error) - JobLeads(ctx context.Context, state *string, includeUnmatched *bool) ([]*models.JobLead, error) + JobLeads(ctx context.Context, state *string, includeUnmatched *bool, filters *model.JobLeadFilters) ([]*models.JobLead, error) JobLead(ctx context.Context, id int) (*models.JobLead, error) JobSearchProfile(ctx context.Context) (*models.JobSearchProfile, error) JobLeadSyncStatus(ctx context.Context) (*model.JobLeadSyncStatus, error) @@ -196,6 +263,111 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin _ = ec switch typeName + "." + field { + case "Analytics.averageDaysToInterview": + if e.ComplexityRoot.Analytics.AverageDaysToInterview == nil { + break + } + + return e.ComplexityRoot.Analytics.AverageDaysToInterview(childComplexity), true + case "Analytics.averageDaysToOffer": + if e.ComplexityRoot.Analytics.AverageDaysToOffer == nil { + break + } + + return e.ComplexityRoot.Analytics.AverageDaysToOffer(childComplexity), true + case "Analytics.averageDaysToResponse": + if e.ComplexityRoot.Analytics.AverageDaysToResponse == nil { + break + } + + return e.ComplexityRoot.Analytics.AverageDaysToResponse(childComplexity), true + case "Analytics.interviewCount": + if e.ComplexityRoot.Analytics.InterviewCount == nil { + break + } + + return e.ComplexityRoot.Analytics.InterviewCount(childComplexity), true + case "Analytics.interviewRate": + if e.ComplexityRoot.Analytics.InterviewRate == nil { + break + } + + return e.ComplexityRoot.Analytics.InterviewRate(childComplexity), true + case "Analytics.offerCount": + if e.ComplexityRoot.Analytics.OfferCount == nil { + break + } + + return e.ComplexityRoot.Analytics.OfferCount(childComplexity), true + case "Analytics.offerRate": + if e.ComplexityRoot.Analytics.OfferRate == nil { + break + } + + return e.ComplexityRoot.Analytics.OfferRate(childComplexity), true + case "Analytics.responseCount": + if e.ComplexityRoot.Analytics.ResponseCount == nil { + break + } + + return e.ComplexityRoot.Analytics.ResponseCount(childComplexity), true + case "Analytics.responseRate": + if e.ComplexityRoot.Analytics.ResponseRate == nil { + break + } + + return e.ComplexityRoot.Analytics.ResponseRate(childComplexity), true + case "Analytics.statusCounts": + if e.ComplexityRoot.Analytics.StatusCounts == nil { + break + } + + return e.ComplexityRoot.Analytics.StatusCounts(childComplexity), true + case "Analytics.totalApplications": + if e.ComplexityRoot.Analytics.TotalApplications == nil { + break + } + + return e.ComplexityRoot.Analytics.TotalApplications(childComplexity), true + case "Analytics.transitions": + if e.ComplexityRoot.Analytics.Transitions == nil { + break + } + + return e.ComplexityRoot.Analytics.Transitions(childComplexity), true + + case "AnalyticsStatusCount.count": + if e.ComplexityRoot.AnalyticsStatusCount.Count == nil { + break + } + + return e.ComplexityRoot.AnalyticsStatusCount.Count(childComplexity), true + case "AnalyticsStatusCount.status": + if e.ComplexityRoot.AnalyticsStatusCount.Status == nil { + break + } + + return e.ComplexityRoot.AnalyticsStatusCount.Status(childComplexity), true + + case "AnalyticsTransition.count": + if e.ComplexityRoot.AnalyticsTransition.Count == nil { + break + } + + return e.ComplexityRoot.AnalyticsTransition.Count(childComplexity), true + case "AnalyticsTransition.from": + if e.ComplexityRoot.AnalyticsTransition.From == nil { + break + } + + return e.ComplexityRoot.AnalyticsTransition.From(childComplexity), true + case "AnalyticsTransition.to": + if e.ComplexityRoot.AnalyticsTransition.To == nil { + break + } + + return e.ComplexityRoot.AnalyticsTransition.To(childComplexity), true + case "JobAppReference.category": if e.ComplexityRoot.JobAppReference.Category == nil { break @@ -239,6 +411,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.JobAppReference.Value(childComplexity), true + case "JobApplication.applicationSource": + if e.ComplexityRoot.JobApplication.ApplicationSource == nil { + break + } + + return e.ComplexityRoot.JobApplication.ApplicationSource(childComplexity), true case "JobApplication.appliedAt": if e.ComplexityRoot.JobApplication.AppliedAt == nil { break @@ -251,6 +429,24 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin } return e.ComplexityRoot.JobApplication.Company(childComplexity), true + case "JobApplication.contactEmail": + if e.ComplexityRoot.JobApplication.ContactEmail == nil { + break + } + + return e.ComplexityRoot.JobApplication.ContactEmail(childComplexity), true + case "JobApplication.contactName": + if e.ComplexityRoot.JobApplication.ContactName == nil { + break + } + + return e.ComplexityRoot.JobApplication.ContactName(childComplexity), true + case "JobApplication.contactRole": + if e.ComplexityRoot.JobApplication.ContactRole == nil { + break + } + + return e.ComplexityRoot.JobApplication.ContactRole(childComplexity), true case "JobApplication.createdAt": if e.ComplexityRoot.JobApplication.CreatedAt == nil { break @@ -263,6 +459,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin } return e.ComplexityRoot.JobApplication.Description(childComplexity), true + case "JobApplication.events": + if e.ComplexityRoot.JobApplication.Events == nil { + break + } + + return e.ComplexityRoot.JobApplication.Events(childComplexity), true case "JobApplication.id": if e.ComplexityRoot.JobApplication.ID == nil { break @@ -275,18 +477,54 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin } return e.ComplexityRoot.JobApplication.JobTitle(childComplexity), true + case "JobApplication.lastContactedAt": + if e.ComplexityRoot.JobApplication.LastContactedAt == nil { + break + } + + return e.ComplexityRoot.JobApplication.LastContactedAt(childComplexity), true case "JobApplication.location": if e.ComplexityRoot.JobApplication.Location == nil { break } return e.ComplexityRoot.JobApplication.Location(childComplexity), true + case "JobApplication.nextAction": + if e.ComplexityRoot.JobApplication.NextAction == nil { + break + } + + return e.ComplexityRoot.JobApplication.NextAction(childComplexity), true + case "JobApplication.nextActionAt": + if e.ComplexityRoot.JobApplication.NextActionAt == nil { + break + } + + return e.ComplexityRoot.JobApplication.NextActionAt(childComplexity), true case "JobApplication.notes": if e.ComplexityRoot.JobApplication.Notes == nil { break } return e.ComplexityRoot.JobApplication.Notes(childComplexity), true + case "JobApplication.requisitionId": + if e.ComplexityRoot.JobApplication.RequisitionID == nil { + break + } + + return e.ComplexityRoot.JobApplication.RequisitionID(childComplexity), true + case "JobApplication.resumeVersion": + if e.ComplexityRoot.JobApplication.ResumeVersion == nil { + break + } + + return e.ComplexityRoot.JobApplication.ResumeVersion(childComplexity), true + case "JobApplication.salaryRange": + if e.ComplexityRoot.JobApplication.SalaryRange == nil { + break + } + + return e.ComplexityRoot.JobApplication.SalaryRange(childComplexity), true case "JobApplication.status": if e.ComplexityRoot.JobApplication.Status == nil { break @@ -305,6 +543,73 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin } return e.ComplexityRoot.JobApplication.UpdatedAt(childComplexity), true + case "JobApplication.workArrangement": + if e.ComplexityRoot.JobApplication.WorkArrangement == nil { + break + } + + return e.ComplexityRoot.JobApplication.WorkArrangement(childComplexity), true + + case "JobApplicationEvent.contactEmail": + if e.ComplexityRoot.JobApplicationEvent.ContactEmail == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.ContactEmail(childComplexity), true + case "JobApplicationEvent.contactName": + if e.ComplexityRoot.JobApplicationEvent.ContactName == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.ContactName(childComplexity), true + case "JobApplicationEvent.contactRole": + if e.ComplexityRoot.JobApplicationEvent.ContactRole == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.ContactRole(childComplexity), true + case "JobApplicationEvent.createdAt": + if e.ComplexityRoot.JobApplicationEvent.CreatedAt == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.CreatedAt(childComplexity), true + case "JobApplicationEvent.id": + if e.ComplexityRoot.JobApplicationEvent.ID == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.ID(childComplexity), true + case "JobApplicationEvent.jobApplicationId": + if e.ComplexityRoot.JobApplicationEvent.JobApplicationID == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.JobApplicationID(childComplexity), true + case "JobApplicationEvent.kind": + if e.ComplexityRoot.JobApplicationEvent.Kind == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.Kind(childComplexity), true + case "JobApplicationEvent.note": + if e.ComplexityRoot.JobApplicationEvent.Note == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.Note(childComplexity), true + case "JobApplicationEvent.occurredAt": + if e.ComplexityRoot.JobApplicationEvent.OccurredAt == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.OccurredAt(childComplexity), true + case "JobApplicationEvent.source": + if e.ComplexityRoot.JobApplicationEvent.Source == nil { + break + } + + return e.ComplexityRoot.JobApplicationEvent.Source(childComplexity), true case "JobLead.company": if e.ComplexityRoot.JobLead.Company == nil { @@ -532,6 +837,50 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.JobSource.UpdatedAt(childComplexity), true + case "Mutation.addJobApplicationEvent": + if e.ComplexityRoot.Mutation.AddJobApplicationEvent == nil { + break + } + + args, err := ec.field_Mutation_addJobApplicationEvent_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.AddJobApplicationEvent(childComplexity, args["applicationId"].(int), args["input"].(model.AddJobApplicationEventInput)), true + case "Mutation.bulkDismissJobLeads": + if e.ComplexityRoot.Mutation.BulkDismissJobLeads == nil { + break + } + + args, err := ec.field_Mutation_bulkDismissJobLeads_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.BulkDismissJobLeads(childComplexity, args["ids"].([]int)), true + case "Mutation.bulkPromoteJobLeads": + if e.ComplexityRoot.Mutation.BulkPromoteJobLeads == nil { + break + } + + args, err := ec.field_Mutation_bulkPromoteJobLeads_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.BulkPromoteJobLeads(childComplexity, args["ids"].([]int)), true + case "Mutation.bulkRestoreJobLeads": + if e.ComplexityRoot.Mutation.BulkRestoreJobLeads == nil { + break + } + + args, err := ec.field_Mutation_bulkRestoreJobLeads_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Mutation.BulkRestoreJobLeads(childComplexity, args["ids"].([]int)), true case "Mutation.createJobAppReference": if e.ComplexityRoot.Mutation.CreateJobAppReference == nil { break @@ -694,6 +1043,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.ComplexityRoot.Mutation.UpdateJobSource(childComplexity, args["id"].(int), args["input"].(model.UpdateJobSourceInput)), true + case "Query.analytics": + if e.ComplexityRoot.Query.Analytics == nil { + break + } + + return e.ComplexityRoot.Query.Analytics(childComplexity), true + case "Query.jobAppReferences": if e.ComplexityRoot.Query.JobAppReferences == nil { break @@ -711,6 +1067,17 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin } return e.ComplexityRoot.Query.JobApplication(childComplexity, args["id"].(int)), true + case "Query.jobApplicationEvents": + if e.ComplexityRoot.Query.JobApplicationEvents == nil { + break + } + + args, err := ec.field_Query_jobApplicationEvents_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.ComplexityRoot.Query.JobApplicationEvents(childComplexity, args["applicationId"].(int)), true case "Query.jobApplications": if e.ComplexityRoot.Query.JobApplications == nil { break @@ -744,7 +1111,7 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return 0, false } - return e.ComplexityRoot.Query.JobLeads(childComplexity, args["state"].(*string), args["includeUnmatched"].(*bool)), true + return e.ComplexityRoot.Query.JobLeads(childComplexity, args["state"].(*string), args["includeUnmatched"].(*bool), args["filters"].(*model.JobLeadFilters)), true case "Query.jobSearchProfile": if e.ComplexityRoot.Query.JobSearchProfile == nil { break @@ -766,9 +1133,11 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { opCtx := graphql.GetOperationContext(ctx) ec := newExecutionContext(opCtx, e, make(chan graphql.DeferredResult)) inputUnmarshalMap := graphql.BuildUnmarshalerMap( + ec.unmarshalInputAddJobApplicationEventInput, ec.unmarshalInputCreateJobAppReferenceInput, ec.unmarshalInputCreateJobApplicationInput, ec.unmarshalInputCreateJobSourceInput, + ec.unmarshalInputJobLeadFilters, ec.unmarshalInputUpdateJobAppReferenceInput, ec.unmarshalInputUpdateJobApplicationInput, ec.unmarshalInputUpdateJobSearchProfileInput, @@ -870,6 +1239,58 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) // Each function is generated once per unique object type, deduplicating the // switch statements that were previously inlined in every fieldContext_* function. +func (ec *executionContext) childFields_Analytics(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "totalApplications": + return ec.fieldContext_Analytics_totalApplications(ctx, field) + case "statusCounts": + return ec.fieldContext_Analytics_statusCounts(ctx, field) + case "transitions": + return ec.fieldContext_Analytics_transitions(ctx, field) + case "responseCount": + return ec.fieldContext_Analytics_responseCount(ctx, field) + case "interviewCount": + return ec.fieldContext_Analytics_interviewCount(ctx, field) + case "offerCount": + return ec.fieldContext_Analytics_offerCount(ctx, field) + case "responseRate": + return ec.fieldContext_Analytics_responseRate(ctx, field) + case "interviewRate": + return ec.fieldContext_Analytics_interviewRate(ctx, field) + case "offerRate": + return ec.fieldContext_Analytics_offerRate(ctx, field) + case "averageDaysToResponse": + return ec.fieldContext_Analytics_averageDaysToResponse(ctx, field) + case "averageDaysToInterview": + return ec.fieldContext_Analytics_averageDaysToInterview(ctx, field) + case "averageDaysToOffer": + return ec.fieldContext_Analytics_averageDaysToOffer(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Analytics", field.Name) +} + +func (ec *executionContext) childFields_AnalyticsStatusCount(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "status": + return ec.fieldContext_AnalyticsStatusCount_status(ctx, field) + case "count": + return ec.fieldContext_AnalyticsStatusCount_count(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AnalyticsStatusCount", field.Name) +} + +func (ec *executionContext) childFields_AnalyticsTransition(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "from": + return ec.fieldContext_AnalyticsTransition_from(ctx, field) + case "to": + return ec.fieldContext_AnalyticsTransition_to(ctx, field) + case "count": + return ec.fieldContext_AnalyticsTransition_count(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AnalyticsTransition", field.Name) +} + func (ec *executionContext) childFields_JobAppReference(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": @@ -914,10 +1335,60 @@ func (ec *executionContext) childFields_JobApplication(ctx context.Context, fiel return ec.fieldContext_JobApplication_appliedAt(ctx, field) case "description": return ec.fieldContext_JobApplication_description(ctx, field) + case "nextAction": + return ec.fieldContext_JobApplication_nextAction(ctx, field) + case "nextActionAt": + return ec.fieldContext_JobApplication_nextActionAt(ctx, field) + case "contactName": + return ec.fieldContext_JobApplication_contactName(ctx, field) + case "contactEmail": + return ec.fieldContext_JobApplication_contactEmail(ctx, field) + case "contactRole": + return ec.fieldContext_JobApplication_contactRole(ctx, field) + case "salaryRange": + return ec.fieldContext_JobApplication_salaryRange(ctx, field) + case "workArrangement": + return ec.fieldContext_JobApplication_workArrangement(ctx, field) + case "applicationSource": + return ec.fieldContext_JobApplication_applicationSource(ctx, field) + case "resumeVersion": + return ec.fieldContext_JobApplication_resumeVersion(ctx, field) + case "requisitionId": + return ec.fieldContext_JobApplication_requisitionId(ctx, field) + case "lastContactedAt": + return ec.fieldContext_JobApplication_lastContactedAt(ctx, field) + case "events": + return ec.fieldContext_JobApplication_events(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type JobApplication", field.Name) } +func (ec *executionContext) childFields_JobApplicationEvent(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_JobApplicationEvent_id(ctx, field) + case "createdAt": + return ec.fieldContext_JobApplicationEvent_createdAt(ctx, field) + case "jobApplicationId": + return ec.fieldContext_JobApplicationEvent_jobApplicationId(ctx, field) + case "kind": + return ec.fieldContext_JobApplicationEvent_kind(ctx, field) + case "occurredAt": + return ec.fieldContext_JobApplicationEvent_occurredAt(ctx, field) + case "note": + return ec.fieldContext_JobApplicationEvent_note(ctx, field) + case "source": + return ec.fieldContext_JobApplicationEvent_source(ctx, field) + case "contactName": + return ec.fieldContext_JobApplicationEvent_contactName(ctx, field) + case "contactEmail": + return ec.fieldContext_JobApplicationEvent_contactEmail(ctx, field) + case "contactRole": + return ec.fieldContext_JobApplicationEvent_contactRole(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type JobApplicationEvent", field.Name) +} + func (ec *executionContext) childFields_JobLead(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "id": @@ -1132,6 +1603,70 @@ func (ec *executionContext) childFields___Type(ctx context.Context, field graphq // region ***************************** args.gotpl ***************************** +func (ec *executionContext) field_Mutation_addJobApplicationEvent_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "applicationId", + func(ctx context.Context, v any) (int, error) { + return ec.unmarshalNID2int(ctx, v) + }) + if err != nil { + return nil, err + } + args["applicationId"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "input", + func(ctx context.Context, v any) (model.AddJobApplicationEventInput, error) { + return ec.unmarshalNAddJobApplicationEventInput2adamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAddJobApplicationEventInput(ctx, v) + }) + if err != nil { + return nil, err + } + args["input"] = arg1 + return args, nil +} + +func (ec *executionContext) field_Mutation_bulkDismissJobLeads_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "ids", + func(ctx context.Context, v any) ([]int, error) { + return ec.unmarshalNID2ᚕintᚄ(ctx, v) + }) + if err != nil { + return nil, err + } + args["ids"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_bulkPromoteJobLeads_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "ids", + func(ctx context.Context, v any) ([]int, error) { + return ec.unmarshalNID2ᚕintᚄ(ctx, v) + }) + if err != nil { + return nil, err + } + args["ids"] = arg0 + return args, nil +} + +func (ec *executionContext) field_Mutation_bulkRestoreJobLeads_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "ids", + func(ctx context.Context, v any) ([]int, error) { + return ec.unmarshalNID2ᚕintᚄ(ctx, v) + }) + if err != nil { + return nil, err + } + args["ids"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_createJobAppReference_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1352,6 +1887,20 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } +func (ec *executionContext) field_Query_jobApplicationEvents_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "applicationId", + func(ctx context.Context, v any) (int, error) { + return ec.unmarshalNID2int(ctx, v) + }) + if err != nil { + return nil, err + } + args["applicationId"] = arg0 + return args, nil +} + func (ec *executionContext) field_Query_jobApplication_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1399,6 +1948,14 @@ func (ec *executionContext) field_Query_jobLeads_args(ctx context.Context, rawAr return nil, err } args["includeUnmatched"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "filters", + func(ctx context.Context, v any) (*model.JobLeadFilters, error) { + return ec.unmarshalOJobLeadFilters2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐJobLeadFilters(ctx, v) + }) + if err != nil { + return nil, err + } + args["filters"] = arg2 return args, nil } @@ -1462,6 +2019,415 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region **************************** field.gotpl ***************************** +func (ec *executionContext) _Analytics_totalApplications(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_totalApplications(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.TotalApplications, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Analytics_totalApplications(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _Analytics_statusCounts(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_statusCounts(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.StatusCounts, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model.AnalyticsStatusCount) graphql.Marshaler { + return ec.marshalNAnalyticsStatusCount2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalyticsStatusCountᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Analytics_statusCounts(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Analytics", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_AnalyticsStatusCount(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Analytics_transitions(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_transitions(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Transitions, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*model.AnalyticsTransition) graphql.Marshaler { + return ec.marshalNAnalyticsTransition2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalyticsTransitionᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Analytics_transitions(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Analytics", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_AnalyticsTransition(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _Analytics_responseCount(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_responseCount(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ResponseCount, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Analytics_responseCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _Analytics_interviewCount(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_interviewCount(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.InterviewCount, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Analytics_interviewCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _Analytics_offerCount(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_offerCount(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.OfferCount, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Analytics_offerCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _Analytics_responseRate(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_responseRate(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ResponseRate, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v float64) graphql.Marshaler { + return ec.marshalNFloat2float64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Analytics_responseRate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Float does not have child fields")) +} + +func (ec *executionContext) _Analytics_interviewRate(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_interviewRate(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.InterviewRate, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v float64) graphql.Marshaler { + return ec.marshalNFloat2float64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Analytics_interviewRate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Float does not have child fields")) +} + +func (ec *executionContext) _Analytics_offerRate(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_offerRate(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.OfferRate, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v float64) graphql.Marshaler { + return ec.marshalNFloat2float64(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Analytics_offerRate(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Float does not have child fields")) +} + +func (ec *executionContext) _Analytics_averageDaysToResponse(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_averageDaysToResponse(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.AverageDaysToResponse, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *float64) graphql.Marshaler { + return ec.marshalOFloat2ᚖfloat64(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Analytics_averageDaysToResponse(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Float does not have child fields")) +} + +func (ec *executionContext) _Analytics_averageDaysToInterview(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_averageDaysToInterview(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.AverageDaysToInterview, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *float64) graphql.Marshaler { + return ec.marshalOFloat2ᚖfloat64(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Analytics_averageDaysToInterview(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Float does not have child fields")) +} + +func (ec *executionContext) _Analytics_averageDaysToOffer(ctx context.Context, field graphql.CollectedField, obj *model.Analytics) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Analytics_averageDaysToOffer(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.AverageDaysToOffer, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *float64) graphql.Marshaler { + return ec.marshalOFloat2ᚖfloat64(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_Analytics_averageDaysToOffer(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("Analytics", field, false, false, errors.New("field of type Float does not have child fields")) +} + +func (ec *executionContext) _AnalyticsStatusCount_status(ctx context.Context, field graphql.CollectedField, obj *model.AnalyticsStatusCount) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AnalyticsStatusCount_status(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Status, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_AnalyticsStatusCount_status(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("AnalyticsStatusCount", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _AnalyticsStatusCount_count(ctx context.Context, field graphql.CollectedField, obj *model.AnalyticsStatusCount) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AnalyticsStatusCount_count(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Count, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_AnalyticsStatusCount_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("AnalyticsStatusCount", field, false, false, errors.New("field of type Int does not have child fields")) +} + +func (ec *executionContext) _AnalyticsTransition_from(ctx context.Context, field graphql.CollectedField, obj *model.AnalyticsTransition) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AnalyticsTransition_from(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.From, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_AnalyticsTransition_from(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("AnalyticsTransition", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _AnalyticsTransition_to(ctx context.Context, field graphql.CollectedField, obj *model.AnalyticsTransition) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AnalyticsTransition_to(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.To, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_AnalyticsTransition_to(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("AnalyticsTransition", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _AnalyticsTransition_count(ctx context.Context, field graphql.CollectedField, obj *model.AnalyticsTransition) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_AnalyticsTransition_count(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Count, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v int) graphql.Marshaler { + return ec.marshalNInt2int(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_AnalyticsTransition_count(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("AnalyticsTransition", field, false, false, errors.New("field of type Int does not have child fields")) +} + func (ec *executionContext) _JobAppReference_id(ctx context.Context, field graphql.CollectedField, obj *models.JobAppReference) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -1876,6 +2842,521 @@ func (ec *executionContext) fieldContext_JobApplication_description(_ context.Co return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) } +func (ec *executionContext) _JobApplication_nextAction(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_nextAction(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.NextAction, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_nextAction(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplication_nextActionAt(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_nextActionAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.NextActionAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *time.Time) graphql.Marshaler { + return ec.marshalOTime2ᚖtimeᚐTime(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_nextActionAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _JobApplication_contactName(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_contactName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ContactName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_contactName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplication_contactEmail(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_contactEmail(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ContactEmail, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_contactEmail(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplication_contactRole(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_contactRole(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ContactRole, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_contactRole(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplication_salaryRange(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_salaryRange(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.SalaryRange, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_salaryRange(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplication_workArrangement(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_workArrangement(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.WorkArrangement, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_workArrangement(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplication_applicationSource(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_applicationSource(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ApplicationSource, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_applicationSource(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplication_resumeVersion(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_resumeVersion(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ResumeVersion, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_resumeVersion(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplication_requisitionId(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_requisitionId(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.RequisitionID, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_requisitionId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplication_lastContactedAt(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_lastContactedAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.LastContactedAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *time.Time) graphql.Marshaler { + return ec.marshalOTime2ᚖtimeᚐTime(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplication_lastContactedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplication", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _JobApplication_events(ctx context.Context, field graphql.CollectedField, obj *models.JobApplication) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplication_events(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.JobApplication().Events(ctx, obj) + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v []*models.JobApplicationEvent) graphql.Marshaler { + return ec.marshalNJobApplicationEvent2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobApplicationEventᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_JobApplication_events(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "JobApplication", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_JobApplicationEvent(ctx, field) + }, + } + return fc, nil +} + +func (ec *executionContext) _JobApplicationEvent_id(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_id(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ID, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v uint) graphql.Marshaler { + return ec.marshalNID2uint(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _JobApplicationEvent_createdAt(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_createdAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.CreatedAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _JobApplicationEvent_jobApplicationId(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_jobApplicationId(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.JobApplicationID, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v uint) graphql.Marshaler { + return ec.marshalNID2uint(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_jobApplicationId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type ID does not have child fields")) +} + +func (ec *executionContext) _JobApplicationEvent_kind(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_kind(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Kind, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplicationEvent_occurredAt(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_occurredAt(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.OccurredAt, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v time.Time) graphql.Marshaler { + return ec.marshalNTime2timeᚐTime(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_occurredAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type Time does not have child fields")) +} + +func (ec *executionContext) _JobApplicationEvent_note(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_note(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Note, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_note(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplicationEvent_source(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_source(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.Source, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v string) graphql.Marshaler { + return ec.marshalNString2string(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_source(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplicationEvent_contactName(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_contactName(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ContactName, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_contactName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplicationEvent_contactEmail(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_contactEmail(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ContactEmail, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_contactEmail(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type String does not have child fields")) +} + +func (ec *executionContext) _JobApplicationEvent_contactRole(ctx context.Context, field graphql.CollectedField, obj *models.JobApplicationEvent) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_JobApplicationEvent_contactRole(ctx, field) + }, + func(ctx context.Context) (any, error) { + return obj.ContactRole, nil + }, + nil, + func(ctx context.Context, selections ast.SelectionSet, v *string) graphql.Marshaler { + return ec.marshalOString2ᚖstring(ctx, selections, v) + }, + true, + false, + ) +} +func (ec *executionContext) fieldContext_JobApplicationEvent_contactRole(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + return graphql.NewScalarFieldContext("JobApplicationEvent", field, false, false, errors.New("field of type String does not have child fields")) +} + func (ec *executionContext) _JobLead_id(ctx context.Context, field graphql.CollectedField, obj *models.JobLead) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -3069,6 +4550,63 @@ func (ec *executionContext) fieldContext_Mutation_deleteJobApplication(ctx conte return fc, nil } +func (ec *executionContext) _Mutation_addJobApplicationEvent(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_addJobApplicationEvent(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().AddJobApplicationEvent(ctx, fc.Args["applicationId"].(int), fc.Args["input"].(model.AddJobApplicationEventInput)) + }, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + if ec.Directives.Admin == nil { + var zeroVal *models.JobApplicationEvent + return zeroVal, errors.New("directive admin is not implemented") + } + return ec.Directives.Admin(ctx, nil, directive0) + } + + next = directive1 + return next + }, + func(ctx context.Context, selections ast.SelectionSet, v *models.JobApplicationEvent) graphql.Marshaler { + return ec.marshalNJobApplicationEvent2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobApplicationEvent(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Mutation_addJobApplicationEvent(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_JobApplicationEvent(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_addJobApplicationEvent_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Mutation_createJobSource(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -3411,6 +4949,177 @@ func (ec *executionContext) fieldContext_Mutation_promoteJobLead(ctx context.Con return fc, nil } +func (ec *executionContext) _Mutation_bulkDismissJobLeads(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_bulkDismissJobLeads(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().BulkDismissJobLeads(ctx, fc.Args["ids"].([]int)) + }, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + if ec.Directives.Admin == nil { + var zeroVal []*models.JobLead + return zeroVal, errors.New("directive admin is not implemented") + } + return ec.Directives.Admin(ctx, nil, directive0) + } + + next = directive1 + return next + }, + func(ctx context.Context, selections ast.SelectionSet, v []*models.JobLead) graphql.Marshaler { + return ec.marshalNJobLead2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobLeadᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Mutation_bulkDismissJobLeads(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_JobLead(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_bulkDismissJobLeads_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_bulkRestoreJobLeads(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_bulkRestoreJobLeads(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().BulkRestoreJobLeads(ctx, fc.Args["ids"].([]int)) + }, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + if ec.Directives.Admin == nil { + var zeroVal []*models.JobLead + return zeroVal, errors.New("directive admin is not implemented") + } + return ec.Directives.Admin(ctx, nil, directive0) + } + + next = directive1 + return next + }, + func(ctx context.Context, selections ast.SelectionSet, v []*models.JobLead) graphql.Marshaler { + return ec.marshalNJobLead2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobLeadᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Mutation_bulkRestoreJobLeads(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_JobLead(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_bulkRestoreJobLeads_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_bulkPromoteJobLeads(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Mutation_bulkPromoteJobLeads(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Mutation().BulkPromoteJobLeads(ctx, fc.Args["ids"].([]int)) + }, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + if ec.Directives.Admin == nil { + var zeroVal []*models.JobLead + return zeroVal, errors.New("directive admin is not implemented") + } + return ec.Directives.Admin(ctx, nil, directive0) + } + + next = directive1 + return next + }, + func(ctx context.Context, selections ast.SelectionSet, v []*models.JobLead) graphql.Marshaler { + return ec.marshalNJobLead2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobLeadᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Mutation_bulkPromoteJobLeads(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_JobLead(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_bulkPromoteJobLeads_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Mutation_updateJobSearchProfile(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -3723,6 +5432,108 @@ func (ec *executionContext) fieldContext_Query_jobApplication(ctx context.Contex return fc, nil } +func (ec *executionContext) _Query_jobApplicationEvents(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_jobApplicationEvents(ctx, field) + }, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return ec.Resolvers.Query().JobApplicationEvents(ctx, fc.Args["applicationId"].(int)) + }, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + if ec.Directives.Admin == nil { + var zeroVal []*models.JobApplicationEvent + return zeroVal, errors.New("directive admin is not implemented") + } + return ec.Directives.Admin(ctx, nil, directive0) + } + + next = directive1 + return next + }, + func(ctx context.Context, selections ast.SelectionSet, v []*models.JobApplicationEvent) graphql.Marshaler { + return ec.marshalNJobApplicationEvent2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobApplicationEventᚄ(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_jobApplicationEvents(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_JobApplicationEvent(ctx, field) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Query_jobApplicationEvents_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Query_analytics(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.fieldContext_Query_analytics(ctx, field) + }, + func(ctx context.Context) (any, error) { + return ec.Resolvers.Query().Analytics(ctx) + }, + func(ctx context.Context, next graphql.Resolver) graphql.Resolver { + directive0 := next + + directive1 := func(ctx context.Context) (any, error) { + if ec.Directives.Admin == nil { + var zeroVal *model.Analytics + return zeroVal, errors.New("directive admin is not implemented") + } + return ec.Directives.Admin(ctx, nil, directive0) + } + + next = directive1 + return next + }, + func(ctx context.Context, selections ast.SelectionSet, v *model.Analytics) graphql.Marshaler { + return ec.marshalNAnalytics2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalytics(ctx, selections, v) + }, + true, + true, + ) +} +func (ec *executionContext) fieldContext_Query_analytics(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return ec.childFields_Analytics(ctx, field) + }, + } + return fc, nil +} + func (ec *executionContext) _Query_jobSources(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -3778,7 +5589,7 @@ func (ec *executionContext) _Query_jobLeads(ctx context.Context, field graphql.C }, func(ctx context.Context) (any, error) { fc := graphql.GetFieldContext(ctx) - return ec.Resolvers.Query().JobLeads(ctx, fc.Args["state"].(*string), fc.Args["includeUnmatched"].(*bool)) + return ec.Resolvers.Query().JobLeads(ctx, fc.Args["state"].(*string), fc.Args["includeUnmatched"].(*bool), fc.Args["filters"].(*model.JobLeadFilters)) }, func(ctx context.Context, next graphql.Resolver) graphql.Resolver { directive0 := next @@ -5107,6 +6918,78 @@ func (ec *executionContext) fieldContext___Type_isOneOf(_ context.Context, field // region **************************** input.gotpl ***************************** +func (ec *executionContext) unmarshalInputAddJobApplicationEventInput(ctx context.Context, obj any) (model.AddJobApplicationEventInput, error) { + var it model.AddJobApplicationEventInput + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"kind", "occurredAt", "note", "source", "contactName", "contactEmail", "contactRole"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "kind": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Kind = data + case "occurredAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("occurredAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.OccurredAt = data + case "note": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("note")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Note = data + case "source": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("source")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Source = data + case "contactName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contactName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContactName = data + case "contactEmail": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contactEmail")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContactEmail = data + case "contactRole": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contactRole")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContactRole = data + } + } + return it, nil +} + func (ec *executionContext) unmarshalInputCreateJobAppReferenceInput(ctx context.Context, obj any) (model.CreateJobAppReferenceInput, error) { var it model.CreateJobAppReferenceInput if obj == nil { @@ -5169,7 +7052,7 @@ func (ec *executionContext) unmarshalInputCreateJobApplicationInput(ctx context. asMap[k] = v } - fieldsInOrder := [...]string{"jobTitle", "company", "location", "url", "status", "notes", "appliedAt", "description"} + fieldsInOrder := [...]string{"jobTitle", "company", "location", "url", "status", "notes", "appliedAt", "description", "nextAction", "nextActionAt", "contactName", "contactEmail", "contactRole", "salaryRange", "workArrangement", "applicationSource", "resumeVersion", "requisitionId", "lastContactedAt"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -5232,6 +7115,83 @@ func (ec *executionContext) unmarshalInputCreateJobApplicationInput(ctx context. return it, err } it.Description = data + case "nextAction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextAction")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NextAction = data + case "nextActionAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextActionAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.NextActionAt = data + case "contactName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contactName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContactName = data + case "contactEmail": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contactEmail")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContactEmail = data + case "contactRole": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contactRole")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContactRole = data + case "salaryRange": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("salaryRange")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SalaryRange = data + case "workArrangement": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("workArrangement")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.WorkArrangement = data + case "applicationSource": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("applicationSource")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ApplicationSource = data + case "resumeVersion": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resumeVersion")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ResumeVersion = data + case "requisitionId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requisitionId")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.RequisitionID = data + case "lastContactedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastContactedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastContactedAt = data } } return it, nil @@ -5302,6 +7262,64 @@ func (ec *executionContext) unmarshalInputCreateJobSourceInput(ctx context.Conte return it, nil } +func (ec *executionContext) unmarshalInputJobLeadFilters(ctx context.Context, obj any) (model.JobLeadFilters, error) { + var it model.JobLeadFilters + if obj == nil { + return it, nil + } + + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"sourceKind", "minScore", "maxScore", "location", "company"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "sourceKind": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("sourceKind")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SourceKind = data + case "minScore": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("minScore")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.MinScore = data + case "maxScore": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("maxScore")) + data, err := ec.unmarshalOInt2ᚖint(ctx, v) + if err != nil { + return it, err + } + it.MaxScore = data + case "location": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("location")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Location = data + case "company": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("company")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Company = data + } + } + return it, nil +} + func (ec *executionContext) unmarshalInputUpdateJobAppReferenceInput(ctx context.Context, obj any) (model.UpdateJobAppReferenceInput, error) { var it model.UpdateJobAppReferenceInput if obj == nil { @@ -5364,7 +7382,7 @@ func (ec *executionContext) unmarshalInputUpdateJobApplicationInput(ctx context. asMap[k] = v } - fieldsInOrder := [...]string{"jobTitle", "company", "location", "url", "status", "notes", "appliedAt", "description"} + fieldsInOrder := [...]string{"jobTitle", "company", "location", "url", "status", "notes", "appliedAt", "description", "nextAction", "nextActionAt", "clearNextActionAt", "contactName", "contactEmail", "contactRole", "salaryRange", "workArrangement", "applicationSource", "resumeVersion", "requisitionId", "lastContactedAt"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -5427,6 +7445,90 @@ func (ec *executionContext) unmarshalInputUpdateJobApplicationInput(ctx context. return it, err } it.Description = data + case "nextAction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextAction")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.NextAction = data + case "nextActionAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nextActionAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.NextActionAt = data + case "clearNextActionAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearNextActionAt")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.ClearNextActionAt = data + case "contactName": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contactName")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContactName = data + case "contactEmail": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contactEmail")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContactEmail = data + case "contactRole": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("contactRole")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ContactRole = data + case "salaryRange": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("salaryRange")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.SalaryRange = data + case "workArrangement": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("workArrangement")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.WorkArrangement = data + case "applicationSource": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("applicationSource")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ApplicationSource = data + case "resumeVersion": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("resumeVersion")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.ResumeVersion = data + case "requisitionId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("requisitionId")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.RequisitionID = data + case "lastContactedAt": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("lastContactedAt")) + data, err := ec.unmarshalOTime2ᚖtimeᚐTime(ctx, v) + if err != nil { + return it, err + } + it.LastContactedAt = data } } return it, nil @@ -5563,6 +7665,190 @@ func (ec *executionContext) unmarshalInputUpdateJobSourceInput(ctx context.Conte // region **************************** object.gotpl **************************** +var analyticsImplementors = []string{"Analytics"} + +func (ec *executionContext) _Analytics(ctx context.Context, sel ast.SelectionSet, obj *model.Analytics) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, analyticsImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Analytics") + case "totalApplications": + out.Values[i] = ec._Analytics_totalApplications(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "statusCounts": + out.Values[i] = ec._Analytics_statusCounts(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "transitions": + out.Values[i] = ec._Analytics_transitions(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "responseCount": + out.Values[i] = ec._Analytics_responseCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "interviewCount": + out.Values[i] = ec._Analytics_interviewCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "offerCount": + out.Values[i] = ec._Analytics_offerCount(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "responseRate": + out.Values[i] = ec._Analytics_responseRate(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "interviewRate": + out.Values[i] = ec._Analytics_interviewRate(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "offerRate": + out.Values[i] = ec._Analytics_offerRate(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "averageDaysToResponse": + out.Values[i] = ec._Analytics_averageDaysToResponse(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "averageDaysToInterview": + out.Values[i] = ec._Analytics_averageDaysToInterview(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "averageDaysToOffer": + out.Values[i] = ec._Analytics_averageDaysToOffer(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var analyticsStatusCountImplementors = []string{"AnalyticsStatusCount"} + +func (ec *executionContext) _AnalyticsStatusCount(ctx context.Context, sel ast.SelectionSet, obj *model.AnalyticsStatusCount) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, analyticsStatusCountImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("AnalyticsStatusCount") + case "status": + out.Values[i] = ec._AnalyticsStatusCount_status(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "count": + out.Values[i] = ec._AnalyticsStatusCount_count(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var analyticsTransitionImplementors = []string{"AnalyticsTransition"} + +func (ec *executionContext) _AnalyticsTransition(ctx context.Context, sel ast.SelectionSet, obj *model.AnalyticsTransition) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, analyticsTransitionImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("AnalyticsTransition") + case "from": + out.Values[i] = ec._AnalyticsTransition_from(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "to": + out.Values[i] = ec._AnalyticsTransition_to(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "count": + out.Values[i] = ec._AnalyticsTransition_count(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + var jobAppReferenceImplementors = []string{"JobAppReference"} func (ec *executionContext) _JobAppReference(ctx context.Context, sel ast.SelectionSet, obj *models.JobAppReference) graphql.Marshaler { @@ -5646,55 +7932,231 @@ func (ec *executionContext) _JobApplication(ctx context.Context, sel ast.Selecti case "id": out.Values[i] = ec._JobApplication_id(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "createdAt": out.Values[i] = ec._JobApplication_createdAt(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "updatedAt": out.Values[i] = ec._JobApplication_updatedAt(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "jobTitle": out.Values[i] = ec._JobApplication_jobTitle(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "company": out.Values[i] = ec._JobApplication_company(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "location": out.Values[i] = ec._JobApplication_location(ctx, field, obj) if out.Values[i] == graphql.RequiredNull { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "url": out.Values[i] = ec._JobApplication_url(ctx, field, obj) if out.Values[i] == graphql.RequiredNull { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "status": out.Values[i] = ec._JobApplication_status(ctx, field, obj) if out.Values[i] == graphql.Null { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "notes": out.Values[i] = ec._JobApplication_notes(ctx, field, obj) if out.Values[i] == graphql.RequiredNull { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "appliedAt": out.Values[i] = ec._JobApplication_appliedAt(ctx, field, obj) if out.Values[i] == graphql.RequiredNull { - out.Invalids++ + atomic.AddUint32(&out.Invalids, 1) } case "description": out.Values[i] = ec._JobApplication_description(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "nextAction": + out.Values[i] = ec._JobApplication_nextAction(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "nextActionAt": + out.Values[i] = ec._JobApplication_nextActionAt(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "contactName": + out.Values[i] = ec._JobApplication_contactName(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "contactEmail": + out.Values[i] = ec._JobApplication_contactEmail(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "contactRole": + out.Values[i] = ec._JobApplication_contactRole(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "salaryRange": + out.Values[i] = ec._JobApplication_salaryRange(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "workArrangement": + out.Values[i] = ec._JobApplication_workArrangement(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "applicationSource": + out.Values[i] = ec._JobApplication_applicationSource(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "resumeVersion": + out.Values[i] = ec._JobApplication_resumeVersion(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "requisitionId": + out.Values[i] = ec._JobApplication_requisitionId(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "lastContactedAt": + out.Values[i] = ec._JobApplication_lastContactedAt(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + atomic.AddUint32(&out.Invalids, 1) + } + case "events": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._JobApplication_events(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.IsDeferred() { + deferredFieldSet.AddField(field) + fieldIndex := len(deferredFieldSet.Values) - 1 + deferredFieldSet.Concurrently(fieldIndex, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, deferredFieldSet) + }) + + for _, deferrable := range field.Deferrables { + view, ok := deferLabelToView[deferrable.Label] + if !ok { + view = deferredFieldSet.NewView() + deferLabelToView[deferrable.Label] = view + } + view.AddIndices(fieldIndex) + } + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.Deferred, int32(min(len(deferLabelToView), math.MaxInt32))) + + ec.ProcessDeferredGroup(graphql.DeferredGroup{ + Defers: deferLabelToView, + Path: graphql.GetPath(ctx), + FieldSet: deferredFieldSet, + Context: ctx, + }) + + return out +} + +var jobApplicationEventImplementors = []string{"JobApplicationEvent"} + +func (ec *executionContext) _JobApplicationEvent(ctx context.Context, sel ast.SelectionSet, obj *models.JobApplicationEvent) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, jobApplicationEventImplementors) + + out := graphql.NewFieldSet(fields) + deferredFieldSet := graphql.NewFieldSet(nil) + deferLabelToView := make(map[string]*graphql.FieldSetView) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("JobApplicationEvent") + case "id": + out.Values[i] = ec._JobApplicationEvent_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "createdAt": + out.Values[i] = ec._JobApplicationEvent_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "jobApplicationId": + out.Values[i] = ec._JobApplicationEvent_jobApplicationId(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "kind": + out.Values[i] = ec._JobApplicationEvent_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "occurredAt": + out.Values[i] = ec._JobApplicationEvent_occurredAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "note": + out.Values[i] = ec._JobApplicationEvent_note(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "source": + out.Values[i] = ec._JobApplicationEvent_source(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "contactName": + out.Values[i] = ec._JobApplicationEvent_contactName(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "contactEmail": + out.Values[i] = ec._JobApplicationEvent_contactEmail(ctx, field, obj) + if out.Values[i] == graphql.RequiredNull { + out.Invalids++ + } + case "contactRole": + out.Values[i] = ec._JobApplicationEvent_contactRole(ctx, field, obj) if out.Values[i] == graphql.RequiredNull { out.Invalids++ } @@ -6098,6 +8560,13 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "addJobApplicationEvent": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_addJobApplicationEvent(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "createJobSource": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_createJobSource(ctx, field) @@ -6140,6 +8609,27 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "bulkDismissJobLeads": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_bulkDismissJobLeads(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "bulkRestoreJobLeads": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_bulkRestoreJobLeads(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "bulkPromoteJobLeads": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_bulkPromoteJobLeads(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } case "updateJobSearchProfile": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_updateJobSearchProfile(ctx, field) @@ -6274,6 +8764,50 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "jobApplicationEvents": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_jobApplicationEvents(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "analytics": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_analytics(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "jobSources": field := field @@ -6812,6 +9346,73 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** +func (ec *executionContext) unmarshalNAddJobApplicationEventInput2adamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAddJobApplicationEventInput(ctx context.Context, v any) (model.AddJobApplicationEventInput, error) { + res, err := ec.unmarshalInputAddJobApplicationEventInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNAnalytics2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalytics(ctx context.Context, sel ast.SelectionSet, v *model.Analytics) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._Analytics(ctx, sel, v) +} + +func (ec *executionContext) marshalNAnalyticsStatusCount2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalyticsStatusCountᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AnalyticsStatusCount) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNAnalyticsStatusCount2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalyticsStatusCount(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNAnalyticsStatusCount2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalyticsStatusCount(ctx context.Context, sel ast.SelectionSet, v *model.AnalyticsStatusCount) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._AnalyticsStatusCount(ctx, sel, v) +} + +func (ec *executionContext) marshalNAnalyticsTransition2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalyticsTransitionᚄ(ctx context.Context, sel ast.SelectionSet, v []*model.AnalyticsTransition) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNAnalyticsTransition2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalyticsTransition(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNAnalyticsTransition2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐAnalyticsTransition(ctx context.Context, sel ast.SelectionSet, v *model.AnalyticsTransition) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._AnalyticsTransition(ctx, sel, v) +} + func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v any) (bool, error) { res, err := graphql.UnmarshalBoolean(v) return res, graphql.ErrorOnPath(ctx, err) @@ -6843,6 +9444,22 @@ func (ec *executionContext) unmarshalNCreateJobSourceInput2adamᚑfrenchᚗcoᚗ return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v any) (float64, error) { + res, err := graphql.UnmarshalFloatContext(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { + _ = sel + res := graphql.MarshalFloatContext(v) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + } + return graphql.WrapContextMarshaler(ctx, res) +} + func (ec *executionContext) unmarshalNID2int(ctx context.Context, v any) (int, error) { res, err := graphql.UnmarshalIntID(v) return res, graphql.ErrorOnPath(ctx, err) @@ -6875,6 +9492,35 @@ func (ec *executionContext) marshalNID2uint(ctx context.Context, sel ast.Selecti return res } +func (ec *executionContext) unmarshalNID2ᚕintᚄ(ctx context.Context, v any) ([]int, error) { + vSlice := graphql.CoerceList(v) + var err error + res := make([]int, len(vSlice)) + for i := range vSlice { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) + res[i], err = ec.unmarshalNID2int(ctx, vSlice[i]) + if err != nil { + return nil, err + } + } + return res, nil +} + +func (ec *executionContext) marshalNID2ᚕintᚄ(ctx context.Context, sel ast.SelectionSet, v []int) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + for i := range v { + ret[i] = ec.marshalNID2int(ctx, sel, v[i]) + } + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v any) (int, error) { res, err := graphql.UnmarshalInt(v) return res, graphql.ErrorOnPath(ctx, err) @@ -6943,6 +9589,32 @@ func (ec *executionContext) marshalNJobApplication2ᚖadamᚑfrenchᚗcoᚗukᚋ return ec._JobApplication(ctx, sel, v) } +func (ec *executionContext) marshalNJobApplicationEvent2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobApplicationEventᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.JobApplicationEvent) graphql.Marshaler { + ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { + fc := graphql.GetFieldContext(ctx) + fc.Result = &v[i] + return ec.marshalNJobApplicationEvent2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobApplicationEvent(ctx, sel, v[i]) + }) + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNJobApplicationEvent2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobApplicationEvent(ctx context.Context, sel ast.SelectionSet, v *models.JobApplicationEvent) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._JobApplicationEvent(ctx, sel, v) +} + func (ec *executionContext) marshalNJobLead2ᚕᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋmodelsᚐJobLeadᚄ(ctx context.Context, sel ast.SelectionSet, v []*models.JobLead) graphql.Marshaler { ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler { fc := graphql.GetFieldContext(ctx) @@ -7253,6 +9925,23 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast return res } +func (ec *executionContext) unmarshalOFloat2ᚖfloat64(ctx context.Context, v any) (*float64, error) { + if v == nil { + return nil, nil + } + res, err := graphql.UnmarshalFloatContext(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalOFloat2ᚖfloat64(ctx context.Context, sel ast.SelectionSet, v *float64) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + res := graphql.MarshalFloatContext(*v) + return graphql.WrapContextMarshaler(ctx, res) +} + func (ec *executionContext) unmarshalOID2ᚖuint(ctx context.Context, v any) (*uint, error) { if v == nil { return nil, nil @@ -7303,6 +9992,14 @@ func (ec *executionContext) marshalOJobLead2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑt return ec._JobLead(ctx, sel, v) } +func (ec *executionContext) unmarshalOJobLeadFilters2ᚖadamᚑfrenchᚗcoᚗukᚋjobᚑtrackerᚋinternalᚋgraphᚋmodelᚐJobLeadFilters(ctx context.Context, v any) (*model.JobLeadFilters, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputJobLeadFilters(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalOJobStatus2ᚖstring(ctx context.Context, v any) (*string, error) { if v == nil { return nil, nil diff --git a/internal/graph/job_application.resolvers.go b/internal/graph/job_application.resolvers.go index a6dd2d5..7ea331b 100644 --- a/internal/graph/job_application.resolvers.go +++ b/internal/graph/job_application.resolvers.go @@ -12,8 +12,14 @@ import ( "adam-french.co.uk/job-tracker/internal/graph/model" "adam-french.co.uk/job-tracker/internal/models" + "adam-french.co.uk/job-tracker/internal/services" ) +// Events is the resolver for the events field. +func (r *jobApplicationResolver) Events(ctx context.Context, obj *models.JobApplication) ([]*models.JobApplicationEvent, error) { + return services.ListApplicationEvents(r.Store.DB, obj.ID) +} + // CreateJobApplication is the resolver for the createJobApplication field. func (r *mutationResolver) CreateJobApplication(ctx context.Context, input model.CreateJobApplicationInput) (*models.JobApplication, error) { // String! is non-null but not non-empty, and the columns are only @@ -36,10 +42,19 @@ func (r *mutationResolver) CreateJobApplication(ctx context.Context, input model Notes: input.Notes, AppliedAt: input.AppliedAt, Description: input.Description, + NextAction: input.NextAction, NextActionAt: input.NextActionAt, + ContactName: input.ContactName, ContactEmail: input.ContactEmail, + ContactRole: input.ContactRole, LastContactedAt: input.LastContactedAt, + SalaryRange: input.SalaryRange, WorkArrangement: input.WorkArrangement, + ApplicationSource: input.ApplicationSource, ResumeVersion: input.ResumeVersion, + RequisitionID: input.RequisitionID, } if err := r.Store.DB.Create(&app).Error; err != nil { return nil, err } + if _, err := services.RecordApplicationEvent(r.Store.DB, app.ID, services.ApplicationEventInput{Kind: "created", Source: "graphql"}); err != nil { + return nil, err + } return &app, nil } @@ -54,6 +69,7 @@ func (r *mutationResolver) UpdateJobApplication(ctx context.Context, id int, inp if err := r.Store.DB.First(&app, id).Error; err != nil { return nil, err } + oldStatus := app.Status if input.JobTitle != nil { if strings.TrimSpace(*input.JobTitle) == "" { return nil, fmt.Errorf("jobTitle cannot be empty") @@ -84,9 +100,53 @@ func (r *mutationResolver) UpdateJobApplication(ctx context.Context, id int, inp if input.Description != nil { app.Description = input.Description } + if input.NextAction != nil { + app.NextAction = input.NextAction + } + if input.NextActionAt != nil { + app.NextActionAt = input.NextActionAt + } + if input.ClearNextActionAt != nil && *input.ClearNextActionAt { + app.NextActionAt = nil + } + if input.ContactName != nil { + app.ContactName = input.ContactName + } + if input.ContactEmail != nil { + app.ContactEmail = input.ContactEmail + } + if input.ContactRole != nil { + app.ContactRole = input.ContactRole + } + if input.SalaryRange != nil { + app.SalaryRange = input.SalaryRange + } + if input.WorkArrangement != nil { + app.WorkArrangement = input.WorkArrangement + } + if input.ApplicationSource != nil { + app.ApplicationSource = input.ApplicationSource + } + if input.ResumeVersion != nil { + app.ResumeVersion = input.ResumeVersion + } + if input.RequisitionID != nil { + app.RequisitionID = input.RequisitionID + } + if input.LastContactedAt != nil { + app.LastContactedAt = input.LastContactedAt + } if err := r.Store.DB.Save(&app).Error; err != nil { return nil, err } + if _, err := services.RecordApplicationEvent(r.Store.DB, app.ID, services.ApplicationEventInput{Kind: "updated", Source: "graphql"}); err != nil { + return nil, err + } + if oldStatus != app.Status { + if _, err := services.RecordApplicationEvent(r.Store.DB, app.ID, services.ApplicationEventInput{Kind: "status_changed", Source: "graphql", Note: stringPtr(oldStatus + " -> " + app.Status)}); err != nil { + return nil, err + } + } return &app, nil } @@ -109,6 +169,19 @@ func (r *mutationResolver) DeleteJobApplication(ctx context.Context, id int) (bo return true, nil } +// AddJobApplicationEvent appends a user-entered follow-up or contact event. +func (r *mutationResolver) AddJobApplicationEvent(ctx context.Context, applicationID int, input model.AddJobApplicationEventInput) (*models.JobApplicationEvent, error) { + var app models.JobApplication + if err := r.Store.DB.First(&app, applicationID).Error; err != nil { + return nil, err + } + return services.RecordApplicationEvent(r.Store.DB, uint(applicationID), services.ApplicationEventInput{ + Kind: input.Kind, OccurredAt: timeValue(input.OccurredAt), Note: input.Note, + Source: stringValue(input.Source), ContactName: input.ContactName, + ContactEmail: input.ContactEmail, ContactRole: input.ContactRole, + }) +} + // JobApplications is the resolver for the jobApplications field. func (r *queryResolver) JobApplications(ctx context.Context) ([]*models.JobApplication, error) { // Admin-only even though it is a query (@admin in the schema): job @@ -137,3 +210,36 @@ func (r *queryResolver) JobApplication(ctx context.Context, id int) (*models.Job } return &app, nil } + +// JobApplicationEvents is the explicit activity-history query for clients that +// do not need the rest of the application object. +func (r *queryResolver) JobApplicationEvents(ctx context.Context, applicationID int) ([]*models.JobApplicationEvent, error) { + return services.ListApplicationEvents(r.Store.DB, uint(applicationID)) +} + +// Analytics is calculated from the same application and activity history used +// by the tracker, so the dashboard does not maintain a second data model. +func (r *queryResolver) Analytics(ctx context.Context) (*model.Analytics, error) { + stats, err := services.LoadAnalytics(r.Store.DB) + if err != nil { + return nil, err + } + result := &model.Analytics{ + TotalApplications: stats.TotalApplications, ResponseCount: stats.ResponseCount, + InterviewCount: stats.InterviewCount, OfferCount: stats.OfferCount, + ResponseRate: stats.ResponseRate, InterviewRate: stats.InterviewRate, OfferRate: stats.OfferRate, + AverageDaysToResponse: stats.AverageDaysToResponse, AverageDaysToInterview: stats.AverageDaysToInterview, AverageDaysToOffer: stats.AverageDaysToOffer, + } + for _, item := range stats.StatusCounts { + result.StatusCounts = append(result.StatusCounts, &model.AnalyticsStatusCount{Status: item.Status, Count: item.Count}) + } + for _, item := range stats.Transitions { + result.Transitions = append(result.Transitions, &model.AnalyticsTransition{From: item.From, To: item.To, Count: item.Count}) + } + return result, nil +} + +// JobApplication returns JobApplicationResolver implementation. +func (r *Resolver) JobApplication() JobApplicationResolver { return &jobApplicationResolver{r} } + +type jobApplicationResolver struct{ *Resolver } diff --git a/internal/graph/job_application_helpers.go b/internal/graph/job_application_helpers.go new file mode 100644 index 0000000..44af325 --- /dev/null +++ b/internal/graph/job_application_helpers.go @@ -0,0 +1,19 @@ +package graph + +import "time" + +func timeValue(value *time.Time) time.Time { + if value == nil { + return time.Now() + } + return *value +} + +func stringValue(value *string) string { + if value == nil { + return "" + } + return *value +} + +func stringPtr(value string) *string { return &value } diff --git a/internal/graph/job_lead.resolvers.go b/internal/graph/job_lead.resolvers.go index 756e4e4..4047932 100644 --- a/internal/graph/job_lead.resolvers.go +++ b/internal/graph/job_lead.resolvers.go @@ -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 diff --git a/internal/graph/model/models_gen.go b/internal/graph/model/models_gen.go index f48efc6..5f1f5bd 100644 --- a/internal/graph/model/models_gen.go +++ b/internal/graph/model/models_gen.go @@ -6,6 +6,42 @@ import ( "time" ) +type AddJobApplicationEventInput struct { + Kind string `json:"kind"` + OccurredAt *time.Time `json:"occurredAt,omitempty"` + Note *string `json:"note,omitempty"` + Source *string `json:"source,omitempty"` + ContactName *string `json:"contactName,omitempty"` + ContactEmail *string `json:"contactEmail,omitempty"` + ContactRole *string `json:"contactRole,omitempty"` +} + +type Analytics struct { + TotalApplications int `json:"totalApplications"` + StatusCounts []*AnalyticsStatusCount `json:"statusCounts"` + Transitions []*AnalyticsTransition `json:"transitions"` + ResponseCount int `json:"responseCount"` + InterviewCount int `json:"interviewCount"` + OfferCount int `json:"offerCount"` + ResponseRate float64 `json:"responseRate"` + InterviewRate float64 `json:"interviewRate"` + OfferRate float64 `json:"offerRate"` + AverageDaysToResponse *float64 `json:"averageDaysToResponse,omitempty"` + AverageDaysToInterview *float64 `json:"averageDaysToInterview,omitempty"` + AverageDaysToOffer *float64 `json:"averageDaysToOffer,omitempty"` +} + +type AnalyticsStatusCount struct { + Status string `json:"status"` + Count int `json:"count"` +} + +type AnalyticsTransition struct { + From string `json:"from"` + To string `json:"to"` + Count int `json:"count"` +} + type CreateJobAppReferenceInput struct { Category string `json:"category"` Label string `json:"label"` @@ -14,14 +50,25 @@ type CreateJobAppReferenceInput struct { } type CreateJobApplicationInput struct { - JobTitle string `json:"jobTitle"` - Company string `json:"company"` - Location *string `json:"location,omitempty"` - URL *string `json:"url,omitempty"` - Status string `json:"status"` - Notes *string `json:"notes,omitempty"` - AppliedAt *time.Time `json:"appliedAt,omitempty"` - Description *string `json:"description,omitempty"` + JobTitle string `json:"jobTitle"` + Company string `json:"company"` + Location *string `json:"location,omitempty"` + URL *string `json:"url,omitempty"` + Status string `json:"status"` + Notes *string `json:"notes,omitempty"` + AppliedAt *time.Time `json:"appliedAt,omitempty"` + Description *string `json:"description,omitempty"` + NextAction *string `json:"nextAction,omitempty"` + NextActionAt *time.Time `json:"nextActionAt,omitempty"` + ContactName *string `json:"contactName,omitempty"` + ContactEmail *string `json:"contactEmail,omitempty"` + ContactRole *string `json:"contactRole,omitempty"` + SalaryRange *string `json:"salaryRange,omitempty"` + WorkArrangement *string `json:"workArrangement,omitempty"` + ApplicationSource *string `json:"applicationSource,omitempty"` + ResumeVersion *string `json:"resumeVersion,omitempty"` + RequisitionID *string `json:"requisitionId,omitempty"` + LastContactedAt *time.Time `json:"lastContactedAt,omitempty"` } type CreateJobSourceInput struct { @@ -33,6 +80,14 @@ type CreateJobSourceInput struct { Enabled *bool `json:"enabled,omitempty"` } +type JobLeadFilters struct { + SourceKind *string `json:"sourceKind,omitempty"` + MinScore *int `json:"minScore,omitempty"` + MaxScore *int `json:"maxScore,omitempty"` + Location *string `json:"location,omitempty"` + Company *string `json:"company,omitempty"` +} + type JobLeadSyncStatus struct { Running bool `json:"running"` LastRunAt *time.Time `json:"lastRunAt,omitempty"` @@ -53,14 +108,26 @@ type UpdateJobAppReferenceInput struct { } type UpdateJobApplicationInput struct { - JobTitle *string `json:"jobTitle,omitempty"` - Company *string `json:"company,omitempty"` - Location *string `json:"location,omitempty"` - URL *string `json:"url,omitempty"` - Status *string `json:"status,omitempty"` - Notes *string `json:"notes,omitempty"` - AppliedAt *time.Time `json:"appliedAt,omitempty"` - Description *string `json:"description,omitempty"` + JobTitle *string `json:"jobTitle,omitempty"` + Company *string `json:"company,omitempty"` + Location *string `json:"location,omitempty"` + URL *string `json:"url,omitempty"` + Status *string `json:"status,omitempty"` + Notes *string `json:"notes,omitempty"` + AppliedAt *time.Time `json:"appliedAt,omitempty"` + Description *string `json:"description,omitempty"` + NextAction *string `json:"nextAction,omitempty"` + NextActionAt *time.Time `json:"nextActionAt,omitempty"` + ClearNextActionAt *bool `json:"clearNextActionAt,omitempty"` + ContactName *string `json:"contactName,omitempty"` + ContactEmail *string `json:"contactEmail,omitempty"` + ContactRole *string `json:"contactRole,omitempty"` + SalaryRange *string `json:"salaryRange,omitempty"` + WorkArrangement *string `json:"workArrangement,omitempty"` + ApplicationSource *string `json:"applicationSource,omitempty"` + ResumeVersion *string `json:"resumeVersion,omitempty"` + RequisitionID *string `json:"requisitionId,omitempty"` + LastContactedAt *time.Time `json:"lastContactedAt,omitempty"` } type UpdateJobSearchProfileInput struct { diff --git a/internal/graph/schema/job_application.graphql b/internal/graph/schema/job_application.graphql index 5bb12b2..7f4af2c 100644 --- a/internal/graph/schema/job_application.graphql +++ b/internal/graph/schema/job_application.graphql @@ -43,6 +43,57 @@ type JobApplication { notes: String appliedAt: Time description: String + nextAction: String + nextActionAt: Time + contactName: String + contactEmail: String + contactRole: String + salaryRange: String + workArrangement: String + applicationSource: String + resumeVersion: String + requisitionId: String + lastContactedAt: Time + events: [JobApplicationEvent!]! +} + +type JobApplicationEvent { + id: ID! + createdAt: Time! + jobApplicationId: ID! + kind: String! + occurredAt: Time! + note: String + source: String! + contactName: String + contactEmail: String + contactRole: String +} + +type AnalyticsStatusCount { + status: String! + count: Int! +} + +type AnalyticsTransition { + from: String! + to: String! + count: Int! +} + +type Analytics { + totalApplications: Int! + statusCounts: [AnalyticsStatusCount!]! + transitions: [AnalyticsTransition!]! + responseCount: Int! + interviewCount: Int! + offerCount: Int! + responseRate: Float! + interviewRate: Float! + offerRate: Float! + averageDaysToResponse: Float + averageDaysToInterview: Float + averageDaysToOffer: Float } input CreateJobApplicationInput { @@ -54,6 +105,17 @@ input CreateJobApplicationInput { notes: String appliedAt: Time description: String + nextAction: String + nextActionAt: Time + contactName: String + contactEmail: String + contactRole: String + salaryRange: String + workArrangement: String + applicationSource: String + resumeVersion: String + requisitionId: String + lastContactedAt: Time } input UpdateJobApplicationInput { @@ -65,11 +127,25 @@ input UpdateJobApplicationInput { notes: String appliedAt: Time description: String + nextAction: String + nextActionAt: Time + clearNextActionAt: Boolean + contactName: String + contactEmail: String + contactRole: String + salaryRange: String + workArrangement: String + applicationSource: String + resumeVersion: String + requisitionId: String + lastContactedAt: Time } extend type Query { jobApplications: [JobApplication!]! @admin jobApplication(id: ID!): JobApplication @admin + jobApplicationEvents(applicationId: ID!): [JobApplicationEvent!]! @admin + analytics: Analytics! @admin } extend type Mutation { @@ -78,4 +154,15 @@ extend type Mutation { # Errors on an id that does not exist, like the other deletes; the Boolean # is only ever true. deleteJobApplication(id: ID!): Boolean! @admin + addJobApplicationEvent(applicationId: ID!, input: AddJobApplicationEventInput!): JobApplicationEvent! @admin +} + +input AddJobApplicationEventInput { + kind: String! + occurredAt: Time + note: String + source: String + contactName: String + contactEmail: String + contactRole: String } diff --git a/internal/graph/schema/job_lead.graphql b/internal/graph/schema/job_lead.graphql index 245f957..f96ba1e 100644 --- a/internal/graph/schema/job_lead.graphql +++ b/internal/graph/schema/job_lead.graphql @@ -99,11 +99,19 @@ type JobLeadSyncStatus { lastError: String! } +input JobLeadFilters { + sourceKind: String + minScore: Int + maxScore: Int + location: String + company: String +} + extend type Query { jobSources: [JobSource!]! @admin # state filters to one of new, dismissed, promoted; omitted returns all. # Leads that failed the pre-filter are left out unless includeUnmatched. - jobLeads(state: String, includeUnmatched: Boolean): [JobLead!]! @admin + jobLeads(state: String, includeUnmatched: Boolean, filters: JobLeadFilters): [JobLead!]! @admin jobLead(id: ID!): JobLead @admin jobSearchProfile: JobSearchProfile! @admin jobLeadSyncStatus: JobLeadSyncStatus! @admin @@ -124,6 +132,9 @@ extend type Mutation { # is already tracked, links to that row instead of making a second — and # returns the lead, now promoted, with jobAppId set. promoteJobLead(id: ID!): JobLead! @admin + bulkDismissJobLeads(ids: [ID!]!): [JobLead!]! @admin + bulkRestoreJobLeads(ids: [ID!]!): [JobLead!]! @admin + bulkPromoteJobLeads(ids: [ID!]!): [JobLead!]! @admin updateJobSearchProfile(input: UpdateJobSearchProfileInput!): JobSearchProfile! @admin diff --git a/internal/handlers/handle_job_capture.go b/internal/handlers/handle_job_capture.go index 9cc6a1d..efe012b 100644 --- a/internal/handlers/handle_job_capture.go +++ b/internal/handlers/handle_job_capture.go @@ -206,6 +206,10 @@ func (store *Store) JobCapture(ctx *gin.Context) { return } input.Description = services.TruncateRunes(strings.TrimSpace(input.Description), maxPageRunes) + input.SalaryRange = services.TruncateRunes(strings.TrimSpace(input.SalaryRange), 300) + input.WorkArrangement = services.TruncateRunes(strings.TrimSpace(input.WorkArrangement), 200) + input.ApplicationSource = services.TruncateRunes(strings.TrimSpace(input.ApplicationSource), 200) + input.RequisitionID = services.TruncateRunes(strings.TrimSpace(input.RequisitionID), 100) app, action, err := services.UpsertJobApplication(store.DB, input, time.Now()) var invalid *services.JobInputError diff --git a/internal/handlers/handle_job_capture_test.go b/internal/handlers/handle_job_capture_test.go index b4fcf7f..a921311 100644 --- a/internal/handlers/handle_job_capture_test.go +++ b/internal/handlers/handle_job_capture_test.go @@ -193,7 +193,11 @@ func TestJobCaptureExtractErrors(t *testing.T) { // page text must be cut to maxPageRunes before it is sent to Claude. func TestJobCaptureExtractTruncatesAndRelays(t *testing.T) { london := "London" - f := &fakeExtractor{posting: claude.JobPosting{JobTitle: "Engineer", Company: "Acme", Location: &london}} + salary := "£70k" + arrangement := "Hybrid" + source := "LinkedIn" + requisition := "REQ-9" + f := &fakeExtractor{posting: claude.JobPosting{JobTitle: "Engineer", Company: "Acme", Location: &london, SalaryRange: &salary, WorkArrangement: &arrangement, ApplicationSource: &source, RequisitionID: &requisition}} post := extractRoute(f) long, _ := json.Marshal(map[string]string{"url": "https://x.com/1", "title": "Engineer | Acme", "text": strings.Repeat("é", maxPageRunes+500)}) @@ -207,8 +211,8 @@ func TestJobCaptureExtractTruncatesAndRelays(t *testing.T) { if n := len([]rune(f.got[2])); n != maxPageRunes { t.Fatalf("forwarded %d runes, want %d", n, maxPageRunes) } - // The body is the userscript's contract: these four keys. - if rec.Body.String() != `{"jobTitle":"Engineer","company":"Acme","location":"London","notes":null}` { + // The body is the userscript's contract, including metadata when extracted. + if rec.Body.String() != `{"jobTitle":"Engineer","company":"Acme","location":"London","notes":null,"salaryRange":"£70k","workArrangement":"Hybrid","applicationSource":"LinkedIn","requisitionId":"REQ-9"}` { t.Fatalf("body = %s", rec.Body) } diff --git a/internal/models/models.go b/internal/models/models.go index 288cf1f..b92be98 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -97,18 +97,46 @@ type ProcessedEmail struct { // postings are usually taken down long before the interview. It is large, so // list queries should not select it. type JobApplication struct { - ID uint `gorm:"primarykey" json:"id"` - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"` - JobTitle string `gorm:"not null" json:"jobTitle"` - Company string `gorm:"not null" json:"company"` - Location *string `json:"location"` - URL *string `json:"url"` - Status string `gorm:"not null" json:"status"` - Notes *string `json:"notes"` - AppliedAt *time.Time `json:"appliedAt"` - Description *string `gorm:"type:text" json:"description"` + ID uint `gorm:"primarykey" json:"id"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"` + JobTitle string `gorm:"not null" json:"jobTitle"` + Company string `gorm:"not null" json:"company"` + Location *string `json:"location"` + URL *string `json:"url"` + Status string `gorm:"not null" json:"status"` + Notes *string `json:"notes"` + AppliedAt *time.Time `json:"appliedAt"` + Description *string `gorm:"type:text" json:"description"` + NextAction *string `json:"nextAction"` + NextActionAt *time.Time `json:"nextActionAt"` + ContactName *string `json:"contactName"` + ContactEmail *string `json:"contactEmail"` + ContactRole *string `json:"contactRole"` + SalaryRange *string `json:"salaryRange"` + WorkArrangement *string `json:"workArrangement"` + ApplicationSource *string `json:"applicationSource"` + ResumeVersion *string `json:"resumeVersion"` + RequisitionID *string `json:"requisitionId"` + LastContactedAt *time.Time `json:"lastContactedAt"` + Events []*JobApplicationEvent `gorm:"foreignKey:JobApplicationID" json:"events,omitempty"` +} + +// JobApplicationEvent is an append-only audit entry for a tracked application. +// Contact fields are copied onto the event so a later contact edit does not +// rewrite the history of who was involved at the time. +type JobApplicationEvent struct { + ID uint `gorm:"primarykey" json:"id"` + CreatedAt time.Time `json:"createdAt"` + JobApplicationID uint `gorm:"index;not null" json:"jobApplicationId"` + Kind string `gorm:"not null;index" json:"kind"` + OccurredAt time.Time `gorm:"not null;index" json:"occurredAt"` + Note *string `gorm:"type:text" json:"note"` + Source string `gorm:"not null;default:manual" json:"source"` + ContactName *string `json:"contactName"` + ContactEmail *string `json:"contactEmail"` + ContactRole *string `json:"contactRole"` } // JobSource is one place the lead fetcher (services/job_leads.go) polls for diff --git a/internal/services/analytics.go b/internal/services/analytics.go new file mode 100644 index 0000000..b911b15 --- /dev/null +++ b/internal/services/analytics.go @@ -0,0 +1,199 @@ +package services + +import ( + "sort" + "strings" + "time" + + "adam-french.co.uk/job-tracker/internal/models" + "gorm.io/gorm" +) + +// Analytics is the database-independent result used by the GraphQL adapter. +// Nullable averages are represented by pointers because a missing history is +// different from a measured zero-day interval. +type Analytics struct { + TotalApplications int + StatusCounts []AnalyticsStatusCount + Transitions []AnalyticsTransition + ResponseCount int + InterviewCount int + OfferCount int + ResponseRate float64 + InterviewRate float64 + OfferRate float64 + AverageDaysToResponse *float64 + AverageDaysToInterview *float64 + AverageDaysToOffer *float64 +} + +type AnalyticsStatusCount struct { + Status string + Count int +} +type AnalyticsTransition struct { + From string + To string + Count int +} + +// LoadAnalytics reads live applications and their append-only history. Events +// belonging to soft-deleted applications are intentionally excluded. +func LoadAnalytics(db *gorm.DB) (*Analytics, error) { + var apps []*models.JobApplication + if err := db.Find(&apps).Error; err != nil { + return nil, err + } + ids := make([]uint, 0, len(apps)) + for _, app := range apps { + ids = append(ids, app.ID) + } + var events []*models.JobApplicationEvent + if len(ids) > 0 { + if err := db.Where("job_application_id IN ?", ids).Order("occurred_at ASC, id ASC").Find(&events).Error; err != nil { + return nil, err + } + } + return AggregateAnalytics(apps, events), nil +} + +// AggregateAnalytics derives funnel facts from current status and explicit +// activity history. A status transition is a response once it enters any +// post-application stage; this makes older status-only history useful too. +func AggregateAnalytics(apps []*models.JobApplication, events []*models.JobApplicationEvent) *Analytics { + result := &Analytics{TotalApplications: len(apps)} + status := map[string]int{} + appByID := make(map[uint]*models.JobApplication, len(apps)) + for _, app := range apps { + appByID[app.ID] = app + status[app.Status]++ + } + for _, s := range []string{"saved", "applied", "screening", "assessment", "interviewing", "offer", "rejected", "withdrawn"} { + if status[s] > 0 { + result.StatusCounts = append(result.StatusCounts, AnalyticsStatusCount{s, status[s]}) + } + } + for s, n := range status { + if !KnownStatus(s) { + result.StatusCounts = append(result.StatusCounts, AnalyticsStatusCount{s, n}) + } + } + sort.Slice(result.StatusCounts, func(i, j int) bool { return result.StatusCounts[i].Status < result.StatusCounts[j].Status }) + + type stages struct{ response, interview, offer *time.Time } + seen := make(map[uint]stages, len(apps)) + transitions := map[string]int{} + for _, event := range events { + app, ok := appByID[event.JobApplicationID] + if !ok { + continue + } + stage := seen[app.ID] + kind := strings.ToLower(strings.TrimSpace(event.Kind)) + from, to, isTransition := transition(event.Note) + if isTransition { + transitions[from+"\x00"+to]++ + if isResponseStage(to) && stage.response == nil { + stage.response = &event.OccurredAt + } + if to == "interviewing" && stage.interview == nil { + stage.interview = &event.OccurredAt + } + if to == "offer" && stage.offer == nil { + stage.offer = &event.OccurredAt + } + } + if kind == "response" && stage.response == nil { + stage.response = &event.OccurredAt + } + if kind == "interview" && stage.interview == nil { + stage.interview = &event.OccurredAt + } + if kind == "offer" && stage.offer == nil { + stage.offer = &event.OccurredAt + } + seen[app.ID] = stage + } + for key, count := range transitions { + parts := strings.SplitN(key, "\x00", 2) + result.Transitions = append(result.Transitions, AnalyticsTransition{parts[0], parts[1], count}) + } + sort.Slice(result.Transitions, func(i, j int) bool { + if result.Transitions[i].From == result.Transitions[j].From { + return result.Transitions[i].To < result.Transitions[j].To + } + return result.Transitions[i].From < result.Transitions[j].From + }) + for _, app := range apps { + stage := seen[app.ID] + // Older applications predate activity history. Their current status is + // still enough to establish that a response has happened. + if stage.response == nil && isResponseStage(app.Status) { + stage.response = &app.UpdatedAt + } + if stage.response != nil { + result.ResponseCount++ + } + if stage.interview != nil || app.Status == "interviewing" || app.Status == "offer" { + result.InterviewCount++ + } + if stage.offer != nil || app.Status == "offer" { + result.OfferCount++ + } + } + responseDays, interviewDays, offerDays := 0.0, 0.0, 0.0 + responseSamples, interviewSamples, offerSamples := 0, 0, 0 + for _, app := range apps { + stage := seen[app.ID] + if days, ok := daysBetween(app.AppliedAt, stage.response); ok { + responseDays += days + responseSamples++ + } + if days, ok := daysBetween(app.AppliedAt, stage.interview); ok { + interviewDays += days + interviewSamples++ + } + if days, ok := daysBetween(app.AppliedAt, stage.offer); ok { + offerDays += days + offerSamples++ + } + } + if responseSamples > 0 { + value := responseDays / float64(responseSamples) + result.AverageDaysToResponse = &value + } + if interviewSamples > 0 { + value := interviewDays / float64(interviewSamples) + result.AverageDaysToInterview = &value + } + if offerSamples > 0 { + value := offerDays / float64(offerSamples) + result.AverageDaysToOffer = &value + } + if result.TotalApplications > 0 { + result.ResponseRate = float64(result.ResponseCount) / float64(result.TotalApplications) + result.InterviewRate = float64(result.InterviewCount) / float64(result.TotalApplications) + result.OfferRate = float64(result.OfferCount) / float64(result.TotalApplications) + } + return result +} + +func transition(note *string) (string, string, bool) { + if note == nil { + return "", "", false + } + parts := strings.SplitN(*note, " -> ", 2) + if len(parts) != 2 { + return "", "", false + } + return strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1]), true +} +func isResponseStage(status string) bool { + return status == "screening" || status == "assessment" || status == "interviewing" || status == "offer" || status == "rejected" +} +func daysBetween(applied *time.Time, event *time.Time) (float64, bool) { + if applied == nil || event == nil || event.Before(*applied) { + return 0, false + } + return event.Sub(*applied).Hours() / 24, true +} diff --git a/internal/services/analytics_test.go b/internal/services/analytics_test.go new file mode 100644 index 0000000..0f98307 --- /dev/null +++ b/internal/services/analytics_test.go @@ -0,0 +1,41 @@ +package services + +import ( + "testing" + "time" + + "adam-french.co.uk/job-tracker/internal/models" +) + +func TestAggregateAnalyticsCountsFunnelAndTransitions(t *testing.T) { + base := time.Date(2026, 1, 1, 9, 0, 0, 0, time.UTC) + applied := base.Add(24 * time.Hour) + apps := []*models.JobApplication{{ID: 1, Status: "interviewing", AppliedAt: &applied}, {ID: 2, Status: "saved"}, {ID: 3, Status: "offer", AppliedAt: &applied}} + note := func(value string) *string { return &value } + events := []*models.JobApplicationEvent{ + {JobApplicationID: 1, Kind: "status_changed", OccurredAt: base.Add(3 * 24 * time.Hour), Note: note("applied -> screening")}, + {JobApplicationID: 1, Kind: "interview", OccurredAt: base.Add(5 * 24 * time.Hour)}, + {JobApplicationID: 3, Kind: "status_changed", OccurredAt: base.Add(4 * 24 * time.Hour), Note: note("applied -> offer")}, + } + got := AggregateAnalytics(apps, events) + if got.TotalApplications != 3 || got.ResponseCount != 2 || got.InterviewCount != 2 || got.OfferCount != 1 { + t.Fatalf("counts = %+v", got) + } + if got.ResponseRate != 2.0/3.0 || got.OfferRate != 1.0/3.0 { + t.Fatalf("rates = %+v", got) + } + if len(got.Transitions) != 2 || got.Transitions[0].Count != 1 { + t.Fatalf("transitions = %+v", got.Transitions) + } + if got.AverageDaysToResponse == nil || *got.AverageDaysToResponse != 2.5 { + t.Fatalf("response days = %v", got.AverageDaysToResponse) + } +} + +func TestAggregateAnalyticsLeavesUnsupportedTimeMetricsNil(t *testing.T) { + apps := []*models.JobApplication{{ID: 1, Status: "saved"}} + got := AggregateAnalytics(apps, nil) + if got.AverageDaysToResponse != nil || got.AverageDaysToInterview != nil || got.AverageDaysToOffer != nil { + t.Fatalf("metrics = %+v", got) + } +} diff --git a/internal/services/database.go b/internal/services/database.go index 735d383..fa674dc 100644 --- a/internal/services/database.go +++ b/internal/services/database.go @@ -19,6 +19,7 @@ import ( func migrateDatabase(db *gorm.DB) error { return db.AutoMigrate( &models.JobApplication{}, + &models.JobApplicationEvent{}, &models.JobAppReference{}, // Dormant since the email pipeline was removed; see the model. &models.ProcessedEmail{}, diff --git a/internal/services/job_application_events.go b/internal/services/job_application_events.go new file mode 100644 index 0000000..2df83cb --- /dev/null +++ b/internal/services/job_application_events.go @@ -0,0 +1,56 @@ +package services + +import ( + "strings" + "time" + + "adam-french.co.uk/job-tracker/internal/models" + "gorm.io/gorm" +) + +// ApplicationEventInput is deliberately small: application changes supply +// their own source, while a manual event can include a note and contact data. +type ApplicationEventInput struct { + Kind string + OccurredAt time.Time + Note *string + Source string + ContactName *string + ContactEmail *string + ContactRole *string +} + +// RecordApplicationEvent appends an event without changing the application. +func RecordApplicationEvent(db *gorm.DB, applicationID uint, input ApplicationEventInput) (*models.JobApplicationEvent, error) { + if input.OccurredAt.IsZero() { + input.OccurredAt = time.Now() + } + if strings.TrimSpace(input.Kind) == "" { + return nil, &JobInputError{"event kind is required"} + } + if input.Source == "" { + input.Source = "manual" + } + event := &models.JobApplicationEvent{ + JobApplicationID: applicationID, + Kind: strings.TrimSpace(input.Kind), + OccurredAt: input.OccurredAt, + Note: input.Note, + Source: input.Source, + ContactName: input.ContactName, + ContactEmail: input.ContactEmail, + ContactRole: input.ContactRole, + } + if err := db.Create(event).Error; err != nil { + return nil, err + } + return event, nil +} + +// ListApplicationEvents returns newest activity first, with id as a stable tie-break. +func ListApplicationEvents(db *gorm.DB, applicationID uint) ([]*models.JobApplicationEvent, error) { + var events []*models.JobApplicationEvent + err := db.Where("job_application_id = ?", applicationID). + Order("occurred_at DESC, id DESC").Find(&events).Error + return events, err +} diff --git a/internal/services/job_application_events_test.go b/internal/services/job_application_events_test.go new file mode 100644 index 0000000..45f5754 --- /dev/null +++ b/internal/services/job_application_events_test.go @@ -0,0 +1,19 @@ +package services + +import ( + "errors" + "testing" + + "gorm.io/gorm" +) + +func TestRecordApplicationEventRequiresKind(t *testing.T) { + _, err := RecordApplicationEvent(&gorm.DB{}, 42, ApplicationEventInput{}) + var inputErr *JobInputError + if !errors.As(err, &inputErr) { + t.Fatalf("error = %v, want JobInputError", err) + } + if inputErr.Error() != "event kind is required" { + t.Fatalf("error = %q", inputErr) + } +} diff --git a/internal/services/job_leads.go b/internal/services/job_leads.go index 72aeccd..1291a36 100644 --- a/internal/services/job_leads.go +++ b/internal/services/job_leads.go @@ -36,6 +36,113 @@ const ( LeadPromoted = "promoted" ) +const maxBulkLeadIDs = 200 + +// BulkLeadState validates every row before changing any of them. This keeps a +// typo or a mixed-state selection from producing a partial bulk action. +func BulkLeadState(db *gorm.DB, ids []int, from, to string) ([]*models.JobLead, error) { + if err := validateBulkLeadIDs(ids); err != nil { + return nil, err + } + tx := db.Begin() + if tx.Error != nil { + return nil, tx.Error + } + var leads []*models.JobLead + if err := tx.Clauses(clause.Locking{Strength: "UPDATE"}).Where("id IN ?", ids).Find(&leads).Error; err != nil { + tx.Rollback() + return nil, err + } + if len(leads) != len(ids) { + tx.Rollback() + return nil, fmt.Errorf("one or more leads do not exist") + } + for _, lead := range leads { + if lead.State != from { + tx.Rollback() + return nil, fmt.Errorf("lead %d is %s, expected %s", lead.ID, lead.State, from) + } + } + if err := tx.Model(&models.JobLead{}).Where("id IN ?", ids).Update("state", to).Error; err != nil { + tx.Rollback() + return nil, err + } + if err := tx.Commit().Error; err != nil { + return nil, err + } + return leadsWithIDs(db, ids) +} + +func leadsWithIDs(db *gorm.DB, ids []int) ([]*models.JobLead, error) { + var leads []*models.JobLead + if err := db.Where("id IN ?", ids).Find(&leads).Error; err != nil { + return nil, err + } + byID := make(map[uint]*models.JobLead, len(leads)) + for _, lead := range leads { + byID[lead.ID] = lead + } + ordered := make([]*models.JobLead, 0, len(ids)) + for _, id := range ids { + ordered = append(ordered, byID[uint(id)]) + } + return ordered, nil +} + +// BulkPromoteJobLeads deliberately promotes one at a time: PromoteJobLead +// owns the existing application deduplication and transaction semantics. +func BulkPromoteJobLeads(db *gorm.DB, ids []int, now time.Time) ([]*models.JobLead, error) { + if err := validateBulkLeadIDs(ids); err != nil { + return nil, err + } + var leads []*models.JobLead + if err := db.Where("id IN ?", ids).Find(&leads).Error; err != nil { + return nil, err + } + if len(leads) != len(ids) { + return nil, fmt.Errorf("one or more leads do not exist") + } + for _, lead := range leads { + if lead.State != LeadNew { + return nil, fmt.Errorf("lead %d is %s, expected %s", lead.ID, lead.State, LeadNew) + } + } + tx := db.Begin() + if tx.Error != nil { + return nil, tx.Error + } + result := make([]*models.JobLead, 0, len(ids)) + for _, id := range ids { + lead, err := PromoteJobLead(tx, uint(id), now) + if err != nil { + tx.Rollback() + return nil, err + } + result = append(result, lead) + } + if err := tx.Commit().Error; err != nil { + return nil, err + } + return result, nil +} + +func validateBulkLeadIDs(ids []int) error { + if len(ids) == 0 || len(ids) > maxBulkLeadIDs { + return fmt.Errorf("select between 1 and %d leads", maxBulkLeadIDs) + } + seen := make(map[int]struct{}, len(ids)) + for _, id := range ids { + if id <= 0 { + return fmt.Errorf("lead ids must be positive") + } + if _, ok := seen[id]; ok { + return fmt.Errorf("duplicate lead id %d", id) + } + seen[id] = struct{}{} + } + return nil +} + const ( // maxScoresPerRun bounds the Claude calls one Run can make, and so both // its cost and its length. A first poll of a few boards can match @@ -549,6 +656,11 @@ func PromoteJobLead(db *gorm.DB, id uint, now time.Time) (*models.JobLead, error if err != nil { return nil, err } + if _, err := RecordApplicationEvent(db, app.ID, ApplicationEventInput{ + Kind: "promoted", OccurredAt: now, Source: "lead", + }); err != nil { + return nil, fmt.Errorf("recording promotion event: %w", err) + } lead.State = LeadPromoted lead.JobAppID = &app.ID if err := db.Model(&lead).Updates(map[string]any{"state": lead.State, "job_app_id": lead.JobAppID}).Error; err != nil { diff --git a/internal/services/job_leads_test.go b/internal/services/job_leads_test.go index e58e55d..93184cb 100644 --- a/internal/services/job_leads_test.go +++ b/internal/services/job_leads_test.go @@ -50,6 +50,23 @@ func TestLeadFilter(t *testing.T) { } } +func TestValidateBulkLeadIDs(t *testing.T) { + for name, ids := range map[string][]int{ + "empty": nil, + "nonpositive": {1, 0}, + "duplicate": {1, 1}, + } { + t.Run(name, func(t *testing.T) { + if err := validateBulkLeadIDs(ids); err == nil { + t.Fatal("expected validation error") + } + }) + } + if err := validateBulkLeadIDs([]int{3, 1, 2}); err != nil { + t.Fatalf("valid ids rejected: %v", err) + } +} + func TestContainsWord(t *testing.T) { cases := []struct { text, word string diff --git a/internal/services/job_upsert.go b/internal/services/job_upsert.go index dfe8b3d..db4a604 100644 --- a/internal/services/job_upsert.go +++ b/internal/services/job_upsert.go @@ -103,13 +103,19 @@ func firstApplication(query *gorm.DB) (*models.JobApplication, error) { // JobCaptureInput is a posting to add to the tracker. Its JSON form is the // body of POST /jobs/api/capture: the popup's fields. type JobCaptureInput struct { - JobTitle string `json:"jobTitle"` - Company string `json:"company"` - Location string `json:"location"` - URL string `json:"url"` - Status string `json:"status"` - Notes string `json:"notes"` - Description string `json:"description"` + JobTitle string `json:"jobTitle"` + Company string `json:"company"` + Location string `json:"location"` + URL string `json:"url"` + Status string `json:"status"` + Notes string `json:"notes"` + Description string `json:"description"` + SalaryRange string `json:"salaryRange"` + WorkArrangement string `json:"workArrangement"` + ApplicationSource string `json:"applicationSource"` + ResumeVersion string `json:"resumeVersion"` + RequisitionID string `json:"requisitionId"` + ContactRole string `json:"contactRole"` } func nonEmpty(p *string) bool { return p != nil && strings.TrimSpace(*p) != "" } @@ -146,6 +152,12 @@ func MergeCapture(app *models.JobApplication, in JobCaptureInput, now time.Time) fill(&app.Location, in.Location) fill(&app.URL, in.URL) fill(&app.Description, in.Description) + fill(&app.SalaryRange, in.SalaryRange) + fill(&app.WorkArrangement, in.WorkArrangement) + fill(&app.ApplicationSource, in.ApplicationSource) + fill(&app.ResumeVersion, in.ResumeVersion) + fill(&app.RequisitionID, in.RequisitionID) + fill(&app.ContactRole, in.ContactRole) // Notes accumulate, as they do when the pipeline updates a row, but a // repeat capture of the same page must not append the same line twice. @@ -186,6 +198,11 @@ func UpsertJobApplication(db *gorm.DB, input JobCaptureInput, now time.Time) (*m input.Location = strings.TrimSpace(input.Location) input.Notes = strings.TrimSpace(input.Notes) input.Description = strings.TrimSpace(input.Description) + input.SalaryRange = strings.TrimSpace(input.SalaryRange) + input.WorkArrangement = strings.TrimSpace(input.WorkArrangement) + input.ApplicationSource = strings.TrimSpace(input.ApplicationSource) + input.ResumeVersion = strings.TrimSpace(input.ResumeVersion) + input.RequisitionID = strings.TrimSpace(input.RequisitionID) if input.JobTitle == "" || input.Company == "" { return nil, "", &JobInputError{"jobTitle and company are required"} } @@ -215,12 +232,32 @@ func UpsertJobApplication(db *gorm.DB, input JobCaptureInput, now time.Time) (*m } if existing != nil { + oldStatus := existing.Status if !MergeCapture(existing, input, now) { + _, eventErr := RecordApplicationEvent(db, existing.ID, ApplicationEventInput{ + Kind: "captured", OccurredAt: now, Source: "capture", + }) + if eventErr != nil { + return nil, "", fmt.Errorf("recording capture event: %w", eventErr) + } return existing, "unchanged", nil } if err := db.Save(existing).Error; err != nil { return nil, "", fmt.Errorf("updating the application: %w", err) } + if _, err := RecordApplicationEvent(db, existing.ID, ApplicationEventInput{ + Kind: "captured", OccurredAt: now, Source: "capture", + }); err != nil { + return nil, "", fmt.Errorf("recording capture event: %w", err) + } + if oldStatus != existing.Status { + if _, err := RecordApplicationEvent(db, existing.ID, ApplicationEventInput{ + Kind: "status_changed", OccurredAt: now, Source: "capture", + Note: stringPtr(oldStatus + " -> " + existing.Status), + }); err != nil { + return nil, "", fmt.Errorf("recording status event: %w", err) + } + } return existing, "updated", nil } @@ -232,5 +269,12 @@ func UpsertJobApplication(db *gorm.DB, input JobCaptureInput, now time.Time) (*m if err := db.Create(&app).Error; err != nil { return nil, "", fmt.Errorf("creating the application: %w", err) } + if _, err := RecordApplicationEvent(db, app.ID, ApplicationEventInput{ + Kind: "created", OccurredAt: now, Source: "capture", + }); err != nil { + return nil, "", fmt.Errorf("recording creation event: %w", err) + } return &app, "created", nil } + +func stringPtr(value string) *string { return &value } diff --git a/internal/services/job_upsert_test.go b/internal/services/job_upsert_test.go index 17b83e7..1c1ad28 100644 --- a/internal/services/job_upsert_test.go +++ b/internal/services/job_upsert_test.go @@ -118,4 +118,18 @@ func TestMergeCapture(t *testing.T) { t.Fatalf("the same note was appended twice: %q", *app.Notes) } }) + + t.Run("structured metadata is filled without overwriting corrections", func(t *testing.T) { + app := models.JobApplication{Status: "applied", SalaryRange: strPtr("£50k")} + in := JobCaptureInput{SalaryRange: "£70k", WorkArrangement: "Hybrid", ApplicationSource: "LinkedIn", ResumeVersion: "CV-1", RequisitionID: "REQ-9"} + if !MergeCapture(&app, in, now) { + t.Fatal("expected metadata to be added") + } + if *app.SalaryRange != "£50k" || *app.WorkArrangement != "Hybrid" || *app.ApplicationSource != "LinkedIn" || *app.ResumeVersion != "CV-1" || *app.RequisitionID != "REQ-9" { + t.Fatalf("metadata merge = %+v", app) + } + if MergeCapture(&app, in, now) { + t.Fatal("same metadata should not cause another change") + } + }) } diff --git a/web/public/job-capture.user.js b/web/public/job-capture.user.js index eea3c47..6813ba0 100644 --- a/web/public/job-capture.user.js +++ b/web/public/job-capture.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Job tracker capture // @namespace https://www.adam-french.co.uk/ -// @version 2.0.0 +// @version 2.1.0 // @description Add the job posting you are looking at to the tracker at /jobs/. // @match *://*/* // @noframes @@ -279,6 +279,12 @@ h("option", { value: "saved", textContent: "Saved for later" }), ), notes: h("textarea", {}), + salaryRange: h("input", { type: "text" }), + workArrangement: h("input", { type: "text" }), + applicationSource: h("input", { type: "text" }), + requisitionId: h("input", { type: "text" }), + resumeVersion: h("input", { type: "text" }), + contactRole: h("input", { type: "text" }), description: h("textarea", { class: "description" }), }; const message = h("div", { class: "message" }); @@ -295,6 +301,12 @@ field("Company", f.company), field("Location", f.location), field("Status", f.status), + field("Salary / range", f.salaryRange), + field("Work arrangement", f.workArrangement), + field("Application source", f.applicationSource), + field("Requisition ID", f.requisitionId), + field("Resume version", f.resumeVersion), + field("Contact / referral role", f.contactRole), field("Notes", f.notes), field("URL", f.url), h( @@ -367,8 +379,9 @@ const seq = ++openSeq; const { f, panel, save } = ui; - for (const key of ["jobTitle", "company", "location", "notes"]) + for (const key of ["jobTitle", "company", "location", "notes", "salaryRange", "workArrangement", "applicationSource", "requisitionId"]) f[key].value = ""; + for (const key of ["resumeVersion", "contactRole"]) f[key].value = ""; f.url.value = location.href; f.description.value = pageText(); f.status.value = "applied"; @@ -386,7 +399,7 @@ if (seq !== openSeq) return; // Only empty fields are filled: the popup is usable while Claude is // thinking, and anything typed in the meantime wins. - for (const key of ["jobTitle", "company", "location", "notes"]) + for (const key of ["jobTitle", "company", "location", "notes", "salaryRange", "workArrangement", "applicationSource", "requisitionId"]) if (!f[key].value.trim()) f[key].value = posting?.[key] ?? ""; say( posting?.jobTitle && posting?.company @@ -415,6 +428,12 @@ url: f.url.value, status: f.status.value, notes: f.notes.value, + salaryRange: f.salaryRange.value, + workArrangement: f.workArrangement.value, + applicationSource: f.applicationSource.value, + requisitionId: f.requisitionId.value, + resumeVersion: f.resumeVersion.value, + contactRole: f.contactRole.value, description: f.description.value, }); showTracked(result.application); diff --git a/web/src/App.vue b/web/src/App.vue index 164ce62..fdc9813 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -11,6 +11,7 @@ import Icon from "@/components/Icon.vue"; const userscriptUrl = `${import.meta.env.BASE_URL}job-capture.user.js`; const NAV = [ + { to: "/dashboard", label: "Dashboard", icon: "chart" }, { to: "/", label: "Applications", icon: "briefcase" }, { to: "/leads", label: "Leads", icon: "inbox" }, { to: "/settings", label: "Settings", icon: "sliders" }, diff --git a/web/src/assets/styles.css b/web/src/assets/styles.css index b1d85b1..7a0d7cf 100644 --- a/web/src/assets/styles.css +++ b/web/src/assets/styles.css @@ -539,6 +539,9 @@ textarea.input-sm { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); } +.dot[class*="status-"] { + background: var(--st, var(--text-3)); +} .status-saved { --st: var(--st-saved); } .status-applied { --st: var(--st-applied); } diff --git a/web/src/components/Icon.vue b/web/src/components/Icon.vue index f042a38..aeced38 100644 --- a/web/src/components/Icon.vue +++ b/web/src/components/Icon.vue @@ -51,6 +51,7 @@ const PATHS = { play: '', globe: '', + chart: '', }; const svg = computed(() => PATHS[props.name] ?? ""); diff --git a/web/src/router.js b/web/src/router.js index eb76d3f..c35280e 100644 --- a/web/src/router.js +++ b/web/src/router.js @@ -11,6 +11,7 @@ import { createRouter, createWebHistory } from "vue-router"; export default createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ + { path: "/dashboard", name: "dashboard", component: () => import("@/views/Dashboard.vue") }, { path: "/", name: "tracker", component: () => import("@/views/JobApplications.vue") }, { path: "/leads", name: "leads", component: () => import("@/views/JobLeads.vue") }, { path: "/settings", name: "settings", component: () => import("@/views/Settings.vue") }, diff --git a/web/src/stores/analytics.js b/web/src/stores/analytics.js new file mode 100644 index 0000000..a53abae --- /dev/null +++ b/web/src/stores/analytics.js @@ -0,0 +1,28 @@ +import { defineStore } from "pinia"; +import { gql } from "@/graphql"; + +export const useAnalyticsStore = defineStore("analytics", { + state: () => ({ data: null, loading: false, error: null }), + actions: { + async fetch() { + this.loading = true; + this.error = null; + try { + const result = await gql(`query DashboardAnalytics { + analytics { + totalApplications statusCounts { status count } + transitions { from to count } + responseCount interviewCount offerCount + responseRate interviewRate offerRate + averageDaysToResponse averageDaysToInterview averageDaysToOffer + } + }`); + this.data = result.analytics; + } catch (error) { + this.error = error; + } finally { + this.loading = false; + } + }, + }, +}); diff --git a/web/src/stores/jobApplications.js b/web/src/stores/jobApplications.js index f09745e..b16dcea 100644 --- a/web/src/stores/jobApplications.js +++ b/web/src/stores/jobApplications.js @@ -11,7 +11,7 @@ import { gql } from "@/graphql"; // `description` is deliberately not here: it is the full text of the posting, // tens of kilobytes a row, and is fetched per row when asked for. -const APP_FIELDS = `id jobTitle company location url status notes appliedAt createdAt updatedAt`; +const APP_FIELDS = `id jobTitle company location url status notes appliedAt createdAt updatedAt nextAction nextActionAt contactName contactEmail contactRole salaryRange workArrangement applicationSource resumeVersion requisitionId`; export const useJobApplicationsStore = createCrudStore("jobApplications", { type: "JobApplication", @@ -21,19 +21,42 @@ export const useJobApplicationsStore = createCrudStore("jobApplications", { insert: "prepend", // deleteJobApplication returns Boolean!, and errors for an id that is gone. deleteReturns: "boolean", - extend: () => ({ + extend: ({ update }) => ({ /** * The captured posting text for one row; `""` when none was saved. Throws * on failure. Not cached here: the view keeps its own per-visit cache, so * returning to the page re-reads a posting the userscript may have * replaced. */ - async fetchDescription(id) { + async fetchDescription(id) { const data = await gql( `query JobDescription($id: ID!) { jobApplication(id: $id) { description } }`, { id }, ); - return data.jobApplication?.description ?? ""; - }, - }), + return data.jobApplication?.description ?? ""; + }, + async fetchActivity(id) { + const data = await gql( + `query JobApplicationActivity($id: ID!) { + jobApplicationEvents(applicationId: $id) { id kind note occurredAt createdAt } + }`, + { id }, + ); + return data.jobApplicationEvents ?? []; + }, + async updateFollowUp(id, input) { + return update(id, input); + }, + async addActivityEvent(applicationId, input) { + const data = await gql( + `mutation AddJobApplicationEvent($applicationId: ID!, $input: AddJobApplicationEventInput!) { + addJobApplicationEvent(applicationId: $applicationId, input: $input) { + id kind note occurredAt createdAt + } + }`, + { applicationId, input }, + ); + return data.addJobApplicationEvent; + }, + }), }); diff --git a/web/src/stores/jobLeads.js b/web/src/stores/jobLeads.js index 2a87539..507ef7f 100644 --- a/web/src/stores/jobLeads.js +++ b/web/src/stores/jobLeads.js @@ -31,14 +31,14 @@ export const useJobLeadsStore = defineStore("jobLeads", () => { * Load every lead, all states. `includeUnmatched` also returns the ones the * keyword pre-filter rejected, which is most of a company board. */ - async function fetch({ includeUnmatched = false } = {}) { + async function fetch({ includeUnmatched = false, filters = null } = {}) { loading.value = true; try { const data = await gql( - `query JobLeads($includeUnmatched: Boolean) { - jobLeads(includeUnmatched: $includeUnmatched) { ${LEAD_FIELDS} } + `query JobLeads($includeUnmatched: Boolean, $filters: JobLeadFilters) { + jobLeads(includeUnmatched: $includeUnmatched, filters: $filters) { ${LEAD_FIELDS} } }`, - { includeUnmatched }, + { includeUnmatched, filters }, ); leads.value = data.jobLeads || []; error.value = null; @@ -63,11 +63,23 @@ export const useJobLeadsStore = defineStore("jobLeads", () => { return replace(data[mutation]); } + async function bulkTransition(mutation, ids) { + const data = await gql( + `mutation ${mutation}($ids: [ID!]!) { ${mutation}(ids: $ids) { ${LEAD_FIELDS} } }`, + { ids }, + ); + for (const lead of data[mutation] || []) replace(lead); + return data[mutation] || []; + } + /** Each returns the updated lead and throws on failure. */ const dismiss = (id) => transition("dismissJobLead", id); const restore = (id) => transition("restoreJobLead", id); /** Adds the lead to the tracker as a saved application. */ const promote = (id) => transition("promoteJobLead", id); + const bulkDismiss = (ids) => bulkTransition("bulkDismissJobLeads", ids); + const bulkRestore = (ids) => bulkTransition("bulkRestoreJobLeads", ids); + const bulkPromote = (ids) => bulkTransition("bulkPromoteJobLeads", ids); /** The posting text for one lead; `""` when the source gave none. Throws. */ async function fetchDescription(id) { @@ -117,5 +129,5 @@ export const useJobLeadsStore = defineStore("jobLeads", () => { return data.rescoreJobLeads; } - return { leads, loading, error, status, fetch, dismiss, restore, promote, fetchDescription, fetchStatus, runSync, scoreAll, rescoreAll }; + return { leads, loading, error, status, fetch, dismiss, restore, promote, bulkDismiss, bulkRestore, bulkPromote, fetchDescription, fetchStatus, runSync, scoreAll, rescoreAll }; }); diff --git a/web/src/views/Dashboard.vue b/web/src/views/Dashboard.vue new file mode 100644 index 0000000..bd024aa --- /dev/null +++ b/web/src/views/Dashboard.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/web/src/views/JobApplicationDetail.vue b/web/src/views/JobApplicationDetail.vue new file mode 100644 index 0000000..69e2df7 --- /dev/null +++ b/web/src/views/JobApplicationDetail.vue @@ -0,0 +1,179 @@ + + +