Add application workflow and lead analytics
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user