@esb-market-contracts/backend 1.0.13 → 1.0.14

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/api.d.ts CHANGED
@@ -290,5 +290,103 @@ declare const countriesRouter: import("hono/hono-base").HonoBase<{
290
290
  };
291
291
  }, "/catalog/countries", "/catalog/countries/update">;
292
292
  export type CountriesRouter = typeof countriesRouter;
293
+ declare const customersRouter: import("hono/hono-base").HonoBase<{
294
+ Variables: VariablesWithActor;
295
+ }, {
296
+ "/operations/customers/one": {
297
+ $get: {
298
+ input: {
299
+ query: {
300
+ id: string | string[];
301
+ };
302
+ };
303
+ output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
304
+ customer: {
305
+ id: number;
306
+ type: "individual" | "individual_entrepreneur" | "legal_entity";
307
+ name: string;
308
+ identificationNumber: string | null;
309
+ emailAddress: string | null;
310
+ phoneNumber: string | null;
311
+ notes: string | null;
312
+ updatedAt: Date | null;
313
+ createdAt: Date;
314
+ };
315
+ }>;
316
+ outputFormat: "json";
317
+ status: 200;
318
+ };
319
+ };
320
+ } & {
321
+ "/operations/customers/create": {
322
+ $post: {
323
+ input: {
324
+ json: {
325
+ type: "individual" | "individual_entrepreneur" | "legal_entity";
326
+ name: string;
327
+ notes?: string | null | undefined;
328
+ identificationNumber?: string | null | undefined;
329
+ emailAddress?: string | null | undefined;
330
+ phoneNumber?: string | null | undefined;
331
+ };
332
+ };
333
+ output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<Record<string, never>>;
334
+ outputFormat: "json";
335
+ status: 201;
336
+ };
337
+ };
338
+ } & {
339
+ "/operations/customers/search": {
340
+ $post: {
341
+ input: {
342
+ json: {
343
+ pagination: {
344
+ offset?: unknown;
345
+ limit?: unknown;
346
+ };
347
+ where?: {
348
+ type?: "individual" | "individual_entrepreneur" | "legal_entity" | undefined;
349
+ } | undefined;
350
+ query?: string | undefined;
351
+ };
352
+ };
353
+ output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<{
354
+ customers: {
355
+ id: number;
356
+ type: "individual" | "individual_entrepreneur" | "legal_entity";
357
+ name: string;
358
+ identificationNumber: string | null;
359
+ emailAddress: string | null;
360
+ phoneNumber: string | null;
361
+ notes: string | null;
362
+ updatedAt: Date | null;
363
+ createdAt: Date;
364
+ }[];
365
+ total: number;
366
+ }>;
367
+ outputFormat: "json";
368
+ status: 200;
369
+ };
370
+ };
371
+ } & {
372
+ "/operations/customers/update": {
373
+ $post: {
374
+ input: {
375
+ json: {
376
+ customerId: number;
377
+ name?: string | undefined;
378
+ notes?: string | null | undefined;
379
+ identificationNumber?: string | null | undefined;
380
+ emailAddress?: string | null | undefined;
381
+ phoneNumber?: string | null | undefined;
382
+ };
383
+ };
384
+ output: import("@kalutskii/foundation").APIError | import("@kalutskii/foundation").APISuccess<Record<string, never>>;
385
+ outputFormat: "json";
386
+ status: 200;
387
+ };
388
+ };
389
+ }, "/operations/customers", "/operations/customers/update">;
390
+ export type CustomersRouter = typeof customersRouter;
293
391
 
294
392
  export {};
package/enums.d.ts CHANGED
@@ -20,8 +20,20 @@ declare const entityStatusesRecord: Readonly<{
20
20
  ARCHIVED: "archived";
21
21
  }>;
22
22
  export type EntityStatus = (typeof entityStatusesArray)[number];
23
+ export declare const customerTypesArray: readonly [
24
+ "individual",
25
+ "individual_entrepreneur",
26
+ "legal_entity"
27
+ ];
28
+ declare const customerTypesRecord: Readonly<{
29
+ INDIVIDUAL: "individual";
30
+ INDIVIDUAL_ENTREPRENEUR: "individual_entrepreneur";
31
+ LEGAL_ENTITY: "legal_entity";
32
+ }>;
33
+ export type CustomerType = (typeof customerTypesArray)[number];
23
34
 
24
35
  export {
36
+ customerTypesRecord as customerType,
25
37
  entityStatusesRecord as entityStatus,
26
38
  };
27
39
 
package/enums.js CHANGED
@@ -17,7 +17,16 @@ import { pgEnum } from "drizzle-orm/pg-core";
17
17
  var entityStatusesArray = ["active", "archived"];
