@dakkitor/api-contracts 1.1.130 → 1.1.131
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/call-history/call-history.contract.d.ts +765 -717
- package/dist/call-history/call-history.contract.d.ts.map +1 -1
- package/dist/call-history/call-history.contract.js +84 -60
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/leads/leads.contract.d.ts +160 -102
- package/dist/leads/leads.contract.d.ts.map +1 -1
- package/dist/leads/leads.contract.js +126 -116
- package/dist/own-research/own-research.contract.d.ts +1736 -0
- package/dist/own-research/own-research.contract.d.ts.map +1 -0
- package/dist/own-research/own-research.contract.js +189 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"own-research.contract.d.ts","sourceRoot":"","sources":["../../contracts/own-research/own-research.contract.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCM,CAAC;AAEzC,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCM,CAAC;AAE5C,eAAO,MAAM,uBAAuB;;;;;;EAIM,CAAC;AAE3C,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;EAWM,CAAC;AAE/C,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;CA4D/B,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Project: Internal Recruitment Platform API
|
|
4
|
+
* File: own-research.contract.ts
|
|
5
|
+
*
|
|
6
|
+
* Description: Contract definition for Own Research API - allows agents to add and call their own leads.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ownResearchContract = exports.AgentInfoResponseSchema = exports.AddOwnResearchLeadResponseSchema = exports.AddOwnResearchLeadSchema = exports.RecordOwnResearchCallResponseSchema = exports.RecordOwnResearchCallSchema = exports.CheckPhoneRequestSchema = exports.CheckPhoneResponseSchema = exports.OwnResearchLeadSchema = void 0;
|
|
10
|
+
const zod_openapi_1 = require("@anatine/zod-openapi");
|
|
11
|
+
const core_1 = require("@ts-rest/core");
|
|
12
|
+
const zod_1 = require("zod");
|
|
13
|
+
const call_rating_schema_1 = require("../common/call-rating.schema");
|
|
14
|
+
const common_schemas_1 = require("../common/common-schemas");
|
|
15
|
+
const error_schemas_1 = require("../common/error-schemas");
|
|
16
|
+
const lead_assignments_contract_1 = require("../lead-assignments/lead-assignments.contract");
|
|
17
|
+
(0, zod_openapi_1.extendZodWithOpenApi)(zod_1.z);
|
|
18
|
+
const c = (0, core_1.initContract)();
|
|
19
|
+
// Schemas
|
|
20
|
+
exports.OwnResearchLeadSchema = zod_1.z
|
|
21
|
+
.object({
|
|
22
|
+
id: zod_1.z.string().uuid().describe("Own research lead ID"),
|
|
23
|
+
agentId: zod_1.z.string().uuid().describe("Agent who owns this lead"),
|
|
24
|
+
name: zod_1.z.string().describe("Lead contact name"),
|
|
25
|
+
phoneNumber: zod_1.z.string().describe("Lead phone number"),
|
|
26
|
+
source: zod_1.z.string().describe("Lead source"),
|
|
27
|
+
status: zod_1.z.string().describe("Lead status"),
|
|
28
|
+
callCount: zod_1.z.number().int().describe("Number of calls made"),
|
|
29
|
+
lastCalledAt: zod_1.z
|
|
30
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
31
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
32
|
+
.nullable()
|
|
33
|
+
.describe("Last call date"),
|
|
34
|
+
cooldownUntil: zod_1.z
|
|
35
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
36
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
37
|
+
.nullable()
|
|
38
|
+
.describe("Cooldown expiry date"),
|
|
39
|
+
blacklistReason: zod_1.z.string().nullable().describe("Blacklist reason"),
|
|
40
|
+
existsInLeadsTable: zod_1.z
|
|
41
|
+
.boolean()
|
|
42
|
+
.describe("Whether this lead also exists in the main leads table"),
|
|
43
|
+
originalLeadId: zod_1.z
|
|
44
|
+
.string()
|
|
45
|
+
.uuid()
|
|
46
|
+
.nullable()
|
|
47
|
+
.describe("ID of the matching lead in the main leads table"),
|
|
48
|
+
createdAt: zod_1.z
|
|
49
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
50
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
51
|
+
.describe("Creation date"),
|
|
52
|
+
updatedAt: zod_1.z
|
|
53
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
54
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
55
|
+
.describe("Last update date"),
|
|
56
|
+
})
|
|
57
|
+
.openapi({ title: "OwnResearchLead" });
|
|
58
|
+
exports.CheckPhoneResponseSchema = zod_1.z
|
|
59
|
+
.object({
|
|
60
|
+
existsInLeads: zod_1.z
|
|
61
|
+
.boolean()
|
|
62
|
+
.describe("Whether the phone number exists in the main leads table"),
|
|
63
|
+
existsInOwnResearch: zod_1.z
|
|
64
|
+
.boolean()
|
|
65
|
+
.describe("Whether the phone number exists in the agent's own research leads"),
|
|
66
|
+
lead: zod_1.z
|
|
67
|
+
.object({
|
|
68
|
+
id: zod_1.z.string().uuid(),
|
|
69
|
+
name: zod_1.z.string(),
|
|
70
|
+
phoneNumber: zod_1.z.string(),
|
|
71
|
+
status: zod_1.z.string(),
|
|
72
|
+
cooldownUntil: zod_1.z
|
|
73
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
74
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
75
|
+
.nullable(),
|
|
76
|
+
})
|
|
77
|
+
.nullable()
|
|
78
|
+
.optional()
|
|
79
|
+
.describe("Existing lead from the main leads table"),
|
|
80
|
+
ownResearchLead: exports.OwnResearchLeadSchema.nullable()
|
|
81
|
+
.optional()
|
|
82
|
+
.describe("Existing lead from the agent's own research"),
|
|
83
|
+
isOnCooldown: zod_1.z
|
|
84
|
+
.boolean()
|
|
85
|
+
.describe("Whether the lead is currently on cooldown"),
|
|
86
|
+
cooldownUntil: zod_1.z
|
|
87
|
+
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
88
|
+
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
89
|
+
.nullable()
|
|
90
|
+
.describe("Cooldown expiry date if on cooldown"),
|
|
91
|
+
})
|
|
92
|
+
.openapi({ title: "CheckPhoneResponse" });
|
|
93
|
+
exports.CheckPhoneRequestSchema = zod_1.z
|
|
94
|
+
.object({
|
|
95
|
+
phoneNumber: zod_1.z.string().min(1).max(20).describe("Phone number to check"),
|
|
96
|
+
})
|
|
97
|
+
.openapi({ title: "CheckPhoneRequest" });
|
|
98
|
+
exports.RecordOwnResearchCallSchema = zod_1.z
|
|
99
|
+
.object({
|
|
100
|
+
phoneNumber: common_schemas_1.PhoneSchema.describe("Lead phone number"),
|
|
101
|
+
name: zod_1.z.string().min(1).max(255).describe("Lead contact name"),
|
|
102
|
+
rating: call_rating_schema_1.CallRatingSchema.describe("Call rating"),
|
|
103
|
+
notes: zod_1.z
|
|
104
|
+
.string()
|
|
105
|
+
.max(1000)
|
|
106
|
+
.optional()
|
|
107
|
+
.describe("Optional notes about the call"),
|
|
108
|
+
})
|
|
109
|
+
.openapi({ title: "RecordOwnResearchCall" });
|
|
110
|
+
exports.RecordOwnResearchCallResponseSchema = zod_1.z
|
|
111
|
+
.object({
|
|
112
|
+
assignment: lead_assignments_contract_1.LeadAssignmentSchema.describe("The completed assignment"),
|
|
113
|
+
ownResearchLead: exports.OwnResearchLeadSchema.describe("The own research lead record"),
|
|
114
|
+
})
|
|
115
|
+
.openapi({ title: "RecordOwnResearchCallResponse" });
|
|
116
|
+
exports.AddOwnResearchLeadSchema = zod_1.z
|
|
117
|
+
.object({
|
|
118
|
+
phoneNumber: common_schemas_1.PhoneSchema.describe("Lead phone number"),
|
|
119
|
+
name: zod_1.z.string().min(1).max(255).describe("Lead contact name"),
|
|
120
|
+
})
|
|
121
|
+
.openapi({ title: "AddOwnResearchLead" });
|
|
122
|
+
exports.AddOwnResearchLeadResponseSchema = zod_1.z
|
|
123
|
+
.object({
|
|
124
|
+
ownResearchLead: exports.OwnResearchLeadSchema.describe("The created or existing own research lead record"),
|
|
125
|
+
})
|
|
126
|
+
.openapi({ title: "AddOwnResearchLeadResponse" });
|
|
127
|
+
exports.AgentInfoResponseSchema = zod_1.z
|
|
128
|
+
.object({
|
|
129
|
+
companyId: zod_1.z.string().uuid().nullable().describe("Agent's company ID"),
|
|
130
|
+
companyName: zod_1.z.string().nullable().describe("Agent's company name"),
|
|
131
|
+
})
|
|
132
|
+
.openapi({ title: "AgentInfoResponse" });
|
|
133
|
+
exports.ownResearchContract = c.router({
|
|
134
|
+
getAgentInfo: {
|
|
135
|
+
method: "GET",
|
|
136
|
+
path: "/own-research/agent-info",
|
|
137
|
+
responses: {
|
|
138
|
+
200: exports.AgentInfoResponseSchema,
|
|
139
|
+
},
|
|
140
|
+
summary: "Get the current agent's company info for own research",
|
|
141
|
+
metadata: {
|
|
142
|
+
tags: ["Own Research"],
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
checkPhone: {
|
|
146
|
+
method: "POST",
|
|
147
|
+
path: "/own-research/check-phone",
|
|
148
|
+
body: exports.CheckPhoneRequestSchema,
|
|
149
|
+
responses: {
|
|
150
|
+
200: exports.CheckPhoneResponseSchema,
|
|
151
|
+
},
|
|
152
|
+
summary: "Check if a phone number exists in leads or own research",
|
|
153
|
+
metadata: {
|
|
154
|
+
tags: ["Own Research"],
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
addLead: {
|
|
158
|
+
method: "POST",
|
|
159
|
+
path: "/own-research/leads",
|
|
160
|
+
body: exports.AddOwnResearchLeadSchema,
|
|
161
|
+
responses: {
|
|
162
|
+
201: exports.AddOwnResearchLeadResponseSchema,
|
|
163
|
+
},
|
|
164
|
+
summary: "Add a lead to own research without recording a call",
|
|
165
|
+
metadata: {
|
|
166
|
+
tags: ["Own Research"],
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
recordCall: {
|
|
170
|
+
method: "POST",
|
|
171
|
+
path: "/own-research/call",
|
|
172
|
+
body: exports.RecordOwnResearchCallSchema,
|
|
173
|
+
responses: {
|
|
174
|
+
201: exports.RecordOwnResearchCallResponseSchema,
|
|
175
|
+
},
|
|
176
|
+
summary: "Record an own research call (creates lead, assignment, and call history)",
|
|
177
|
+
metadata: {
|
|
178
|
+
tags: ["Own Research"],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
}, {
|
|
182
|
+
pathPrefix: "/v2",
|
|
183
|
+
commonResponses: {
|
|
184
|
+
400: error_schemas_1.ErrorResponseSchema,
|
|
185
|
+
401: error_schemas_1.ErrorResponseSchema,
|
|
186
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
187
|
+
500: error_schemas_1.ErrorResponseSchema,
|
|
188
|
+
},
|
|
189
|
+
});
|