@dakkitor/api-contracts 1.1.3 → 1.1.5
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 +762 -465
- package/dist/client-contacts/client-contacts.contract.d.ts.map +1 -1
- package/dist/client-contacts/client-contacts.contract.js +25 -37
- package/dist/clients/clients.contract.d.ts +434 -348
- package/dist/clients/clients.contract.d.ts.map +1 -1
- package/dist/clients/clients.contract.js +80 -51
- package/dist/common/api-responses.d.ts +105 -0
- package/dist/common/api-responses.d.ts.map +1 -0
- package/dist/common/api-responses.js +107 -0
- package/dist/common/error-schemas.d.ts.map +1 -1
- package/dist/common/error-schemas.js +6 -2
- package/dist/common/openapi-metadata.d.ts +65 -0
- package/dist/common/openapi-metadata.d.ts.map +1 -0
- package/dist/common/openapi-metadata.js +155 -0
- package/dist/common/pagination.schema.d.ts +12 -6
- package/dist/common/pagination.schema.d.ts.map +1 -1
- package/dist/common/pagination.schema.js +6 -4
- package/dist/index.d.ts +701 -659
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -7
- package/package.json +7 -5
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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");
|
|
@@ -20,13 +20,14 @@ const ResourceIdSchema = zod_1.z.object({
|
|
|
20
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
|
-
|
|
23
|
+
exports.ClientContactUserSchema = zod_1.z.object({
|
|
24
24
|
id: zod_1.z.string().uuid(),
|
|
25
25
|
firstName: zod_1.z.string(),
|
|
26
26
|
lastName: zod_1.z.string(),
|
|
27
27
|
email: zod_1.z.string().email(),
|
|
28
28
|
});
|
|
29
|
-
exports.ClientContactSchema = zod_1.z
|
|
29
|
+
exports.ClientContactSchema = zod_1.z
|
|
30
|
+
.object({
|
|
30
31
|
id: zod_1.z.string().uuid().describe('Contact ID'),
|
|
31
32
|
clientId: zod_1.z.string().uuid().describe('Client ID'),
|
|
32
33
|
client: clients_contract_1.ClientSchema.describe('Client Details'),
|
|
@@ -35,19 +36,22 @@ exports.ClientContactSchema = zod_1.z.object({
|
|
|
35
36
|
phone: zod_1.z.string().describe('Phone Number'),
|
|
36
37
|
email: zod_1.z.string().email().describe('Email Address'),
|
|
37
38
|
source: zod_1.z.string().optional().describe('Source'),
|
|
38
|
-
createdBy:
|
|
39
|
+
createdBy: exports.ClientContactUserSchema.describe('Created By'),
|
|
39
40
|
createdAt: zod_1.z.string().datetime().describe('Creation Date'),
|
|
40
41
|
updatedAt: zod_1.z.string().datetime().describe('Last Update Date'),
|
|
41
42
|
version: zod_1.z.number().describe('Version Number'),
|
|
42
|
-
})
|
|
43
|
-
|
|
43
|
+
})
|
|
44
|
+
.openapi({ title: 'ClientContact' });
|
|
45
|
+
exports.CreateClientContactSchema = zod_1.z
|
|
46
|
+
.object({
|
|
44
47
|
client: ResourceIdSchema.describe('Client ID'),
|
|
45
48
|
name: zod_1.z.string().max(255).describe('Full Name'),
|
|
46
49
|
position: zod_1.z.string().max(255).optional().describe('Job Position'),
|
|
47
50
|
phone: zod_1.z.string().max(50).describe('Phone Number'),
|
|
48
51
|
email: zod_1.z.string().email().max(255).describe('Email Address'),
|
|
49
52
|
source: zod_1.z.string().max(255).optional().describe('Source'),
|
|
50
|
-
})
|
|
53
|
+
})
|
|
54
|
+
.openapi({ title: 'CreateClientContact' });
|
|
51
55
|
exports.CreateClientContactBodySchema = exports.CreateClientContactSchema.omit({
|
|
52
56
|
client: true,
|
|
53
57
|
});
|
|
@@ -67,18 +71,17 @@ exports.FilterClientContactSchema = zod_1.z.object({
|
|
|
67
71
|
sortBy: ClientContactSortableFieldsSchema.default('createdAt').describe('Sort field'),
|
|
68
72
|
sortOrder: SortOrderSchema.default('DESC').describe('Sort order'),
|
|
69
73
|
});
|
|
74
|
+
exports.ClientContactPaginatedResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.ClientContactSchema).openapi({
|
|
75
|
+
title: 'ClientContactsPaginatedResponse',
|
|
76
|
+
});
|
|
70
77
|
const c = (0, core_1.initContract)();
|
|
71
|
-
|
|
78
|
+
exports.clientContactsContractRouter = c.router({
|
|
72
79
|
create: {
|
|
73
80
|
method: 'POST',
|
|
74
81
|
path: '/v2/client-contacts',
|
|
75
82
|
responses: {
|
|
76
83
|
201: exports.ClientContactSchema,
|
|
77
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
78
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
79
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
80
84
|
409: error_schemas_1.ErrorResponseSchema,
|
|
81
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
82
85
|
},
|
|
83
86
|
body: exports.CreateClientContactSchema,
|
|
84
87
|
summary: 'Create a new client contact',
|
|
@@ -88,11 +91,7 @@ const clientContactsContractConfig = {
|
|
|
88
91
|
path: '/v2/client-contacts/client/:clientId',
|
|
89
92
|
responses: {
|
|
90
93
|
201: exports.ClientContactSchema,
|
|
91
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
92
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
93
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
94
94
|
409: error_schemas_1.ErrorResponseSchema,
|
|
95
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
96
95
|
},
|
|
97
96
|
pathParams: zod_1.z.object({
|
|
98
97
|
clientId: zod_1.z.string().uuid(),
|
|
@@ -104,11 +103,7 @@ const clientContactsContractConfig = {
|
|
|
104
103
|
method: 'GET',
|
|
105
104
|
path: '/v2/client-contacts',
|
|
106
105
|
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,
|
|
106
|
+
200: exports.ClientContactPaginatedResponseSchema,
|
|
112
107
|
},
|
|
113
108
|
query: exports.FilterClientContactSchema,
|
|
114
109
|
summary: 'Get all client contacts',
|
|
@@ -118,11 +113,7 @@ const clientContactsContractConfig = {
|
|
|
118
113
|
path: '/v2/client-contacts/:contactId',
|
|
119
114
|
responses: {
|
|
120
115
|
200: exports.ClientContactSchema,
|
|
121
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
122
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
123
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
124
116
|
404: error_schemas_1.ErrorResponseSchema,
|
|
125
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
126
117
|
},
|
|
127
118
|
pathParams: zod_1.z.object({
|
|
128
119
|
contactId: zod_1.z.string().uuid(),
|
|
@@ -134,12 +125,8 @@ const clientContactsContractConfig = {
|
|
|
134
125
|
path: '/v2/client-contacts/:contactId',
|
|
135
126
|
responses: {
|
|
136
127
|
200: exports.ClientContactSchema,
|
|
137
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
138
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
139
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
140
128
|
404: error_schemas_1.ErrorResponseSchema,
|
|
141
129
|
409: error_schemas_1.ErrorResponseSchema,
|
|
142
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
143
130
|
},
|
|
144
131
|
pathParams: zod_1.z.object({
|
|
145
132
|
contactId: zod_1.z.string().uuid(),
|
|
@@ -151,12 +138,8 @@ const clientContactsContractConfig = {
|
|
|
151
138
|
method: 'DELETE',
|
|
152
139
|
path: '/v2/client-contacts/:contactId',
|
|
153
140
|
responses: {
|
|
154
|
-
204:
|
|
155
|
-
400: error_schemas_1.ErrorResponseSchema,
|
|
156
|
-
401: error_schemas_1.ErrorResponseSchema,
|
|
157
|
-
403: error_schemas_1.ErrorResponseSchema,
|
|
141
|
+
204: zod_1.z.undefined(),
|
|
158
142
|
404: error_schemas_1.ErrorResponseSchema,
|
|
159
|
-
500: error_schemas_1.ErrorResponseSchema,
|
|
160
143
|
},
|
|
161
144
|
pathParams: zod_1.z.object({
|
|
162
145
|
contactId: zod_1.z.string().uuid(),
|
|
@@ -164,6 +147,11 @@ const clientContactsContractConfig = {
|
|
|
164
147
|
body: c.noBody(),
|
|
165
148
|
summary: 'Delete a client contact',
|
|
166
149
|
},
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
150
|
+
}, {
|
|
151
|
+
commonResponses: {
|
|
152
|
+
400: error_schemas_1.ErrorResponseSchema,
|
|
153
|
+
401: error_schemas_1.ErrorResponseSchema,
|
|
154
|
+
403: error_schemas_1.ErrorResponseSchema,
|
|
155
|
+
500: error_schemas_1.ErrorResponseSchema,
|
|
156
|
+
},
|
|
157
|
+
});
|