18
18
  var entityStatusPGEnum = pgEnum("entity_status", entityStatusesArray);
19
19
  var entityStatusesRecord = createStringEnumRecord2(entityStatusesArray);
20
+
21
+ // src/app/domain/(operations)/customers/customers.enums.ts
22
+ import { createStringEnumRecord as createStringEnumRecord3 } from "@kalutskii/foundation";
23
+ import { pgEnum as pgEnum2 } from "drizzle-orm/pg-core";
24
+ var customerTypesArray = ["individual", "individual_entrepreneur", "legal_entity"];
25
+ var customerTypePGEnum = pgEnum2("customer_type", customerTypesArray);
26
+ var customerTypesRecord = createStringEnumRecord3(customerTypesArray);
20
27
  export {
28
+ customerTypesRecord as customerType,
29
+ customerTypesArray,
21
30
  entityStatusesRecord as entityStatus,
22
31
  locale,
23
32
  localesArray
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@esb-market-contracts/backend",
3
3
  "description": "Shared TypeScript contract definitions for backend.",
4
- "version": "1.0.13",
4
+ "version": "1.0.14",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "sideEffects": false,
package/types.d.ts CHANGED
@@ -219,5 +219,70 @@ export type CountrySearchResult = {
219
219
  export type CountrySelectOneQuery = z.infer<typeof countrySelectOneQuerySchema>;
220
220
  export type CountryCreatePayload = z.infer<typeof countryCreatePayloadSchema>;
221
221
  export type CountryUpdatePayload = z.infer<typeof countryUpdatePayloadSchema>;
222
+ declare const customerSchema: z.ZodObject<{
223
+ id: z.ZodInt;
224
+ type: z.ZodEnum<{
225
+ individual: "individual";
226
+ individual_entrepreneur: "individual_entrepreneur";
227
+ legal_entity: "legal_entity";
228
+ }>;
229
+ name: z.ZodString;
230
+ identificationNumber: z.ZodNullable<z.ZodString>;
231
+ emailAddress: z.ZodNullable<z.ZodString>;
232
+ phoneNumber: z.ZodNullable<z.ZodString>;
233
+ notes: z.ZodNullable<z.ZodString>;
234
+ updatedAt: z.ZodNullable<z.ZodDate>;
235
+ createdAt: z.ZodDate;
236
+ }, z.core.$strip>;
237
+ export type Customer = z.infer<typeof customerSchema>;
238
+ declare const customerSearchOptionsSchema: z.ZodObject<{
239
+ where: z.ZodOptional<z.ZodPipe<z.ZodObject<{
240
+ type: z.ZodOptional<z.ZodEnum<{
241
+ individual: "individual";
242
+ individual_entrepreneur: "individual_entrepreneur";
243
+ legal_entity: "legal_entity";
244
+ }>>;
245
+ }, z.core.$strip>, z.ZodTransform<{
246
+ type: "individual" | "individual_entrepreneur" | "legal_entity";
247
+ }, {
248
+ type?: "individual" | "individual_entrepreneur" | "legal_entity" | undefined;
249
+ }>>>;
250
+ query: z.ZodOptional<z.ZodString>;
251
+ pagination: z.ZodObject<{
252
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
253
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
254
+ }, z.core.$strip>;
255
+ }, z.core.$strict>;
256
+ declare const customerSelectOneQuerySchema: z.ZodObject<{
257
+ id: z.ZodInt;
258
+ }, z.core.$strip>;
259
+ declare const customerCreatePayloadSchema: z.ZodObject<{
260
+ type: z.ZodEnum<{
261
+ individual: "individual";
262
+ individual_entrepreneur: "individual_entrepreneur";
263
+ legal_entity: "legal_entity";
264
+ }>;
265
+ name: z.ZodString;
266
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
267
+ identificationNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
268
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
+ phoneNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
270
+ }, z.core.$strip>;
271
+ declare const customerUpdatePayloadSchema: z.ZodObject<{
272
+ name: z.ZodOptional<z.ZodString>;
273
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
274
+ identificationNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
275
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
276
+ phoneNumber: z.ZodOptional<z.ZodNullable<z.ZodString>>;
277
+ customerId: z.ZodInt;
278
+ }, z.core.$strip>;
279
+ export type CustomerSearchOptions = z.infer<typeof customerSearchOptionsSchema>;
280
+ export type CustomerSearchResult = {
281
+ customers: Customer[];
282
+ total: number;
283
+ };
284
+ export type CustomerSelectOneQuery = z.infer<typeof customerSelectOneQuerySchema>;
285
+ export type CustomerCreatePayload = z.infer<typeof customerCreatePayloadSchema>;
286
+ export type CustomerUpdatePayload = z.infer<typeof customerUpdatePayloadSchema>;
222
287
 
223
288
  export {};