@dolusoft/hirebase-mcp 1.1.20 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application/use-cases/compare-candidates.d.ts +31 -0
- package/dist/application/use-cases/compare-candidates.js +78 -0
- package/dist/application/use-cases/compare-candidates.js.map +1 -0
- package/dist/application/use-cases/create-call-batch.d.ts +25 -0
- package/dist/application/use-cases/create-call-batch.js +72 -0
- package/dist/application/use-cases/create-call-batch.js.map +1 -0
- package/dist/application/use-cases/generate-screening-report.d.ts +39 -0
- package/dist/application/use-cases/generate-screening-report.js +70 -0
- package/dist/application/use-cases/generate-screening-report.js.map +1 -0
- package/dist/application/use-cases/get-call-batch-status.d.ts +19 -0
- package/dist/application/use-cases/get-call-batch-status.js +23 -0
- package/dist/application/use-cases/get-call-batch-status.js.map +1 -0
- package/dist/application/use-cases/get-cv-chunks.d.ts +11 -1
- package/dist/application/use-cases/get-cv-chunks.js +33 -1
- package/dist/application/use-cases/get-cv-chunks.js.map +1 -1
- package/dist/application/use-cases/get-screening-history.d.ts +26 -0
- package/dist/application/use-cases/get-screening-history.js +46 -0
- package/dist/application/use-cases/get-screening-history.js.map +1 -0
- package/dist/application/use-cases/index.d.ts +3 -0
- package/dist/application/use-cases/index.js +3 -0
- package/dist/application/use-cases/index.js.map +1 -1
- package/dist/application/use-cases/match-candidates.d.ts +13 -1
- package/dist/application/use-cases/match-candidates.js +31 -7
- package/dist/application/use-cases/match-candidates.js.map +1 -1
- package/dist/application/use-cases/update-call-outcome.d.ts +19 -0
- package/dist/application/use-cases/update-call-outcome.js +63 -0
- package/dist/application/use-cases/update-call-outcome.js.map +1 -0
- package/dist/domain/entities/application.d.ts +1 -1
- package/dist/domain/entities/call-batch.d.ts +21 -0
- package/dist/domain/entities/call-batch.js +2 -0
- package/dist/domain/entities/call-batch.js.map +1 -0
- package/dist/domain/entities/index.d.ts +1 -0
- package/dist/domain/repositories/call-batch-repository.d.ts +17 -0
- package/dist/domain/repositories/call-batch-repository.js +2 -0
- package/dist/domain/repositories/call-batch-repository.js.map +1 -0
- package/dist/domain/repositories/index.d.ts +1 -0
- package/dist/infrastructure/persistence/database.d.ts +4 -0
- package/dist/infrastructure/persistence/database.js +32 -0
- package/dist/infrastructure/persistence/database.js.map +1 -1
- package/dist/infrastructure/persistence/lancedb-call-batch-repository.d.ts +33 -0
- package/dist/infrastructure/persistence/lancedb-call-batch-repository.js +216 -0
- package/dist/infrastructure/persistence/lancedb-call-batch-repository.js.map +1 -0
- package/dist/interface/dashboard/public/200.html +1 -1
- package/dist/interface/dashboard/public/404.html +1 -1
- package/dist/interface/dashboard/public/_nuxt/builds/latest.json +1 -1
- package/dist/interface/dashboard/public/_nuxt/builds/meta/05323eb6-c50f-4fab-aec8-17a93e7adeb3.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/0d6e812f-4393-4ccc-a3d3-5f84e10cef1f.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/1056fc86-712c-4f08-82e7-b0195da2d885.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/287f4183-8718-470c-a30e-21776a882e1d.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/47653a05-51ca-47b0-8728-ea69a473e926.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/4c1f6063-4cfa-4abb-8f92-2172e917f88b.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/6d598d93-4de0-403a-a158-2c2529504b0f.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/76aaca87-0e82-4fa7-a19a-155439e56038.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/83d6f570-2c34-4be5-9948-1051c85501d8.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/8d10e489-6195-4ab5-9a19-ac5b6bfb3e21.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/8ede37fe-3543-45b5-84a3-21350596eef7.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/b35b302f-e133-4121-8657-1ff4b7a84dbe.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/b4071b37-04ea-4aad-89c1-665c0a33ff14.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/cfdbad0b-52a7-4db5-a767-c65e5a0af0b2.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/eac7333a-e06c-4c97-ae42-eeea7caaa1b3.json +1 -0
- package/dist/interface/dashboard/public/_nuxt/builds/meta/f020f3fc-f5ab-48bf-a28d-516004359cc2.json +1 -0
- package/dist/interface/dashboard/public/index.html +1 -1
- package/dist/interface/mcp/server.js +18 -1
- package/dist/interface/mcp/server.js.map +1 -1
- package/dist/interface/mcp/tools/add-pipeline-note.js +1 -3
- package/dist/interface/mcp/tools/add-pipeline-note.js.map +1 -1
- package/dist/interface/mcp/tools/compare-candidates.d.ts +3 -0
- package/dist/interface/mcp/tools/compare-candidates.js +23 -0
- package/dist/interface/mcp/tools/compare-candidates.js.map +1 -0
- package/dist/interface/mcp/tools/create-call-batch.d.ts +3 -0
- package/dist/interface/mcp/tools/create-call-batch.js +30 -0
- package/dist/interface/mcp/tools/create-call-batch.js.map +1 -0
- package/dist/interface/mcp/tools/generate-screening-report.d.ts +3 -0
- package/dist/interface/mcp/tools/generate-screening-report.js +23 -0
- package/dist/interface/mcp/tools/generate-screening-report.js.map +1 -0
- package/dist/interface/mcp/tools/get-call-batch-status.d.ts +3 -0
- package/dist/interface/mcp/tools/get-call-batch-status.js +22 -0
- package/dist/interface/mcp/tools/get-call-batch-status.js.map +1 -0
- package/dist/interface/mcp/tools/get-cv-chunks.js +23 -4
- package/dist/interface/mcp/tools/get-cv-chunks.js.map +1 -1
- package/dist/interface/mcp/tools/get-screening-history.d.ts +3 -0
- package/dist/interface/mcp/tools/get-screening-history.js +22 -0
- package/dist/interface/mcp/tools/get-screening-history.js.map +1 -0
- package/dist/interface/mcp/tools/match-candidates.js +16 -3
- package/dist/interface/mcp/tools/match-candidates.js.map +1 -1
- package/dist/interface/mcp/tools/update-call-outcome.d.ts +3 -0
- package/dist/interface/mcp/tools/update-call-outcome.js +30 -0
- package/dist/interface/mcp/tools/update-call-outcome.js.map +1 -0
- package/dist/interface/mcp/tools/update-pipeline-status.js +2 -15
- package/dist/interface/mcp/tools/update-pipeline-status.js.map +1 -1
- package/dist/interface/mcp/types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ICandidateRepository } from '../../domain/repositories/candidate-repository.js';
|
|
2
|
+
import type { IJobPostingRepository } from '../../domain/repositories/job-posting-repository.js';
|
|
3
|
+
interface CandidateComparison {
|
|
4
|
+
candidateId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
location?: string;
|
|
7
|
+
experienceYears?: number;
|
|
8
|
+
skills: string[];
|
|
9
|
+
loyaltyScore?: string;
|
|
10
|
+
avgTenureMonths?: number;
|
|
11
|
+
shortStintCount?: number;
|
|
12
|
+
education: string | null;
|
|
13
|
+
currentRole: string | null;
|
|
14
|
+
languages: string[];
|
|
15
|
+
}
|
|
16
|
+
interface JobMatchEntry {
|
|
17
|
+
compositeScore: number;
|
|
18
|
+
matchedSkills: string[];
|
|
19
|
+
missingSkills: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface CompareResult {
|
|
22
|
+
candidates: CandidateComparison[];
|
|
23
|
+
job_match?: Record<string, JobMatchEntry>;
|
|
24
|
+
}
|
|
25
|
+
export declare class CompareCandidatesUseCase {
|
|
26
|
+
private candidateRepo;
|
|
27
|
+
private jobPostingRepo;
|
|
28
|
+
constructor(candidateRepo: ICandidateRepository, jobPostingRepo: IJobPostingRepository);
|
|
29
|
+
execute(candidateIds: string[], jobPostingId?: string): Promise<CompareResult>;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const LOYALTY_FACTORS = {
|
|
2
|
+
stable: 1.0,
|
|
3
|
+
moderate: 0.7,
|
|
4
|
+
flight_risk: 0.4,
|
|
5
|
+
};
|
|
6
|
+
export class CompareCandidatesUseCase {
|
|
7
|
+
candidateRepo;
|
|
8
|
+
jobPostingRepo;
|
|
9
|
+
constructor(candidateRepo, jobPostingRepo) {
|
|
10
|
+
this.candidateRepo = candidateRepo;
|
|
11
|
+
this.jobPostingRepo = jobPostingRepo;
|
|
12
|
+
}
|
|
13
|
+
async execute(candidateIds, jobPostingId) {
|
|
14
|
+
if (candidateIds.length < 2 || candidateIds.length > 5) {
|
|
15
|
+
throw new Error('Provide between 2 and 5 candidate IDs');
|
|
16
|
+
}
|
|
17
|
+
const candidates = [];
|
|
18
|
+
for (const id of candidateIds) {
|
|
19
|
+
const candidate = await this.candidateRepo.findById(id);
|
|
20
|
+
if (!candidate) {
|
|
21
|
+
throw new Error(`Candidate not found: ${id}`);
|
|
22
|
+
}
|
|
23
|
+
const firstExp = candidate.experience[0];
|
|
24
|
+
const firstEdu = candidate.education[0];
|
|
25
|
+
candidates.push({
|
|
26
|
+
candidateId: candidate.id,
|
|
27
|
+
name: candidate.name,
|
|
28
|
+
location: candidate.contact.location,
|
|
29
|
+
experienceYears: candidate.experienceYears,
|
|
30
|
+
skills: candidate.skills,
|
|
31
|
+
loyaltyScore: candidate.loyaltyScore,
|
|
32
|
+
avgTenureMonths: candidate.avgTenureMonths,
|
|
33
|
+
shortStintCount: candidate.shortStintCount,
|
|
34
|
+
education: firstEdu
|
|
35
|
+
? [firstEdu.institution, firstEdu.field].filter(Boolean).join(' - ')
|
|
36
|
+
: null,
|
|
37
|
+
currentRole: firstExp
|
|
38
|
+
? `${firstExp.position} @ ${firstExp.company}`
|
|
39
|
+
: null,
|
|
40
|
+
languages: candidate.languages.map((l) => l.language),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
let jobMatch;
|
|
44
|
+
if (jobPostingId) {
|
|
45
|
+
const jobPosting = await this.jobPostingRepo.findById(jobPostingId);
|
|
46
|
+
if (!jobPosting) {
|
|
47
|
+
throw new Error(`Job posting not found: ${jobPostingId}`);
|
|
48
|
+
}
|
|
49
|
+
const requiredSkillsLower = jobPosting.requiredSkills.map((s) => s.toLowerCase());
|
|
50
|
+
jobMatch = {};
|
|
51
|
+
for (const c of candidates) {
|
|
52
|
+
const candidateSkillsLower = c.skills.map((s) => s.toLowerCase());
|
|
53
|
+
const matchedSkills = [];
|
|
54
|
+
const missingSkills = [];
|
|
55
|
+
for (let i = 0; i < requiredSkillsLower.length; i++) {
|
|
56
|
+
if (candidateSkillsLower.includes(requiredSkillsLower[i])) {
|
|
57
|
+
matchedSkills.push(jobPosting.requiredSkills[i]);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
missingSkills.push(jobPosting.requiredSkills[i]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const skillOverlap = requiredSkillsLower.length > 0
|
|
64
|
+
? matchedSkills.length / requiredSkillsLower.length
|
|
65
|
+
: 1;
|
|
66
|
+
const loyaltyFactor = LOYALTY_FACTORS[c.loyaltyScore ?? ''] ?? 0.7;
|
|
67
|
+
const compositeScore = 0.3 * skillOverlap + 0.2 * loyaltyFactor;
|
|
68
|
+
jobMatch[c.candidateId] = {
|
|
69
|
+
compositeScore: Math.round(compositeScore * 1000) / 1000,
|
|
70
|
+
matchedSkills,
|
|
71
|
+
missingSkills,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return { candidates, job_match: jobMatch };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=compare-candidates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare-candidates.js","sourceRoot":"","sources":["../../../src/application/use-cases/compare-candidates.ts"],"names":[],"mappings":"AA4BA,MAAM,eAAe,GAA2B;IAC9C,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,WAAW,EAAE,GAAG;CACjB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AC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;oBACnD,CAAC;yBAAM,CAAC;wBACN,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;oBACnD,CAAC;gBACH,CAAC;gBAED,MAAM,YAAY,GAAG,mBAAmB,CAAC,MAAM,GAAG,CAAC;oBACjD,CAAC,CAAC,aAAa,CAAC,MAAM,GAAG,mBAAmB,CAAC,MAAM;oBACnD,CAAC,CAAC,CAAC,CAAC;gBACN,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC,IAAI,GAAG,CAAC;gBACnE,MAAM,cAAc,GAAG,GAAG,GAAG,YAAY,GAAG,GAAG,GAAG,aAAa,CAAC;gBAEhE,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG;oBACxB,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,IAAI;oBACxD,aAAa;oBACb,aAAa;iBACd,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IApplicationRepository } from '../../domain/repositories/application-repository.js';
|
|
2
|
+
import type { IApplicationEventRepository } from '../../domain/repositories/application-event-repository.js';
|
|
3
|
+
import type { ICandidateRepository } from '../../domain/repositories/candidate-repository.js';
|
|
4
|
+
import type { ICallBatchRepository } from '../../domain/repositories/call-batch-repository.js';
|
|
5
|
+
import type { ICallBatchItemRepository } from '../../domain/repositories/call-batch-repository.js';
|
|
6
|
+
import type { CallBatch, CallBatchItem } from '../../domain/entities/call-batch.js';
|
|
7
|
+
export interface CreateCallBatchInput {
|
|
8
|
+
jobPostingId: string;
|
|
9
|
+
sentTo: string;
|
|
10
|
+
candidateIds: string[];
|
|
11
|
+
note?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CreateCallBatchResult {
|
|
14
|
+
batch: CallBatch;
|
|
15
|
+
items: CallBatchItem[];
|
|
16
|
+
}
|
|
17
|
+
export declare class CreateCallBatchUseCase {
|
|
18
|
+
private applicationRepo;
|
|
19
|
+
private applicationEventRepo;
|
|
20
|
+
private candidateRepo;
|
|
21
|
+
private callBatchRepo;
|
|
22
|
+
private callBatchItemRepo;
|
|
23
|
+
constructor(applicationRepo: IApplicationRepository, applicationEventRepo: IApplicationEventRepository, candidateRepo: ICandidateRepository, callBatchRepo: ICallBatchRepository, callBatchItemRepo: ICallBatchItemRepository);
|
|
24
|
+
execute(input: CreateCallBatchInput): Promise<CreateCallBatchResult>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid';
|
|
2
|
+
export class CreateCallBatchUseCase {
|
|
3
|
+
applicationRepo;
|
|
4
|
+
applicationEventRepo;
|
|
5
|
+
candidateRepo;
|
|
6
|
+
callBatchRepo;
|
|
7
|
+
callBatchItemRepo;
|
|
8
|
+
constructor(applicationRepo, applicationEventRepo, candidateRepo, callBatchRepo, callBatchItemRepo) {
|
|
9
|
+
this.applicationRepo = applicationRepo;
|
|
10
|
+
this.applicationEventRepo = applicationEventRepo;
|
|
11
|
+
this.candidateRepo = candidateRepo;
|
|
12
|
+
this.callBatchRepo = callBatchRepo;
|
|
13
|
+
this.callBatchItemRepo = callBatchItemRepo;
|
|
14
|
+
}
|
|
15
|
+
async execute(input) {
|
|
16
|
+
const now = new Date().toISOString();
|
|
17
|
+
const batchId = nanoid();
|
|
18
|
+
const batch = {
|
|
19
|
+
id: batchId,
|
|
20
|
+
jobPostingId: input.jobPostingId,
|
|
21
|
+
sentTo: input.sentTo,
|
|
22
|
+
note: input.note ?? '',
|
|
23
|
+
createdAt: now,
|
|
24
|
+
updatedAt: now,
|
|
25
|
+
};
|
|
26
|
+
await this.callBatchRepo.save(batch);
|
|
27
|
+
const items = [];
|
|
28
|
+
for (const candidateId of input.candidateIds) {
|
|
29
|
+
const application = await this.applicationRepo.findByJobAndCandidate(input.jobPostingId, candidateId);
|
|
30
|
+
if (!application) {
|
|
31
|
+
throw new Error(`No application found for candidate ${candidateId} in job ${input.jobPostingId}`);
|
|
32
|
+
}
|
|
33
|
+
const candidate = await this.candidateRepo.findById(candidateId);
|
|
34
|
+
const phone = candidate?.contact?.phone ?? '';
|
|
35
|
+
const candidateName = candidate?.name ?? candidateId;
|
|
36
|
+
const item = {
|
|
37
|
+
id: nanoid(),
|
|
38
|
+
batchId,
|
|
39
|
+
applicationId: application.id,
|
|
40
|
+
candidateId,
|
|
41
|
+
candidateName,
|
|
42
|
+
phone,
|
|
43
|
+
outcome: 'pending',
|
|
44
|
+
note: '',
|
|
45
|
+
createdAt: now,
|
|
46
|
+
updatedAt: now,
|
|
47
|
+
};
|
|
48
|
+
await this.callBatchItemRepo.save(item);
|
|
49
|
+
items.push(item);
|
|
50
|
+
// Mark application as to_call
|
|
51
|
+
const updatedApp = {
|
|
52
|
+
...application,
|
|
53
|
+
status: 'to_call',
|
|
54
|
+
notes: `${application.notes}\n[${now}] Batch ${batchId} için to_call listesine alındı — ${input.sentTo}'e iletildi`.trim(),
|
|
55
|
+
updatedAt: now,
|
|
56
|
+
};
|
|
57
|
+
await this.applicationRepo.update(updatedApp);
|
|
58
|
+
const event = {
|
|
59
|
+
id: nanoid(),
|
|
60
|
+
applicationId: application.id,
|
|
61
|
+
eventType: 'status_change',
|
|
62
|
+
fromStatus: application.status,
|
|
63
|
+
toStatus: 'to_call',
|
|
64
|
+
note: `Call batch oluşturuldu (${batchId}) — ${input.sentTo} arayacak`,
|
|
65
|
+
createdAt: now,
|
|
66
|
+
};
|
|
67
|
+
await this.applicationEventRepo.save(event);
|
|
68
|
+
}
|
|
69
|
+
return { batch, items };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=create-call-batch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-call-batch.js","sourceRoot":"","sources":["../../../src/application/use-cases/create-call-batch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAqBhC,MAAM,OAAO,sBAAsB;IAEvB;IACA;IACA;IACA;IACA;IALV,YACU,eAAuC,EACvC,oBAAiD,EACjD,aAAmC,EACnC,aAAmC,EACnC,iBAA2C;QAJ3C,oBAAe,GAAf,eAAe,CAAwB;QACvC,yBAAoB,GAApB,oBAAoB,CAA6B;QACjD,kBAAa,GAAb,aAAa,CAAsB;QACnC,kBAAa,GAAb,aAAa,CAAsB;QACnC,sBAAiB,GAAjB,iBAAiB,CAA0B;IAClD,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAA2B;QACvC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;QAEzB,MAAM,KAAK,GAAc;YACvB,EAAE,EAAE,OAAO;YACX,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE;YACtB,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,GAAG;SACf,CAAC;QAEF,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAErC,MAAM,KAAK,GAAoB,EAAE,CAAC;QAElC,KAAK,MAAM,WAAW,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC;YAC7C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAClE,KAAK,CAAC,YAAY,EAClB,WAAW,CACZ,CAAC;YAEF,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CACb,sCAAsC,WAAW,WAAW,KAAK,CAAC,YAAY,EAAE,CACjF,CAAC;YACJ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AI,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { IApplicationRepository } from '../../domain/repositories/application-repository.js';
|
|
2
|
+
import type { IApplicationEventRepository } from '../../domain/repositories/application-event-repository.js';
|
|
3
|
+
import type { ICandidateRepository } from '../../domain/repositories/candidate-repository.js';
|
|
4
|
+
import type { IJobPostingRepository } from '../../domain/repositories/job-posting-repository.js';
|
|
5
|
+
interface ReportEntry {
|
|
6
|
+
candidateId: string;
|
|
7
|
+
name: string;
|
|
8
|
+
note: string;
|
|
9
|
+
date: string;
|
|
10
|
+
}
|
|
11
|
+
interface PendingEntry extends ReportEntry {
|
|
12
|
+
status: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ScreeningReport {
|
|
15
|
+
jobPosting: {
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
requiredSkills: string[];
|
|
19
|
+
};
|
|
20
|
+
summary: {
|
|
21
|
+
totalScreened: number;
|
|
22
|
+
shortlisted: number;
|
|
23
|
+
screenedOut: number;
|
|
24
|
+
inProgress: number;
|
|
25
|
+
shortlistRate: string;
|
|
26
|
+
};
|
|
27
|
+
shortlisted: ReportEntry[];
|
|
28
|
+
screened_out: ReportEntry[];
|
|
29
|
+
pending: PendingEntry[];
|
|
30
|
+
}
|
|
31
|
+
export declare class GenerateScreeningReportUseCase {
|
|
32
|
+
private applicationRepo;
|
|
33
|
+
private applicationEventRepo;
|
|
34
|
+
private candidateRepo;
|
|
35
|
+
private jobPostingRepo;
|
|
36
|
+
constructor(applicationRepo: IApplicationRepository, applicationEventRepo: IApplicationEventRepository, candidateRepo: ICandidateRepository, jobPostingRepo: IJobPostingRepository);
|
|
37
|
+
execute(jobPostingId: string, since?: string): Promise<ScreeningReport>;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export class GenerateScreeningReportUseCase {
|
|
2
|
+
applicationRepo;
|
|
3
|
+
applicationEventRepo;
|
|
4
|
+
candidateRepo;
|
|
5
|
+
jobPostingRepo;
|
|
6
|
+
constructor(applicationRepo, applicationEventRepo, candidateRepo, jobPostingRepo) {
|
|
7
|
+
this.applicationRepo = applicationRepo;
|
|
8
|
+
this.applicationEventRepo = applicationEventRepo;
|
|
9
|
+
this.candidateRepo = candidateRepo;
|
|
10
|
+
this.jobPostingRepo = jobPostingRepo;
|
|
11
|
+
}
|
|
12
|
+
async execute(jobPostingId, since) {
|
|
13
|
+
const jobPosting = await this.jobPostingRepo.findById(jobPostingId);
|
|
14
|
+
if (!jobPosting) {
|
|
15
|
+
throw new Error(`Job posting not found: ${jobPostingId}`);
|
|
16
|
+
}
|
|
17
|
+
let applications = await this.applicationRepo.findByJobPostingId(jobPostingId);
|
|
18
|
+
if (since) {
|
|
19
|
+
applications = applications.filter((app) => app.updatedAt >= since);
|
|
20
|
+
}
|
|
21
|
+
const shortlisted = [];
|
|
22
|
+
const screenedOut = [];
|
|
23
|
+
const pending = [];
|
|
24
|
+
for (const app of applications) {
|
|
25
|
+
const candidate = await this.candidateRepo.findById(app.candidateId);
|
|
26
|
+
const candidateName = candidate?.name ?? 'Unknown';
|
|
27
|
+
const events = await this.applicationEventRepo.findByApplicationId(app.id);
|
|
28
|
+
const latestNote = events
|
|
29
|
+
.filter((e) => e.note)
|
|
30
|
+
.sort((a, b) => b.createdAt.localeCompare(a.createdAt))[0];
|
|
31
|
+
const entry = {
|
|
32
|
+
candidateId: app.candidateId,
|
|
33
|
+
name: candidateName,
|
|
34
|
+
note: latestNote?.note ?? app.notes ?? '',
|
|
35
|
+
date: app.updatedAt,
|
|
36
|
+
};
|
|
37
|
+
if (app.status === 'shortlisted') {
|
|
38
|
+
shortlisted.push(entry);
|
|
39
|
+
}
|
|
40
|
+
else if (app.status === 'screened_out') {
|
|
41
|
+
screenedOut.push(entry);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
pending.push({ ...entry, status: app.status });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const totalScreened = applications.length;
|
|
48
|
+
const shortlistRate = totalScreened > 0
|
|
49
|
+
? `${Math.round((shortlisted.length / totalScreened) * 100)}%`
|
|
50
|
+
: '0%';
|
|
51
|
+
return {
|
|
52
|
+
jobPosting: {
|
|
53
|
+
id: jobPosting.id,
|
|
54
|
+
title: jobPosting.title,
|
|
55
|
+
requiredSkills: jobPosting.requiredSkills,
|
|
56
|
+
},
|
|
57
|
+
summary: {
|
|
58
|
+
totalScreened,
|
|
59
|
+
shortlisted: shortlisted.length,
|
|
60
|
+
screenedOut: screenedOut.length,
|
|
61
|
+
inProgress: totalScreened - shortlisted.length - screenedOut.length,
|
|
62
|
+
shortlistRate,
|
|
63
|
+
},
|
|
64
|
+
shortlisted,
|
|
65
|
+
screened_out: screenedOut,
|
|
66
|
+
pending,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=generate-screening-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-screening-report.js","sourceRoot":"","sources":["../../../src/application/use-cases/generate-screening-report.ts"],"names":[],"mappings":"AAkCA,MAAM,OAAO,8BAA8B;IAE/B;IACA;IACA;IACA;IAJV,YACU,eAAuC,EACvC,oBAAiD,EACjD,aAAmC,EACnC,cAAqC;QAHrC,oBAAe,GAAf,eAAe,CAAwB;QACvC,yBAAoB,GAApB,oBAAoB,CAA6B;QACjD,kBAAa,GAAb,aAAa,CAAsB;QACnC,mBAAc,GAAd,cAAc,CAAuB;IAC5C,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,YAAoB,EAAE,KAAc;QAChD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QACpE,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB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KAAK,aAAa,EAAE,CAAC;gBACjC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;iBAAM,IAAI,GAAG,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;gBACzC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;QAED,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,CAAC;QAC1C,MAAM,aAAa,GAAG,aAAa,GAAG,CAAC;YACrC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,MAAM,GAAG,aAAa,CAAC,GAAG,GAAG,CAAC,GAAG;YAC9D,CAAC,CAAC,IAAI,CAAC;QAET,OAAO;YACL,UAAU,EAAE;gBACV,EAAE,EAAE,UAAU,CAAC,EAAE;gBACjB,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,cAAc,EAAE,UAAU,CAAC,cAAc;aAC1C;YACD,OAAO,EAAE;gBACP,aAAa;gBACb,WAAW,EAAE,WAAW,CAAC,MAAM;gBAC/B,WAAW,EAAE,WAAW,CAAC,MAAM;gBAC/B,UAAU,EAAE,aAAa,GAAG,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM;gBACnE,aAAa;aACd;YACD,WAAW;YACX,YAAY,EAAE,WAAW;YACzB,OAAO;SACR,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ICallBatchRepository } from '../../domain/repositories/call-batch-repository.js';
|
|
2
|
+
import type { ICallBatchItemRepository } from '../../domain/repositories/call-batch-repository.js';
|
|
3
|
+
import type { CallBatch, CallBatchItem } from '../../domain/entities/call-batch.js';
|
|
4
|
+
export interface GetCallBatchStatusResult {
|
|
5
|
+
batch: CallBatch;
|
|
6
|
+
items: CallBatchItem[];
|
|
7
|
+
summary: {
|
|
8
|
+
total: number;
|
|
9
|
+
pending: number;
|
|
10
|
+
reached: number;
|
|
11
|
+
unreachable: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare class GetCallBatchStatusUseCase {
|
|
15
|
+
private callBatchRepo;
|
|
16
|
+
private callBatchItemRepo;
|
|
17
|
+
constructor(callBatchRepo: ICallBatchRepository, callBatchItemRepo: ICallBatchItemRepository);
|
|
18
|
+
execute(batchId: string): Promise<GetCallBatchStatusResult>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export class GetCallBatchStatusUseCase {
|
|
2
|
+
callBatchRepo;
|
|
3
|
+
callBatchItemRepo;
|
|
4
|
+
constructor(callBatchRepo, callBatchItemRepo) {
|
|
5
|
+
this.callBatchRepo = callBatchRepo;
|
|
6
|
+
this.callBatchItemRepo = callBatchItemRepo;
|
|
7
|
+
}
|
|
8
|
+
async execute(batchId) {
|
|
9
|
+
const batch = await this.callBatchRepo.findById(batchId);
|
|
10
|
+
if (!batch) {
|
|
11
|
+
throw new Error(`Call batch not found: ${batchId}`);
|
|
12
|
+
}
|
|
13
|
+
const items = await this.callBatchItemRepo.findByBatchId(batchId);
|
|
14
|
+
const summary = {
|
|
15
|
+
total: items.length,
|
|
16
|
+
pending: items.filter((i) => i.outcome === 'pending').length,
|
|
17
|
+
reached: items.filter((i) => i.outcome === 'reached').length,
|
|
18
|
+
unreachable: items.filter((i) => i.outcome === 'unreachable').length,
|
|
19
|
+
};
|
|
20
|
+
return { batch, items, summary };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=get-call-batch-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-call-batch-status.js","sourceRoot":"","sources":["../../../src/application/use-cases/get-call-batch-status.ts"],"names":[],"mappings":"AAeA,MAAM,OAAO,yBAAyB;IAE1B;IACA;IAFV,YACU,aAAmC,EACnC,iBAA2C;QAD3C,kBAAa,GAAb,aAAa,CAAsB;QACnC,sBAAiB,GAAjB,iBAAiB,CAA0B;IAClD,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,OAAe;QAC3B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,EAAE,CAAC,CAAC;QACtD,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAElE,MAAM,OAAO,GAAG;YACd,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,MAAM;YAC5D,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,MAAM;YAC5D,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,aAAa,CAAC,CAAC,MAAM;SACrE,CAAC;QAEF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IChunkRepository } from '../../domain/repositories/chunk-repository.js';
|
|
2
|
+
import type { ICandidateRepository } from '../../domain/repositories/candidate-repository.js';
|
|
2
3
|
import type { SectionType } from '../../shared/types/index.js';
|
|
3
4
|
export interface ChunkDto {
|
|
4
5
|
id: string;
|
|
@@ -8,8 +9,17 @@ export interface ChunkDto {
|
|
|
8
9
|
metadata: Record<string, unknown>;
|
|
9
10
|
createdAt: string;
|
|
10
11
|
}
|
|
12
|
+
export interface BatchChunkResult {
|
|
13
|
+
results: Record<string, {
|
|
14
|
+
name: string;
|
|
15
|
+
chunks: ChunkDto[];
|
|
16
|
+
}>;
|
|
17
|
+
not_found: string[];
|
|
18
|
+
}
|
|
11
19
|
export declare class GetCvChunksUseCase {
|
|
12
20
|
private chunkRepo;
|
|
13
|
-
|
|
21
|
+
private candidateRepo?;
|
|
22
|
+
constructor(chunkRepo: IChunkRepository, candidateRepo?: ICandidateRepository | undefined);
|
|
14
23
|
execute(candidateId: string, sectionType?: SectionType): Promise<ChunkDto[]>;
|
|
24
|
+
executeBatch(candidateIds: string[], sectionType?: SectionType): Promise<BatchChunkResult>;
|
|
15
25
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export class GetCvChunksUseCase {
|
|
2
2
|
chunkRepo;
|
|
3
|
-
|
|
3
|
+
candidateRepo;
|
|
4
|
+
constructor(chunkRepo, candidateRepo) {
|
|
4
5
|
this.chunkRepo = chunkRepo;
|
|
6
|
+
this.candidateRepo = candidateRepo;
|
|
5
7
|
}
|
|
6
8
|
async execute(candidateId, sectionType) {
|
|
7
9
|
const chunks = await this.chunkRepo.findByCandidateId(candidateId, sectionType);
|
|
@@ -14,5 +16,35 @@ export class GetCvChunksUseCase {
|
|
|
14
16
|
createdAt: c.createdAt,
|
|
15
17
|
}));
|
|
16
18
|
}
|
|
19
|
+
async executeBatch(candidateIds, sectionType) {
|
|
20
|
+
if (!this.candidateRepo) {
|
|
21
|
+
throw new Error('CandidateRepository is required for batch operations');
|
|
22
|
+
}
|
|
23
|
+
if (candidateIds.length > 10) {
|
|
24
|
+
throw new Error('Maximum 10 candidates per batch request');
|
|
25
|
+
}
|
|
26
|
+
const results = {};
|
|
27
|
+
const notFound = [];
|
|
28
|
+
for (const id of candidateIds) {
|
|
29
|
+
const candidate = await this.candidateRepo.findById(id);
|
|
30
|
+
if (!candidate) {
|
|
31
|
+
notFound.push(id);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const chunks = await this.chunkRepo.findByCandidateId(id, sectionType);
|
|
35
|
+
results[id] = {
|
|
36
|
+
name: candidate.name,
|
|
37
|
+
chunks: chunks.map((c) => ({
|
|
38
|
+
id: c.id,
|
|
39
|
+
candidateId: c.candidateId,
|
|
40
|
+
sectionType: c.sectionType,
|
|
41
|
+
content: c.content,
|
|
42
|
+
metadata: c.metadata,
|
|
43
|
+
createdAt: c.createdAt,
|
|
44
|
+
})),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return { results, not_found: notFound };
|
|
48
|
+
}
|
|
17
49
|
}
|
|
18
50
|
//# sourceMappingURL=get-cv-chunks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-cv-chunks.js","sourceRoot":"","sources":["../../../src/application/use-cases/get-cv-chunks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-cv-chunks.js","sourceRoot":"","sources":["../../../src/application/use-cases/get-cv-chunks.ts"],"names":[],"mappings":"AAkBA,MAAM,OAAO,kBAAkB;IAEnB;IACA;IAFV,YACU,SAA2B,EAC3B,aAAoC;QADpC,cAAS,GAAT,SAAS,CAAkB;QAC3B,kBAAa,GAAb,aAAa,CAAuB;IAC3C,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,WAAmB,EAAE,WAAyB;QAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAChF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACxB,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB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,EAAE,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IApplicationRepository } from '../../domain/repositories/application-repository.js';
|
|
2
|
+
import type { IApplicationEventRepository } from '../../domain/repositories/application-event-repository.js';
|
|
3
|
+
import type { ICandidateRepository } from '../../domain/repositories/candidate-repository.js';
|
|
4
|
+
interface ScreeningEntry {
|
|
5
|
+
candidateId: string;
|
|
6
|
+
candidateName: string;
|
|
7
|
+
note: string;
|
|
8
|
+
date: string;
|
|
9
|
+
}
|
|
10
|
+
interface PipelineEntry extends ScreeningEntry {
|
|
11
|
+
status: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ScreeningHistoryResult {
|
|
14
|
+
shortlisted: ScreeningEntry[];
|
|
15
|
+
screened_out: ScreeningEntry[];
|
|
16
|
+
in_pipeline: PipelineEntry[];
|
|
17
|
+
total_screened: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class GetScreeningHistoryUseCase {
|
|
20
|
+
private applicationRepo;
|
|
21
|
+
private applicationEventRepo;
|
|
22
|
+
private candidateRepo;
|
|
23
|
+
constructor(applicationRepo: IApplicationRepository, applicationEventRepo: IApplicationEventRepository, candidateRepo: ICandidateRepository);
|
|
24
|
+
execute(jobPostingId: string): Promise<ScreeningHistoryResult>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export class GetScreeningHistoryUseCase {
|
|
2
|
+
applicationRepo;
|
|
3
|
+
applicationEventRepo;
|
|
4
|
+
candidateRepo;
|
|
5
|
+
constructor(applicationRepo, applicationEventRepo, candidateRepo) {
|
|
6
|
+
this.applicationRepo = applicationRepo;
|
|
7
|
+
this.applicationEventRepo = applicationEventRepo;
|
|
8
|
+
this.candidateRepo = candidateRepo;
|
|
9
|
+
}
|
|
10
|
+
async execute(jobPostingId) {
|
|
11
|
+
const applications = await this.applicationRepo.findByJobPostingId(jobPostingId);
|
|
12
|
+
const shortlisted = [];
|
|
13
|
+
const screenedOut = [];
|
|
14
|
+
const inPipeline = [];
|
|
15
|
+
for (const app of applications) {
|
|
16
|
+
const candidate = await this.candidateRepo.findById(app.candidateId);
|
|
17
|
+
const candidateName = candidate?.name ?? 'Unknown';
|
|
18
|
+
const events = await this.applicationEventRepo.findByApplicationId(app.id);
|
|
19
|
+
const latestNote = events
|
|
20
|
+
.filter((e) => e.note)
|
|
21
|
+
.sort((a, b) => b.createdAt.localeCompare(a.createdAt))[0];
|
|
22
|
+
const entry = {
|
|
23
|
+
candidateId: app.candidateId,
|
|
24
|
+
candidateName,
|
|
25
|
+
note: latestNote?.note ?? app.notes ?? '',
|
|
26
|
+
date: app.updatedAt,
|
|
27
|
+
};
|
|
28
|
+
if (app.status === 'shortlisted') {
|
|
29
|
+
shortlisted.push(entry);
|
|
30
|
+
}
|
|
31
|
+
else if (app.status === 'screened_out') {
|
|
32
|
+
screenedOut.push(entry);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
inPipeline.push({ ...entry, status: app.status });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
shortlisted,
|
|
40
|
+
screened_out: screenedOut,
|
|
41
|
+
in_pipeline: inPipeline,
|
|
42
|
+
total_screened: applications.length,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=get-screening-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-screening-history.js","sourceRoot":"","sources":["../../../src/application/use-cases/get-screening-history.ts"],"names":[],"mappings":"AAsBA,MAAM,OAAO,0BAA0B;IAE3B;IACA;IACA;IAHV,YACU,eAAuC,EACvC,oBAAiD,EACjD,aAAmC;QAFnC,oBAAe,GAAf,eAAe,CAAwB;QACvC,yBAAoB,GAApB,oBAAoB,CAA6B;QACjD,kBAAa,GAAb,aAAa,CAAsB;IAC1C,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,YAAoB;QAChC,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AAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;YACpD,CAAC;QACH,CAAC;QAED,OAAO;YACL,WAAW;YACX,YAAY,EAAE,WAAW;YACzB,WAAW,EAAE,UAAU;YACvB,cAAc,EAAE,YAAY,CAAC,MAAM;SACpC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -21,3 +21,6 @@ export { SetPendingActionUseCase } from './set-pending-action.js';
|
|
|
21
21
|
export { GetPipelineUseCase } from './get-pipeline.js';
|
|
22
22
|
export { GetCandidateHistoryUseCase } from './get-candidate-history.js';
|
|
23
23
|
export { GetPendingActionsUseCase } from './get-pending-actions.js';
|
|
24
|
+
export { CompareCandidatesUseCase } from './compare-candidates.js';
|
|
25
|
+
export { GetScreeningHistoryUseCase } from './get-screening-history.js';
|
|
26
|
+
export { GenerateScreeningReportUseCase } from './generate-screening-report.js';
|
|
@@ -21,4 +21,7 @@ export { SetPendingActionUseCase } from './set-pending-action.js';
|
|
|
21
21
|
export { GetPipelineUseCase } from './get-pipeline.js';
|
|
22
22
|
export { GetCandidateHistoryUseCase } from './get-candidate-history.js';
|
|
23
23
|
export { GetPendingActionsUseCase } from './get-pending-actions.js';
|
|
24
|
+
export { CompareCandidatesUseCase } from './compare-candidates.js';
|
|
25
|
+
export { GetScreeningHistoryUseCase } from './get-screening-history.js';
|
|
26
|
+
export { GenerateScreeningReportUseCase } from './generate-screening-report.js';
|
|
24
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/application/use-cases/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBA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AC"}
|
|
@@ -4,6 +4,15 @@ import type { IChunkRepository } from '../../domain/repositories/chunk-repositor
|
|
|
4
4
|
import type { IApplicationRepository } from '../../domain/repositories/application-repository.js';
|
|
5
5
|
import type { IEmbeddingService } from '../ports/embedding-service.js';
|
|
6
6
|
import type { ApplicationStatus } from '../../domain/entities/application.js';
|
|
7
|
+
export interface MatchCandidatesInput {
|
|
8
|
+
jobPostingId: string;
|
|
9
|
+
limit?: number;
|
|
10
|
+
excludePipeline?: boolean;
|
|
11
|
+
excludeScreened?: boolean;
|
|
12
|
+
location?: string;
|
|
13
|
+
requiredSkills?: string[];
|
|
14
|
+
includeLoyaltyDetail?: boolean;
|
|
15
|
+
}
|
|
7
16
|
export interface MatchResult {
|
|
8
17
|
candidateId: string;
|
|
9
18
|
candidateName: string;
|
|
@@ -14,6 +23,9 @@ export interface MatchResult {
|
|
|
14
23
|
matchedSkills: string[];
|
|
15
24
|
missingSkills: string[];
|
|
16
25
|
pipelineStatus?: ApplicationStatus;
|
|
26
|
+
location?: string;
|
|
27
|
+
avgTenureMonths?: number;
|
|
28
|
+
shortStintCount?: number;
|
|
17
29
|
}
|
|
18
30
|
export declare class MatchCandidatesUseCase {
|
|
19
31
|
private jobPostingRepo;
|
|
@@ -22,6 +34,6 @@ export declare class MatchCandidatesUseCase {
|
|
|
22
34
|
private embeddingService;
|
|
23
35
|
private applicationRepo?;
|
|
24
36
|
constructor(jobPostingRepo: IJobPostingRepository, candidateRepo: ICandidateRepository, chunkRepo: IChunkRepository, embeddingService: IEmbeddingService, applicationRepo?: IApplicationRepository | undefined);
|
|
25
|
-
execute(
|
|
37
|
+
execute(input: MatchCandidatesInput): Promise<MatchResult[]>;
|
|
26
38
|
private computeSkillOverlap;
|
|
27
39
|
}
|