@dakkitor/api-contracts 1.1.127 → 1.1.129
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/abilities/admin.abilities.json +4 -0
- package/dist/abilities/kpi.abilities.json +9 -0
- package/dist/actives/actives.contract.d.ts +4811 -3339
- package/dist/actives/actives.contract.d.ts.map +1 -1
- package/dist/agent-client-links/agent-client-links.contract.d.ts +721 -351
- package/dist/agent-client-links/agent-client-links.contract.d.ts.map +1 -1
- package/dist/auth/auth.contract.d.ts +16 -16
- package/dist/bookings/bookings.contract.d.ts +18386 -12658
- package/dist/bookings/bookings.contract.d.ts.map +1 -1
- package/dist/call-history/call-history.contract.d.ts +706 -428
- package/dist/call-history/call-history.contract.d.ts.map +1 -1
- package/dist/client-contacts/client-contacts.contract.d.ts +356 -356
- package/dist/clients/clients.contract.d.ts +106 -106
- package/dist/collaboration-checkings/collaboration-checkings.contract.d.ts +1813 -1197
- package/dist/collaboration-checkings/collaboration-checkings.contract.d.ts.map +1 -1
- package/dist/collaborations/collaborations.contract.d.ts +1629 -1024
- package/dist/collaborations/collaborations.contract.d.ts.map +1 -1
- package/dist/curated-workers/curated-workers.contract.d.ts +350 -350
- package/dist/dashboards/dashboard-widgets.contract.d.ts +52 -52
- package/dist/dashboards/dashboard.contract.d.ts +26 -26
- package/dist/index.d.ts +66 -63
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/jobs/jobs.contract.d.ts +3290 -2230
- package/dist/jobs/jobs.contract.d.ts.map +1 -1
- package/dist/lead-assignments/lead-assignments.contract.d.ts +636 -332
- package/dist/lead-assignments/lead-assignments.contract.d.ts.map +1 -1
- package/dist/lead-distribution/agent-lead-distribution.contract.d.ts +296 -144
- package/dist/lead-distribution/agent-lead-distribution.contract.d.ts.map +1 -1
- package/dist/leads/leads.contract.d.ts +122 -122
- package/dist/monitoring/monitoring.contract.d.ts +615 -0
- package/dist/monitoring/monitoring.contract.d.ts.map +1 -0
- package/dist/monitoring/monitoring.contract.js +106 -0
- package/dist/users/users.contract.d.ts +322 -158
- package/dist/users/users.contract.d.ts.map +1 -1
- package/dist/users/users.contract.js +133 -125
- package/dist/workers/workers.contract.d.ts +630 -412
- package/dist/workers/workers.contract.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.contract.d.ts","sourceRoot":"","sources":["../../contracts/users/users.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,EAKxB,MAAM,0BAA0B,CAAC;AAOlC,eAAO,MAAM,cAAc,8FAOzB,CAAC;AAEH,eAAO,MAAM,gBAAgB,+QAmB3B,CAAC;AAEH,eAAO,MAAM,wBAAwB,4DAKnC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAEhC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;EAEtC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;EAEtC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAa5B,CAAC;AAEH,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"users.contract.d.ts","sourceRoot":"","sources":["../../contracts/users/users.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,EAKxB,MAAM,0BAA0B,CAAC;AAOlC,eAAO,MAAM,cAAc,8FAOzB,CAAC;AAEH,eAAO,MAAM,gBAAgB,+QAmB3B,CAAC;AAEH,eAAO,MAAM,wBAAwB,4DAKnC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAEhC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;EAEtC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiHzB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usersContract = exports.PaginatedUserResponseSchema = exports.
|
|
3
|
+
exports.usersContract = exports.PaginatedUserResponseSchema = exports.ProfileSchema = exports.FilterUserSchema = exports.UpdateUserSchema = exports.CreateUserSchema = exports.UserSchema = exports.RolesFilterSchema = exports.UserAutocompleteArraySchema = exports.UserAutocompleteResponseSchema = exports.UpsertUserPhoneNumberSchema = exports.CreateUserPhoneNumberSchema = exports.UserPhoneNumberSchema = exports.UserSortableFieldsSchema = exports.UserOfficeSchema = exports.UserRoleSchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@anatine/zod-openapi");
|
|
5
5
|
const core_1 = require("@ts-rest/core");
|
|
6
6
|
const zod_1 = require("zod");
|
|
@@ -10,59 +10,69 @@ const pagination_query_schema_1 = require("../common/pagination-query.schema");
|
|
|
10
10
|
const pagination_schema_1 = require("../common/pagination.schema");
|
|
11
11
|
(0, zod_openapi_1.extendZodWithOpenApi)(zod_1.z);
|
|
12
12
|
exports.UserRoleSchema = zod_1.z.enum([
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
"ADMIN",
|
|
14
|
+
"SECOND_AGENT",
|
|
15
|
+
"FIRST_AGENT",
|
|
16
|
+
"COMPANY_CHECKING",
|
|
17
|
+
"KPI",
|
|
18
|
+
"TEAM_LEADS",
|
|
19
19
|
]);
|
|
20
20
|
exports.UserOfficeSchema = zod_1.z.enum([
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
"ALBANIA",
|
|
22
|
+
"CRAIOVA",
|
|
23
|
+
"DANI",
|
|
24
|
+
"GABI_RECRUTARE",
|
|
25
|
+
"GEORGIA",
|
|
26
|
+
"INDIA",
|
|
27
|
+
"IONITA",
|
|
28
|
+
"MARIUS_DRAGAN",
|
|
29
|
+
"MAX_MANGU",
|
|
30
|
+
"MAXIM_VADIM",
|
|
31
|
+
"MD_BOGDAN",
|
|
32
|
+
"MD_DANIEL_CHISINAU",
|
|
33
|
+
"NEACSU",
|
|
34
|
+
"ROBERT_DENIS",
|
|
35
|
+
"ROBERT_RADU",
|
|
36
|
+
"VICTORIEI_MIRIAM",
|
|
37
|
+
"VIZIRU",
|
|
38
|
+
"Y_INDIVIDUALS_RECRUITMENT",
|
|
39
39
|
]);
|
|
40
40
|
exports.UserSortableFieldsSchema = zod_1.z.enum([
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
"lastName",
|
|
42
|
+
"firstName",
|
|
43
|
+
"email",
|
|
44
|
+
"createdAt",
|
|
45
45
|
]);
|
|
46
46
|
exports.UserPhoneNumberSchema = common_schemas_1.PhoneNumberResponseSchema.openapi({
|
|
47
|
-
title:
|
|
47
|
+
title: "UserPhoneNumber",
|
|
48
48
|
});
|
|
49
49
|
exports.CreateUserPhoneNumberSchema = common_schemas_1.CreatePhoneNumberSchema.openapi({
|
|
50
|
-
title:
|
|
50
|
+
title: "CreateUserPhoneNumber",
|
|
51
51
|
});
|
|
52
52
|
exports.UpsertUserPhoneNumberSchema = common_schemas_1.UpsertPhoneNumberSchema.openapi({
|
|
53
|
-
title:
|
|
53
|
+
title: "UpsertUserPhoneNumber",
|
|
54
54
|
});
|
|
55
|
+
exports.UserAutocompleteResponseSchema = zod_1.z
|
|
56
|
+
.object({
|
|
57
|
+
id: zod_1.z.string().describe("The unique identifier of the user."),
|
|
58
|
+
firstName: zod_1.z.string().describe("The first name of the user."),
|
|
59
|
+
lastName: zod_1.z.string().describe("The last name of the user."),
|
|
60
|
+
})
|
|
61
|
+
.openapi({ title: "UserAutocompleteResponse" });
|
|
62
|
+
exports.UserAutocompleteArraySchema = zod_1.z
|
|
63
|
+
.array(exports.UserAutocompleteResponseSchema)
|
|
64
|
+
.openapi({ title: "UserAutocompleteArray" });
|
|
55
65
|
exports.RolesFilterSchema = zod_1.z.object({
|
|
56
66
|
values: zod_1.z
|
|
57
67
|
.array(exports.UserRoleSchema)
|
|
58
68
|
.optional()
|
|
59
|
-
.describe(
|
|
69
|
+
.describe("Array of roles to filter by"),
|
|
60
70
|
requireAll: zod_1.z
|
|
61
|
-
.preprocess((val) => (val ===
|
|
62
|
-
.describe(
|
|
71
|
+
.preprocess((val) => (val === "true" ? true : val === "false" ? false : val), zod_1.z.boolean().optional())
|
|
72
|
+
.describe("If true, user must have ALL roles. If false, user must have ANY role."),
|
|
63
73
|
});
|
|
64
74
|
exports.UserSchema = zod_1.z.object({
|
|
65
|
-
id: zod_1.z.string().uuid().describe(
|
|
75
|
+
id: zod_1.z.string().uuid().describe("The unique identifier of the user."),
|
|
66
76
|
firstName: zod_1.z.string().describe("The user's first name."),
|
|
67
77
|
lastName: zod_1.z.string().describe("The user's last name."),
|
|
68
78
|
email: zod_1.z.string().email().describe("The user's email address."),
|
|
@@ -70,208 +80,206 @@ exports.UserSchema = zod_1.z.object({
|
|
|
70
80
|
.array(exports.UserPhoneNumberSchema)
|
|
71
81
|
.optional()
|
|
72
82
|
.default([])
|
|
73
|
-
.describe(
|
|
83
|
+
.describe("Phone Numbers"),
|
|
74
84
|
roles: zod_1.z.array(exports.UserRoleSchema).optional().describe("The user's roles."),
|
|
75
85
|
office: exports.UserOfficeSchema.nullable().optional().describe("The user's office."),
|
|
86
|
+
canImpersonateUsers: zod_1.z
|
|
87
|
+
.array(exports.UserAutocompleteResponseSchema)
|
|
88
|
+
.optional()
|
|
89
|
+
.describe("Users that this KPI user can impersonate"),
|
|
76
90
|
createdAt: zod_1.z
|
|
77
91
|
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
78
92
|
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
79
|
-
.describe(
|
|
93
|
+
.describe("The date and time the user was created."),
|
|
80
94
|
updatedAt: zod_1.z
|
|
81
95
|
.union([zod_1.z.string().datetime(), zod_1.z.date()])
|
|
82
96
|
.transform((val) => (val instanceof Date ? val.toISOString() : val))
|
|
83
|
-
.describe(
|
|
97
|
+
.describe("The date and time the user was last updated."),
|
|
84
98
|
});
|
|
85
99
|
exports.CreateUserSchema = zod_1.z
|
|
86
100
|
.object({
|
|
87
|
-
firstName: zod_1.z.string().min(1).describe(
|
|
88
|
-
lastName: zod_1.z.string().min(1).describe(
|
|
89
|
-
email: zod_1.z.string().email().describe(
|
|
101
|
+
firstName: zod_1.z.string().min(1).describe("Enter first name"),
|
|
102
|
+
lastName: zod_1.z.string().min(1).describe("Enter last name"),
|
|
103
|
+
email: zod_1.z.string().email().describe("Enter email address"),
|
|
90
104
|
phoneNumbers: zod_1.z
|
|
91
105
|
.array(exports.CreateUserPhoneNumberSchema)
|
|
92
|
-
.min(1, { message:
|
|
106
|
+
.min(1, { message: "At least one phone number is required" })
|
|
93
107
|
.refine((phoneNumbers) => phoneNumbers.some((phone) => phone.isPrimary), {
|
|
94
|
-
message:
|
|
108
|
+
message: "Must have at least one primary phone number",
|
|
95
109
|
})
|
|
96
|
-
.describe(
|
|
97
|
-
password: zod_1.z.string().min(8).optional().describe(
|
|
98
|
-
roles: zod_1.z.array(exports.UserRoleSchema).optional().describe(
|
|
99
|
-
office: exports.UserOfficeSchema.nullable().optional().describe(
|
|
110
|
+
.describe("Phone Numbers"),
|
|
111
|
+
password: zod_1.z.string().min(8).optional().describe("Enter password"),
|
|
112
|
+
roles: zod_1.z.array(exports.UserRoleSchema).optional().describe("Select roles"),
|
|
113
|
+
office: exports.UserOfficeSchema.nullable().optional().describe("Select office"),
|
|
100
114
|
})
|
|
101
|
-
.openapi({ title:
|
|
115
|
+
.openapi({ title: "CreateUser" });
|
|
102
116
|
exports.UpdateUserSchema = zod_1.z
|
|
103
117
|
.object({
|
|
104
|
-
firstName: zod_1.z.string().min(1).describe(
|
|
105
|
-
lastName: zod_1.z.string().min(1).describe(
|
|
106
|
-
email: zod_1.z.string().email().describe(
|
|
118
|
+
firstName: zod_1.z.string().min(1).describe("Enter first name"),
|
|
119
|
+
lastName: zod_1.z.string().min(1).describe("Enter last name"),
|
|
120
|
+
email: zod_1.z.string().email().describe("Enter email address"),
|
|
107
121
|
phoneNumbers: zod_1.z
|
|
108
122
|
.array(exports.UpsertUserPhoneNumberSchema)
|
|
109
|
-
.min(1, { message:
|
|
123
|
+
.min(1, { message: "At least one phone number is required" })
|
|
110
124
|
.refine((phoneNumbers) => phoneNumbers.some((phone) => phone.isPrimary), {
|
|
111
|
-
message:
|
|
125
|
+
message: "Must have at least one primary phone number",
|
|
112
126
|
})
|
|
113
|
-
.describe(
|
|
114
|
-
password: zod_1.z.string().min(8).optional().describe(
|
|
115
|
-
roles: zod_1.z.array(exports.UserRoleSchema).optional().describe(
|
|
116
|
-
office: exports.UserOfficeSchema.nullable().optional().describe(
|
|
127
|
+
.describe("Phone Numbers"),
|
|
128
|
+
password: zod_1.z.string().min(8).optional().describe("Enter password"),
|
|
129
|
+
roles: zod_1.z.array(exports.UserRoleSchema).optional().describe("Select roles"),
|
|
130
|
+
office: exports.UserOfficeSchema.nullable().optional().describe("Select office"),
|
|
131
|
+
canImpersonateUserIds: zod_1.z
|
|
132
|
+
.array(zod_1.z.string().uuid())
|
|
133
|
+
.optional()
|
|
134
|
+
.describe("User IDs that this KPI user can impersonate"),
|
|
117
135
|
})
|
|
118
136
|
.partial()
|
|
119
|
-
.openapi({ title:
|
|
137
|
+
.openapi({ title: "UpdateUser" });
|
|
120
138
|
exports.FilterUserSchema = pagination_query_schema_1.PaginationQuerySchema.extend({
|
|
121
139
|
name: zod_1.z
|
|
122
140
|
.string()
|
|
123
141
|
.optional()
|
|
124
|
-
.describe(
|
|
142
|
+
.describe("Filter users by name using fuzzy search (searches firstName and lastName)"),
|
|
125
143
|
email: zod_1.z
|
|
126
144
|
.string()
|
|
127
145
|
.optional()
|
|
128
|
-
.describe(
|
|
146
|
+
.describe("Filter users by email (case-insensitive, partial match)"),
|
|
129
147
|
phone: zod_1.z
|
|
130
148
|
.string()
|
|
131
149
|
.optional()
|
|
132
|
-
.describe(
|
|
133
|
-
roles: exports.RolesFilterSchema.optional().describe(
|
|
134
|
-
office: exports.UserOfficeSchema.optional().describe(
|
|
135
|
-
sortBy: exports.UserSortableFieldsSchema.optional().describe(
|
|
136
|
-
sortOrder: common_schemas_1.SortOrderSchema.optional().describe(
|
|
150
|
+
.describe("Filter users by phone number (partial match)"),
|
|
151
|
+
roles: exports.RolesFilterSchema.optional().describe("Filter users by roles."),
|
|
152
|
+
office: exports.UserOfficeSchema.optional().describe("Filter users by office."),
|
|
153
|
+
sortBy: exports.UserSortableFieldsSchema.optional().describe("Field to sort users by."),
|
|
154
|
+
sortOrder: common_schemas_1.SortOrderSchema.optional().describe("Sort order (ASC or DESC)"),
|
|
137
155
|
});
|
|
138
156
|
exports.ProfileSchema = zod_1.z
|
|
139
157
|
.object({
|
|
140
|
-
id: zod_1.z.string().describe(
|
|
141
|
-
email: zod_1.z.string().describe(
|
|
142
|
-
firstName: zod_1.z.string().optional().describe(
|
|
143
|
-
lastName: zod_1.z.string().optional().describe(
|
|
158
|
+
id: zod_1.z.string().describe("The unique identifier of the user."),
|
|
159
|
+
email: zod_1.z.string().describe("The email address of the user."),
|
|
160
|
+
firstName: zod_1.z.string().optional().describe("The first name of the user."),
|
|
161
|
+
lastName: zod_1.z.string().optional().describe("The last name of the user."),
|
|
144
162
|
phoneNumbers: zod_1.z
|
|
145
163
|
.array(exports.UserPhoneNumberSchema)
|
|
146
164
|
.optional()
|
|
147
165
|
.default([])
|
|
148
|
-
.describe(
|
|
166
|
+
.describe("Phone Numbers"),
|
|
149
167
|
roles: zod_1.z
|
|
150
168
|
.array(exports.UserRoleSchema)
|
|
151
169
|
.optional()
|
|
152
|
-
.describe(
|
|
170
|
+
.describe("The roles assigned to the user."),
|
|
153
171
|
impersonatedBy: zod_1.z
|
|
154
172
|
.string()
|
|
155
173
|
.optional()
|
|
156
|
-
.describe(
|
|
157
|
-
})
|
|
158
|
-
.openapi({ title: 'Profile' });
|
|
159
|
-
exports.UserAutocompleteResponseSchema = zod_1.z
|
|
160
|
-
.object({
|
|
161
|
-
id: zod_1.z.string().describe('The unique identifier of the user.'),
|
|
162
|
-
firstName: zod_1.z.string().describe('The first name of the user.'),
|
|
163
|
-
lastName: zod_1.z.string().describe('The last name of the user.'),
|
|
174
|
+
.describe("The ID of the admin who is impersonating this user."),
|
|
164
175
|
})
|
|
165
|
-
.openapi({ title:
|
|
166
|
-
exports.UserAutocompleteArraySchema = zod_1.z
|
|
167
|
-
.array(exports.UserAutocompleteResponseSchema)
|
|
168
|
-
.openapi({ title: 'UserAutocompleteArray' });
|
|
176
|
+
.openapi({ title: "Profile" });
|
|
169
177
|
exports.PaginatedUserResponseSchema = (0, pagination_schema_1.createPaginatedResponseSchema)(exports.UserSchema)
|
|
170
|
-
.describe(
|
|
171
|
-
.openapi({ title:
|
|
178
|
+
.describe("Resources retrieved successfully.")
|
|
179
|
+
.openapi({ title: "UsersPaginatedResponse" });
|
|
172
180
|
const c = (0, core_1.initContract)();
|
|
173
181
|
exports.usersContract = c.router({
|
|
174
182
|
create: {
|
|
175
|
-
method:
|
|
176
|
-
path:
|
|
183
|
+
method: "POST",
|
|
184
|
+
path: "/v2/users",
|
|
177
185
|
responses: {
|
|
178
186
|
201: exports.UserSchema,
|
|
179
187
|
409: error_schemas_1.ErrorResponseSchema,
|
|
180
188
|
},
|
|
181
189
|
body: exports.CreateUserSchema,
|
|
182
|
-
summary:
|
|
183
|
-
metadata: { tags: [
|
|
190
|
+
summary: "Create a new user",
|
|
191
|
+
metadata: { tags: ["Users"] },
|
|
184
192
|
},
|
|
185
193
|
findAll: {
|
|
186
|
-
method:
|
|
187
|
-
path:
|
|
194
|
+
method: "GET",
|
|
195
|
+
path: "/v2/users",
|
|
188
196
|
responses: {
|
|
189
197
|
200: exports.PaginatedUserResponseSchema,
|
|
190
198
|
},
|
|
191
199
|
query: exports.FilterUserSchema,
|
|
192
|
-
summary:
|
|
193
|
-
metadata: { tags: [
|
|
200
|
+
summary: "Get all users",
|
|
201
|
+
metadata: { tags: ["Users"] },
|
|
194
202
|
},
|
|
195
203
|
autocomplete: {
|
|
196
|
-
method:
|
|
197
|
-
path:
|
|
204
|
+
method: "GET",
|
|
205
|
+
path: "/v2/users/autocomplete",
|
|
198
206
|
responses: {
|
|
199
207
|
200: exports.UserAutocompleteArraySchema,
|
|
200
208
|
},
|
|
201
209
|
query: common_schemas_1.AutocompleteQuerySchema,
|
|
202
|
-
summary:
|
|
203
|
-
metadata: { tags: [
|
|
210
|
+
summary: "Get users for autocomplete",
|
|
211
|
+
metadata: { tags: ["Users"] },
|
|
204
212
|
},
|
|
205
213
|
autocompleteFirstAgent: {
|
|
206
|
-
method:
|
|
207
|
-
path:
|
|
214
|
+
method: "GET",
|
|
215
|
+
path: "/v2/users/autocomplete/first-agent",
|
|
208
216
|
responses: {
|
|
209
217
|
200: exports.UserAutocompleteArraySchema,
|
|
210
218
|
},
|
|
211
219
|
query: common_schemas_1.AutocompleteQuerySchema,
|
|
212
|
-
summary:
|
|
213
|
-
metadata: { tags: [
|
|
220
|
+
summary: "Get users with FIRST_AGENT role for autocomplete",
|
|
221
|
+
metadata: { tags: ["Users"] },
|
|
214
222
|
},
|
|
215
223
|
autocompleteSecondAgent: {
|
|
216
|
-
method:
|
|
217
|
-
path:
|
|
224
|
+
method: "GET",
|
|
225
|
+
path: "/v2/users/autocomplete/second-agent",
|
|
218
226
|
responses: {
|
|
219
227
|
200: exports.UserAutocompleteArraySchema,
|
|
220
228
|
},
|
|
221
229
|
query: common_schemas_1.AutocompleteQuerySchema,
|
|
222
|
-
summary:
|
|
223
|
-
metadata: { tags: [
|
|
230
|
+
summary: "Get users with SECOND_AGENT role for autocomplete",
|
|
231
|
+
metadata: { tags: ["Users"] },
|
|
224
232
|
},
|
|
225
233
|
me: {
|
|
226
|
-
method:
|
|
227
|
-
path:
|
|
234
|
+
method: "GET",
|
|
235
|
+
path: "/v2/users/me",
|
|
228
236
|
responses: {
|
|
229
237
|
200: exports.ProfileSchema,
|
|
230
238
|
},
|
|
231
|
-
summary:
|
|
232
|
-
metadata: { tags: [
|
|
239
|
+
summary: "Get current user profile",
|
|
240
|
+
metadata: { tags: ["Users"] },
|
|
233
241
|
},
|
|
234
242
|
findOne: {
|
|
235
|
-
method:
|
|
236
|
-
path:
|
|
243
|
+
method: "GET",
|
|
244
|
+
path: "/v2/users/:id",
|
|
237
245
|
responses: {
|
|
238
246
|
200: exports.UserSchema,
|
|
239
247
|
404: error_schemas_1.ErrorResponseSchema,
|
|
240
248
|
},
|
|
241
249
|
pathParams: zod_1.z.object({
|
|
242
|
-
id: zod_1.z.string().uuid().describe(
|
|
250
|
+
id: zod_1.z.string().uuid().describe("The ID of the resource (UUID format)."),
|
|
243
251
|
}),
|
|
244
|
-
summary:
|
|
245
|
-
metadata: { tags: [
|
|
252
|
+
summary: "Get a user by ID",
|
|
253
|
+
metadata: { tags: ["Users"] },
|
|
246
254
|
},
|
|
247
255
|
update: {
|
|
248
|
-
method:
|
|
249
|
-
path:
|
|
256
|
+
method: "PATCH",
|
|
257
|
+
path: "/v2/users/:id",
|
|
250
258
|
responses: {
|
|
251
259
|
200: exports.UserSchema,
|
|
252
260
|
404: error_schemas_1.ErrorResponseSchema,
|
|
253
261
|
409: error_schemas_1.ErrorResponseSchema,
|
|
254
262
|
},
|
|
255
263
|
pathParams: zod_1.z.object({
|
|
256
|
-
id: zod_1.z.string().uuid().describe(
|
|
264
|
+
id: zod_1.z.string().uuid().describe("The ID of the resource (UUID format)."),
|
|
257
265
|
}),
|
|
258
266
|
body: exports.UpdateUserSchema,
|
|
259
|
-
summary:
|
|
260
|
-
metadata: { tags: [
|
|
267
|
+
summary: "Update a user by ID",
|
|
268
|
+
metadata: { tags: ["Users"] },
|
|
261
269
|
},
|
|
262
270
|
remove: {
|
|
263
|
-
method:
|
|
264
|
-
path:
|
|
271
|
+
method: "DELETE",
|
|
272
|
+
path: "/v2/users/:id",
|
|
265
273
|
responses: {
|
|
266
274
|
204: zod_1.z.undefined(),
|
|
267
275
|
404: error_schemas_1.ErrorResponseSchema,
|
|
268
276
|
},
|
|
269
277
|
pathParams: zod_1.z.object({
|
|
270
|
-
id: zod_1.z.string().uuid().describe(
|
|
278
|
+
id: zod_1.z.string().uuid().describe("The ID of the resource (UUID format)."),
|
|
271
279
|
}),
|
|
272
280
|
body: zod_1.z.undefined(),
|
|
273
|
-
summary:
|
|
274
|
-
metadata: { tags: [
|
|
281
|
+
summary: "Delete a user by ID",
|
|
282
|
+
metadata: { tags: ["Users"] },
|
|
275
283
|
},
|
|
276
284
|
}, {
|
|
277
285
|
commonResponses: {
|