Skip to content

Commit 1072ee0

Browse files
committed
generic request actions for save
1 parent 660f23b commit 1072ee0

File tree

7 files changed

+306
-103
lines changed

7 files changed

+306
-103
lines changed

reference/schema.json

Lines changed: 102 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3911,7 +3911,7 @@
39113911
},
39123912
"action": {
39133913
"nullable": true,
3914-
"description": "options: [\"save\"]",
3914+
"description": "options: [\"save\", \"save_job_description\", \"save_candidate_profile\", \"create_hiring_intent_action\"]",
39153915
"type": "string"
39163916
},
39173917
"payload": {
@@ -3925,6 +3925,98 @@
39253925
},
39263926
"x-collection": "generic_request"
39273927
},
3928+
"ItemsHiringIntent": {
3929+
"type": "object",
3930+
"properties": {
3931+
"id": {
3932+
"nullable": false,
3933+
"type": "integer"
3934+
},
3935+
"user_created": {
3936+
"nullable": true,
3937+
"oneOf": [
3938+
{
3939+
"type": "string",
3940+
"format": "uuid"
3941+
},
3942+
{
3943+
"$ref": "#/components/schemas/Users"
3944+
}
3945+
]
3946+
},
3947+
"date_created": {
3948+
"nullable": true,
3949+
"type": "string",
3950+
"format": "timestamp"
3951+
},
3952+
"user_updated": {
3953+
"nullable": true,
3954+
"oneOf": [
3955+
{
3956+
"type": "string",
3957+
"format": "uuid"
3958+
},
3959+
{
3960+
"$ref": "#/components/schemas/Users"
3961+
}
3962+
]
3963+
},
3964+
"date_updated": {
3965+
"nullable": true,
3966+
"type": "string",
3967+
"format": "timestamp"
3968+
},
3969+
"company_profile": {
3970+
"nullable": true,
3971+
"oneOf": [
3972+
{
3973+
"type": "integer"
3974+
},
3975+
{
3976+
"$ref": "#/components/schemas/ItemsCompanyProfile"
3977+
}
3978+
]
3979+
},
3980+
"reason": {
3981+
"nullable": true,
3982+
"type": "string"
3983+
},
3984+
"potential_role": {
3985+
"nullable": true
3986+
},
3987+
"skill": {
3988+
"nullable": true
3989+
},
3990+
"space": {
3991+
"nullable": true,
3992+
"oneOf": [
3993+
{
3994+
"type": "integer"
3995+
},
3996+
{
3997+
"$ref": "#/components/schemas/ItemsSpace"
3998+
}
3999+
]
4000+
},
4001+
"confidence": {
4002+
"nullable": true,
4003+
"type": "integer"
4004+
},
4005+
"category": {
4006+
"nullable": true,
4007+
"type": "string"
4008+
},
4009+
"url": {
4010+
"nullable": true,
4011+
"type": "string"
4012+
},
4013+
"source": {
4014+
"nullable": true,
4015+
"type": "string"
4016+
}
4017+
},
4018+
"x-collection": "hiring_intent"
4019+
},
39284020
"ItemsCompanyReference": {
39294021
"type": "object",
39304022
"properties": {
@@ -4301,7 +4393,7 @@
43014393
},
43024394
"x-collection": "hiring_intent_contact"
43034395
},
4304-
"ItemsHiringIntent": {
4396+
"ItemsHiringIntentAction": {
43054397
"type": "object",
43064398
"properties": {
43074399
"id": {
@@ -4342,78 +4434,31 @@
43424434
"type": "string",
43434435
"format": "timestamp"
43444436
},
4345-
"company_profile": {
4346-
"nullable": true,
4347-
"oneOf": [
4348-
{
4349-
"type": "integer"
4350-
},
4351-
{
4352-
"$ref": "#/components/schemas/ItemsCompanyProfile"
4353-
}
4354-
]
4355-
},
4356-
"reason": {
4357-
"nullable": true,
4358-
"type": "string"
4359-
},
4360-
"potential_role": {
4361-
"nullable": true
4362-
},
4363-
"skill": {
4364-
"nullable": true
4365-
},
4366-
"space": {
4437+
"intent": {
43674438
"nullable": true,
43684439
"oneOf": [
43694440
{
43704441
"type": "integer"
43714442
},
43724443
{
4373-
"$ref": "#/components/schemas/ItemsSpace"
4444+
"$ref": "#/components/schemas/ItemsHiringIntent"
43744445
}
43754446
]
43764447
},
4377-
"confidence": {
4378-
"nullable": true,
4379-
"type": "integer"
4380-
},
43814448
"category": {
43824449
"nullable": true,
43834450
"type": "string"
43844451
},
4385-
"url": {
4452+
"status": {
43864453
"nullable": true,
4454+
"description": "options: [\"pending\", \"processing\", \"completed\", \"failed\"]",
43874455
"type": "string"
4388-
}
4389-
},
4390-
"x-collection": "hiring_intent"
4391-
},
4392-
"ItemsHiringIntentAction": {
4393-
"type": "object",
4394-
"properties": {
4395-
"id": {
4396-
"nullable": false,
4397-
"type": "integer"
43984456
},
4399-
"user_created": {
4400-
"nullable": true,
4401-
"oneOf": [
4402-
{
4403-
"type": "string",
4404-
"format": "uuid"
4405-
},
4406-
{
4407-
"$ref": "#/components/schemas/Users"
4408-
}
4409-
]
4410-
},
4411-
"date_created": {
4457+
"payload": {
44124458
"nullable": true,
4413-
"type": "string",
4414-
"format": "timestamp"
4459+
"type": "string"
44154460
},
4416-
"user_updated": {
4461+
"user": {
44174462
"nullable": true,
44184463
"oneOf": [
44194464
{
@@ -4425,35 +4470,9 @@
44254470
}
44264471
]
44274472
},
4428-
"date_updated": {
4429-
"nullable": true,
4430-
"type": "string",
4431-
"format": "timestamp"
4432-
},
4433-
"intent": {
4434-
"nullable": true,
4435-
"oneOf": [
4436-
{
4437-
"type": "integer"
4438-
},
4439-
{
4440-
"$ref": "#/components/schemas/ItemsHiringIntent"
4441-
}
4442-
]
4443-
},
4444-
"category": {
4473+
"lexical_order": {
44454474
"nullable": true,
44464475
"type": "string"
4447-
},
4448-
"status": {
4449-
"nullable": true,
4450-
"description": "options: [\"pending\", \"processing\", \"completed\", \"failed\"]",
4451-
"type": "string"
4452-
},
4453-
"execution_order": {
4454-
"nullable": true,
4455-
"type": "string",
4456-
"format": "uuid"
44574476
}
44584477
},
44594478
"x-collection": "hiring_intent_action"

src/client_side/fetch/generic_request.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { getUserProfile, getAuthHeaders } from "@/lib/utils";
22

33
// Generic Request types
4-
export type GenericRequestCategory = "job_description" | "candidate_profile";
5-
export type GenericRequestAction = "save";
4+
export type GenericRequestAction = "save_job_description" | "save_candidate_profile" | "create_hiring_intent_action";
65
export type GenericRequestStatus = "pending" | "processing" | "completed" | "failed";
76

87
export interface GenericRequest {
98
id?: number;
109
space?: number;
1110
user?: string;
12-
category: GenericRequestCategory;
1311
action: GenericRequestAction;
1412
payload: any;
1513
status?: GenericRequestStatus;
@@ -22,7 +20,7 @@ export interface GenericRequest {
2220
* This is used to save session data (JD/CP) when user exits the page
2321
*/
2422
export async function createGenericSaveRequest(
25-
category: GenericRequestCategory,
23+
action: GenericRequestAction,
2624
payload: any,
2725
directusUrl: string,
2826
space?: number
@@ -32,8 +30,7 @@ export async function createGenericSaveRequest(
3230
const authHeaders = getAuthHeaders(user);
3331

3432
const requestData: Partial<GenericRequest> = {
35-
category,
36-
action: "save",
33+
action,
3734
payload,
3835
status: "pending"
3936
};
@@ -87,16 +84,15 @@ export async function createGenericSaveRequest(
8784
* This version doesn't return a promise and is optimized for beforeunload events
8885
*/
8986
export function createGenericSaveRequestOnUnload(
90-
category: GenericRequestCategory,
87+
action: GenericRequestAction,
9188
payload: any,
9289
directusUrl: string,
9390
directusKey: string,
9491
space?: number
9592
): void {
9693
try {
9794
const requestData: Partial<GenericRequest> = {
98-
category,
99-
action: "save",
95+
action,
10096
payload,
10197
status: "pending"
10298
};

src/components/interactive/CandidateOrbitCallEnrichment.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,9 @@ export default function CandidateOrbitCallEnrichment({ sessionId: propSessionId
426426
timestamp: new Date().toISOString()
427427
};
428428

429-
// Create a generic request with action="save" and category="candidate_profile"
429+
// Create a generic request with action="save_candidate_profile"
430430
createGenericSaveRequestOnUnload(
431-
"candidate_profile",
431+
"save_candidate_profile",
432432
payload,
433433
EXTERNAL.directus_url,
434434
EXTERNAL.directus_key,

src/components/interactive/CompanyOrbitCallEnrichment.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,9 +770,9 @@ export default function CompanyOrbitCallEnrichment({ sessionId: propSessionId }:
770770
timestamp: new Date().toISOString()
771771
};
772772

773-
// Create a generic request with action="save" and category="job_description"
773+
// Create a generic request with action="save_job_description"
774774
createGenericSaveRequestOnUnload(
775-
"job_description",
775+
"save_job_description",
776776
payload,
777777
EXTERNAL.directus_url,
778778
EXTERNAL.directus_key,

0 commit comments

Comments
 (0)