@dakkitor/api-contracts 1.1.2 → 1.1.4
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/client-contacts/client-contacts.contract.d.ts +2204 -361
- package/dist/client-contacts/client-contacts.contract.d.ts.map +1 -1
- package/dist/client-contacts/client-contacts.contract.js +29 -47
- package/dist/clients/clients.contract.d.ts +1273 -283
- package/dist/clients/clients.contract.d.ts.map +1 -1
- package/dist/clients/clients.contract.js +25 -43
- package/dist/common/error-schemas.d.ts +17 -1
- package/dist/common/error-schemas.d.ts.map +1 -1
- package/dist/common/pagination.schema.d.ts +19 -3
- package/dist/common/pagination.schema.d.ts.map +1 -1
- package/dist/common/pagination.schema.js +6 -4
- package/dist/index.d.ts +2635 -518
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -7
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-contacts.contract.d.ts","sourceRoot":"","sources":["../../contracts/client-contacts/client-contacts.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"client-contacts.contract.d.ts","sourceRoot":"","sources":["../../contracts/client-contacts/client-contacts.contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAKlC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa9B,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFxC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.clientContactsContractRouter = exports.ClientContactPaginatedResponseSchema = exports.FilterClientContactSchema = exports.UpdateClientContactSchema = exports.CreateClientContactBodySchema = exports.CreateClientContactSchema = exports.ClientContactSchema = exports.ClientContactUserSchema = void 0;
|
|
4
4
|
const core_1 = require("@ts-rest/core");
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const clients_contract_1 = require("../clients/clients.contract");
|
|
@@ -17,27 +17,27 @@ const ClientContactSortableFieldsSchema = zod_1.z.enum([
|
|
|
17
17
|
]);
|
|
18
18
|
// Shared Schemas
|
|
19
19
|
const ResourceIdSchema = zod_1.z.object({
|
|
20
|
-
id: zod_1.z.uuid(),
|
|
20
|
+
id: zod_1.z.string().uuid(),
|
|
21
21
|
});
|
|
22
22
|
// User Schema (duplicated from clients for now to avoid export issues, ideally should be in common)
|
|
23
|
-
|
|
24
|
-
id: zod_1.z.uuid(),
|
|
23
|
+
exports.ClientContactUserSchema = zod_1.z.object({
|
|
24
|
+
id: zod_1.z.string().uuid(),
|
|
25
25
|
firstName: zod_1.z.string(),
|
|
26
26
|
lastName: zod_1.z.string(),
|
|
27
|
-
email: zod_1.z.email(),
|
|
27
|
+
email: zod_1.z.string().email(),
|
|
28
28
|
});
|
|
29
29
|
exports.ClientContactSchema = zod_1.z.object({
|
|
30
|
-
id: zod_1.z.uuid().describe('Contact ID'),
|
|
31
|
-
clientId: zod_1.z.uuid().describe('Client ID'),
|
|
30
|
+
id: zod_1.z.string().uuid().describe('Contact ID'),
|
|
31
|
+
clientId: zod_1.z.string().uuid().describe('Client ID'),
|
|
32
32
|
client: clients_contract_1.ClientSchema.describe('Client Details'),
|
|
33
33
|
name: zod_1.z.string().describe('Contact Name'),
|
|
34
34
|
position: zod_1.z.string().optional().describe('Job Position'),
|
|
35
35
|
phone: zod_1.z.string().describe('Phone Number'),
|
|
36
|
-
email: zod_1.z.email().describe('Email Address'),
|
|
36
|
+
email: zod_1.z.string().email().describe('Email Address'),
|
|
37
37
|
source: zod_1.z.string().optional().describe('Source'),
|
|
38
|
-
createdBy:
|
|
39
|
-
createdAt: zod_1.z.
|
|
40
|
-
updatedAt: zod_1.z.
|
|
38
|
+
createdBy: exports.ClientContactUserSchema.describe('Created By'),
|
|
39
|
+
createdAt: zod_1.z.string().datetime().describe('Creation Date'),
|
|
40
|
+
updatedAt: zod_1.z.string().datetime().describe('Last Update Date'),
|
|
41
41
|
version: zod_1.z.number().describe('Version Number'),
|
|
42
42
|
});
|
|
43
43
|
exports.CreateClientContactSchema = zod_1.z.object({
|
|
@@ -45,7 +45,7 @@ exports.CreateClientContactSchema = zod_1.z.object({
|
|
|
45
45
|
name: zod_1.z.string().max(255).describe('Full Name'),
|
|
46
46
|
position: zod_1.z.string().max(255).optional().describe('Job Position'),
|
|
47
47
|
phone: zod_1.z.string().max(50).describe('Phone Number'),
|
|
48
|
-
email: zod_1.z.email().max(255).describe('Email Address'),
|
|
48
|
+
email: zod_1.z.string().email().max(255).describe('Email Address'),
|
|
49
49
|
source: zod_1.z.string().max(255).optional().describe('Source'),
|
|
50
50
|
});
|
|
51
51
|
exports.CreateClientContactBodySchema = exports.CreateClientContactSchema.omit({
|
|
@@ -62,23 +62,20 @@ exports.FilterClientContactSchema = zod_1.z.object({
|
|
|
62
62
|
name: zod_1.z.string().optional().describe('Filter by name'),
|
|
63
63
|
email: zod_1.z.string().optional().describe('Filter by email'),
|
|
64
64
|
phone: zod_1.z.string().optional().describe('Filter by phone'),
|
|
65
|
-
clientId: zod_1.z.uuid().optional().describe('Search client'),
|
|
66
|
-
createdById: zod_1.z.uuid().optional().describe('Search by creator'),
|
|
65
|
+
clientId: zod_1.z.string().uuid().optional().describe('Search client'),
|
|
66
|
+
createdById: zod_1.z.string().uuid().optional().describe('Search by creator'),
|
|
67
67
|
sortBy: ClientContactSortableFieldsSchema.default('createdAt').describe('Sort field'),
|
|
68
68
|
sortOrder: SortOrderSchema.default('DESC').describe('Sort order'),
|
|
69
69
|
});
|
|
70
|
+
exports.ClientContactPaginatedResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.ClientContactSchema);
|
|
70
71
|
const c = (0, core_1.initContract)();
|
|
71
|
-
|
|
72
|
+
exports.clientContactsContractRouter = c.router({
|
|
72
73
|
create: {
|
|
73
74
|
method: 'POST',
|
|
74
75
|
path: '/v2/client-contacts',
|
|
75
76
|
responses: {
|
|
76
77
|
201: exports.ClientContactSchema,
|
|
77
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
78
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
79
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
80
78
|
409: error_schemas_1.ErrorResponseSchema,
|
|
81
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
82
79
|
},
|
|
83
80
|
body: exports.CreateClientContactSchema,
|
|
84
81
|
summary: 'Create a new client contact',
|
|
@@ -88,14 +85,10 @@ const clientContactsContractConfig = {
|
|
|
88
85
|
path: '/v2/client-contacts/client/:clientId',
|
|
89
86
|
responses: {
|
|
90
87
|
201: exports.ClientContactSchema,
|
|
91
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
92
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
93
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
94
88
|
409: error_schemas_1.ErrorResponseSchema,
|
|
95
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
96
89
|
},
|
|
97
90
|
pathParams: zod_1.z.object({
|
|
98
|
-
clientId: zod_1.z.uuid(),
|
|
91
|
+
clientId: zod_1.z.string().uuid(),
|
|
99
92
|
}),
|
|
100
93
|
body: exports.CreateClientContactBodySchema,
|
|
101
94
|
summary: 'Create a new contact for a specific client',
|
|
@@ -104,11 +97,7 @@ const clientContactsContractConfig = {
|
|
|
104
97
|
method: 'GET',
|
|
105
98
|
path: '/v2/client-contacts',
|
|
106
99
|
responses: {
|
|
107
|
-
200:
|
|
108
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
109
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
110
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
111
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
100
|
+
200: exports.ClientContactPaginatedResponseSchema,
|
|
112
101
|
},
|
|
113
102
|
query: exports.FilterClientContactSchema,
|
|
114
103
|
summary: 'Get all client contacts',
|
|
@@ -118,14 +107,10 @@ const clientContactsContractConfig = {
|
|
|
118
107
|
path: '/v2/client-contacts/:contactId',
|
|
119
108
|
responses: {
|
|
120
109
|
200: exports.ClientContactSchema,
|
|
121
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
122
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
123
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
124
110
|
404: error_schemas_1.ErrorResponseSchema,
|
|
125
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
126
111
|
},
|
|
127
112
|
pathParams: zod_1.z.object({
|
|
128
|
-
contactId: zod_1.z.uuid(),
|
|
113
|
+
contactId: zod_1.z.string().uuid(),
|
|
129
114
|
}),
|
|
130
115
|
summary: 'Get a client contact by ID',
|
|
131
116
|
},
|
|
@@ -134,15 +119,11 @@ const clientContactsContractConfig = {
|
|
|
134
119
|
path: '/v2/client-contacts/:contactId',
|
|
135
120
|
responses: {
|
|
136
121
|
200: exports.ClientContactSchema,
|
|
137
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
138
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
139
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
140
122
|
404: error_schemas_1.ErrorResponseSchema,
|
|
141
123
|
409: error_schemas_1.ErrorResponseSchema,
|
|
142
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
143
124
|
},
|
|
144
125
|
pathParams: zod_1.z.object({
|
|
145
|
-
contactId: zod_1.z.uuid(),
|
|
126
|
+
contactId: zod_1.z.string().uuid(),
|
|
146
127
|
}),
|
|
147
128
|
body: exports.UpdateClientContactSchema,
|
|
148
129
|
summary: 'Update a client contact',
|
|
@@ -152,18 +133,19 @@ const clientContactsContractConfig = {
|
|
|
152
133
|
path: '/v2/client-contacts/:contactId',
|
|
153
134
|
responses: {
|
|
154
135
|
204: c.noBody(),
|
|
155
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
156
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
157
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
158
136
|
404: error_schemas_1.ErrorResponseSchema,
|
|
159
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
160
137
|
},
|
|
161
138
|
pathParams: zod_1.z.object({
|
|
162
|
-
contactId: zod_1.z.uuid(),
|
|
139
|
+
contactId: zod_1.z.string().uuid(),
|
|
163
140
|
}),
|
|
164
141
|
body: c.noBody(),
|
|
165
142
|
summary: 'Delete a client contact',
|
|
166
143
|
},
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
144
|
+
}, {
|
|
145
|
+
commonResponses: {
|
|
146
|
+
400: error_schemas_1.ErrorResponseSchema,
|
|
147
|
+
401: error_schemas_1.ErrorResponseSchema,
|
|
148
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
149
|
+
500: error_schemas_1.ErrorResponseSchema,
|
|
150
|
+
},
|
|
151
|
+
});
|