Skip to content

Commit 2949f4a

Browse files
authored
feat: adding organization to pipedrive (#254)
1 parent 6cb582c commit 2949f4a

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vesselapi/integrations",
3-
"version": "1.0.39",
3+
"version": "1.0.40",
44
"description": "Vessel integrations",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

src/platforms/pipedrive/client.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ import {
2424
PipedriveNoteCreate,
2525
pipedriveNoteSchema,
2626
PipedriveNoteUpdate,
27+
PipedriveOrganization,
28+
PipedriveOrganizationCreate,
29+
pipedriveOrganizationSchema,
30+
PipedriveOrganizationUpdate,
2731
PipedrivePerson,
2832
PipedrivePersonCreate,
2933
PipedrivePersonUpdate,
@@ -193,6 +197,11 @@ const makeClient = () => {
193197
'notes',
194198
pipedriveNoteSchema,
195199
),
200+
organizations: crud<
201+
PipedriveOrganizationCreate,
202+
PipedriveOrganizationUpdate,
203+
PipedriveOrganization
204+
>('organizations', pipedriveOrganizationSchema),
196205
passthrough: request.passthrough(),
197206
};
198207
};

src/platforms/pipedrive/schemas.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,40 @@ export type PipedriveDealUpdate = z.infer<typeof pipedriveDealUpsertSchema> & {
217217
id: string;
218218
};
219219

220+
// -
221+
// Organizations
222+
// -
223+
export const pipedriveOrganizationSchema = custom.addNativeToZodSchema(
224+
z.object({
225+
id: z.number(),
226+
name: z.string(),
227+
address_route: z.string(),
228+
address_locality: z.string(),
229+
address_admin_area_level_1: z.string(),
230+
address_postal_code: z.string(),
231+
address_country: z.string(),
232+
update_time: custom.date(),
233+
add_time: custom.date(),
234+
active_flag: z.boolean(), // isDeleted
235+
owner_id: z.object({ value: z.number() }),
236+
}),
237+
);
238+
export type PipedriveOrganization = z.infer<typeof pipedriveOrganizationSchema>;
239+
export const pipedriveOrganizationUpsertSchema = z
240+
.object({
241+
name: z.string(),
242+
address: z.string().optional(),
243+
owner_id: z.number().optional(),
244+
$native: z.record(z.any()),
245+
})
246+
.partial();
247+
export type PipedriveOrganizationCreate = z.infer<
248+
typeof pipedriveOrganizationUpsertSchema
249+
>;
250+
export type PipedriveOrganizationUpdate = z.infer<
251+
typeof pipedriveOrganizationUpsertSchema
252+
> & { id: string };
253+
220254
// -
221255
// Notes
222256
// -

0 commit comments

Comments
 (0)