autosync_backend2 1.2.81 → 1.2.83

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +31 -29
  2. package/dist/index.js +237 -193
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1169,6 +1169,7 @@ export declare const app: Elysia<"", {
1169
1169
  };
1170
1170
  401: "Токен олдсонгүй";
1171
1171
  403: "Хандах эрхгүй байна.";
1172
+ 409: string;
1172
1173
  422: {
1173
1174
  type: "validation";
1174
1175
  on: string;
@@ -1178,6 +1179,7 @@ export declare const app: Elysia<"", {
1178
1179
  property?: string;
1179
1180
  expected?: string;
1180
1181
  };
1182
+ 500: {};
1181
1183
  };
1182
1184
  };
1183
1185
  };
@@ -1449,6 +1451,7 @@ export declare const app: Elysia<"", {
1449
1451
  401: "Токен олдсонгүй";
1450
1452
  403: "Хандах эрхгүй байна.";
1451
1453
  404: "Агуулахын бараа олдсонгүй.";
1454
+ 409: string;
1452
1455
  422: {
1453
1456
  type: "validation";
1454
1457
  on: string;
@@ -1458,6 +1461,7 @@ export declare const app: Elysia<"", {
1458
1461
  property?: string;
1459
1462
  expected?: string;
1460
1463
  };
1464
+ 500: {};
1461
1465
  };
1462
1466
  };
1463
1467
  };
@@ -2541,15 +2545,7 @@ export declare const app: Elysia<"", {
2541
2545
  body: unknown;
2542
2546
  params: {};
2543
2547
  query: {
2544
- id?: string | undefined;
2545
- createdAt?: string | undefined;
2546
- updatedAt?: string | undefined;
2547
- companyId?: string | undefined;
2548
- account?: string | undefined;
2549
- deletedAt?: string | null | undefined;
2550
- oldId?: number | null | undefined;
2551
- description?: string | null | undefined;
2552
- bank?: string | undefined;
2548
+ branchId?: string | undefined;
2553
2549
  pagination: {
2554
2550
  size: number;
2555
2551
  page: number;
@@ -2561,16 +2557,18 @@ export declare const app: Elysia<"", {
2561
2557
  totalCount: number;
2562
2558
  totalPage: number;
2563
2559
  result: Omit<{
2564
- id: string;
2565
- createdAt: string;
2566
- updatedAt: string;
2567
- companyId: string;
2568
- account: string;
2569
- deletedAt: string | null;
2570
- oldId: number | null;
2571
- description: string | null;
2572
- bank: string;
2573
- } & {
2560
+ account: {
2561
+ companyId: string;
2562
+ branchId: string | null;
2563
+ bank: string;
2564
+ account: string;
2565
+ description: string | null;
2566
+ id: string;
2567
+ createdAt: string;
2568
+ updatedAt: string;
2569
+ deletedAt: string | null;
2570
+ oldId: number | null;
2571
+ };
2574
2572
  totalCount: number;
2575
2573
  }, "totalCount">[];
2576
2574
  };
@@ -2591,6 +2589,7 @@ export declare const app: Elysia<"", {
2591
2589
  account: {
2592
2590
  post: {
2593
2591
  body: {
2592
+ branchId?: string | null | undefined;
2594
2593
  oldId?: number | null | undefined;
2595
2594
  description?: string | null | undefined;
2596
2595
  companyId: string;
@@ -2606,6 +2605,7 @@ export declare const app: Elysia<"", {
2606
2605
  createdAt: string;
2607
2606
  updatedAt: string;
2608
2607
  companyId: string;
2608
+ branchId: string | null;
2609
2609
  account: string;
2610
2610
  deletedAt: string | null;
2611
2611
  oldId: number | null;
@@ -2632,6 +2632,7 @@ export declare const app: Elysia<"", {
2632
2632
  put: {
2633
2633
  body: {
2634
2634
  companyId?: string | undefined;
2635
+ branchId?: string | null | undefined;
2635
2636
  account?: string | undefined;
2636
2637
  oldId?: number | null | undefined;
2637
2638
  description?: string | null | undefined;
@@ -2644,19 +2645,20 @@ export declare const app: Elysia<"", {
2644
2645
  headers: {};
2645
2646
  response: {
2646
2647
  200: {
2648
+ companyId: string;
2649
+ branchId: string | null;
2650
+ bank: string;
2651
+ account: string;
2652
+ description: string | null;
2647
2653
  id: string;
2648
2654
  createdAt: string;
2649
2655
  updatedAt: string;
2650
- companyId: string;
2651
- account: string;
2652
2656
  deletedAt: string | null;
2653
2657
  oldId: number | null;
2654
- description: string | null;
2655
- bank: string;
2656
2658
  };
2657
2659
  401: "Токен олдсонгүй";
2658
2660
  403: "Хандах эрхгүй байна.";
2659
- 404: string;
2661
+ 404: "Данс олдсонгүй.";
2660
2662
  422: {
2661
2663
  type: "validation";
2662
2664
  on: string;
@@ -2683,7 +2685,7 @@ export declare const app: Elysia<"", {
2683
2685
  response: {
2684
2686
  401: "Токен олдсонгүй";
2685
2687
  403: "Хандах эрхгүй байна.";
2686
- 404: string;
2688
+ 404: "Данс олдсонгүй.";
2687
2689
  422: {
2688
2690
  type: "validation";
2689
2691
  on: string;
@@ -12644,7 +12646,7 @@ export declare const app: Elysia<"", {
12644
12646
  nmKey: string | null;
12645
12647
  };
12646
12648
  401: "Токен олдсонгүй";
12647
- 409: "nmKey давхцаж байна.";
12649
+ 409: string;
12648
12650
  422: {
12649
12651
  type: "validation";
12650
12652
  on: string;
@@ -12654,7 +12656,7 @@ export declare const app: Elysia<"", {
12654
12656
  property?: string;
12655
12657
  expected?: string;
12656
12658
  };
12657
- 500: "Суваг үүсгэхэд алдаа гарлаа.";
12659
+ 500: {};
12658
12660
  };
12659
12661
  };
12660
12662
  };
@@ -12686,7 +12688,7 @@ export declare const app: Elysia<"", {
12686
12688
  };
12687
12689
  401: "Токен олдсонгүй";
12688
12690
  404: "Бүртгэл олдсонгүй.";
12689
- 409: "nmKey давхцаж байна.";
12691
+ 409: string;
12690
12692
  422: {
12691
12693
  type: "validation";
12692
12694
  on: string;
@@ -12696,7 +12698,7 @@ export declare const app: Elysia<"", {
12696
12698
  property?: string;
12697
12699
  expected?: string;
12698
12700
  };
12699
- 500: "Суваг засахэд алдаа гарлаа.";
12701
+ 500: {};
12700
12702
  };
12701
12703
  };
12702
12704
  };
package/dist/index.js CHANGED
@@ -121403,9 +121403,9 @@ var require_firebase_app = __commonJS((exports) => {
121403
121403
  this.checkDestroyed_();
121404
121404
  this.appStore?.removeApp(this.name);
121405
121405
  return Promise.all(Object.keys(this.services_).map((serviceName) => {
121406
- const service5 = this.services_[serviceName];
121407
- if (isStateful(service5)) {
121408
- return service5.delete();
121406
+ const service4 = this.services_[serviceName];
121407
+ if (isStateful(service4)) {
121408
+ return service4.delete();
121409
121409
  }
121410
121410
  return Promise.resolve();
121411
121411
  })).then(() => {
@@ -121427,8 +121427,8 @@ var require_firebase_app = __commonJS((exports) => {
121427
121427
  }
121428
121428
  }
121429
121429
  exports.FirebaseApp = FirebaseApp;
121430
- function isStateful(service5) {
121431
- return typeof service5.delete === "function";
121430
+ function isStateful(service4) {
121431
+ return typeof service4.delete === "function";
121432
121432
  }
121433
121433
  });
121434
121434
 
@@ -139219,8 +139219,8 @@ var require_index_node_cjs = __commonJS((exports) => {
139219
139219
  }
139220
139220
 
139221
139221
  class ErrorFactory {
139222
- constructor(service5, serviceName, errors3) {
139223
- this.service = service5;
139222
+ constructor(service4, serviceName, errors3) {
139223
+ this.service = service4;
139224
139224
  this.serviceName = serviceName;
139225
139225
  this.errors = errors3;
139226
139226
  }
@@ -139808,11 +139808,11 @@ var require_index_node_cjs = __commonJS((exports) => {
139808
139808
  }
139809
139809
  return "th";
139810
139810
  }
139811
- function getModularInstance(service5) {
139812
- if (service5 && service5._delegate) {
139813
- return service5._delegate;
139811
+ function getModularInstance(service4) {
139812
+ if (service4 && service4._delegate) {
139813
+ return service4._delegate;
139814
139814
  } else {
139815
- return service5;
139815
+ return service4;
139816
139816
  }
139817
139817
  }
139818
139818
  CONSTANTS2.NODE_CLIENT = true;
@@ -140158,8 +140158,8 @@ var require_index_cjs2 = __commonJS((exports) => {
140158
140158
  async delete() {
140159
140159
  const services = Array.from(this.instances.values());
140160
140160
  await Promise.all([
140161
- ...services.filter((service5) => ("INTERNAL" in service5)).map((service5) => service5.INTERNAL.delete()),
140162
- ...services.filter((service5) => ("_delete" in service5)).map((service5) => service5._delete())
140161
+ ...services.filter((service4) => ("INTERNAL" in service4)).map((service4) => service4.INTERNAL.delete()),
140162
+ ...services.filter((service4) => ("_delete" in service4)).map((service4) => service4._delete())
140163
140163
  ]);
140164
140164
  }
140165
140165
  isComponentSet() {
@@ -143249,8 +143249,8 @@ var require_index_standalone = __commonJS((exports) => {
143249
143249
  const providers = this.container.getProviders();
143250
143250
  return providers.map((provider) => {
143251
143251
  if (isVersionServiceProvider(provider)) {
143252
- const service5 = provider.getImmediate();
143253
- return `${service5.library}/${service5.version}`;
143252
+ const service4 = provider.getImmediate();
143253
+ return `${service4.library}/${service4.version}`;
143254
143254
  } else {
143255
143255
  return null;
143256
143256
  }
@@ -166600,17 +166600,17 @@ var require_service3 = __commonJS((exports, module) => {
166600
166600
  this._methodsArray = null;
166601
166601
  }
166602
166602
  Service.fromJSON = function fromJSON(name, json2) {
166603
- var service5 = new Service(name, json2.options);
166603
+ var service4 = new Service(name, json2.options);
166604
166604
  if (json2.methods)
166605
166605
  for (var names = Object.keys(json2.methods), i2 = 0;i2 < names.length; ++i2)
166606
- service5.add(Method.fromJSON(names[i2], json2.methods[names[i2]]));
166606
+ service4.add(Method.fromJSON(names[i2], json2.methods[names[i2]]));
166607
166607
  if (json2.nested)
166608
- service5.addJSON(json2.nested);
166608
+ service4.addJSON(json2.nested);
166609
166609
  if (json2.edition)
166610
- service5._edition = json2.edition;
166611
- service5.comment = json2.comment;
166612
- service5._defaultEdition = "proto3";
166613
- return service5;
166610
+ service4._edition = json2.edition;
166611
+ service4.comment = json2.comment;
166612
+ service4._defaultEdition = "proto3";
166613
+ return service4;
166614
166614
  };
166615
166615
  Service.prototype.toJSON = function toJSON(toJSONOptions) {
166616
166616
  var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions);
@@ -166633,9 +166633,9 @@ var require_service3 = __commonJS((exports, module) => {
166633
166633
  return this._methodsArray || (this._methodsArray = util.toArray(this.methods));
166634
166634
  }
166635
166635
  });
166636
- function clearCache(service5) {
166637
- service5._methodsArray = null;
166638
- return service5;
166636
+ function clearCache(service4) {
166637
+ service4._methodsArray = null;
166638
+ return service4;
166639
166639
  }
166640
166640
  Service.prototype.get = function get(name) {
166641
166641
  return this.methods[name] || Namespace.prototype.get.call(this, name);
@@ -169382,19 +169382,19 @@ var require_parse7 = __commonJS((exports, module) => {
169382
169382
  function parseService(parent, token2) {
169383
169383
  if (!nameRe.test(token2 = next()))
169384
169384
  throw illegal(token2, "service name");
169385
- var service5 = new Service(token2);
169386
- ifBlock(service5, function parseService_block(token3) {
169387
- if (parseCommon(service5, token3)) {
169385
+ var service4 = new Service(token2);
169386
+ ifBlock(service4, function parseService_block(token3) {
169387
+ if (parseCommon(service4, token3)) {
169388
169388
  return;
169389
169389
  }
169390
169390
  if (token3 === "rpc")
169391
- parseMethod(service5, token3);
169391
+ parseMethod(service4, token3);
169392
169392
  else
169393
169393
  throw illegal(token3);
169394
169394
  });
169395
- parent.add(service5);
169395
+ parent.add(service4);
169396
169396
  if (parent === ptr) {
169397
- topLevelObjects.push(service5);
169397
+ topLevelObjects.push(service4);
169398
169398
  }
169399
169399
  }
169400
169400
  function parseMethod(parent, token2) {
@@ -185352,9 +185352,9 @@ var require_fallback = __commonJS((exports, module) => {
185352
185352
  GrpcClient.protoCache.set(hash2, root);
185353
185353
  return root;
185354
185354
  }
185355
- static getServiceMethods(service5) {
185355
+ static getServiceMethods(service4) {
185356
185356
  const methods2 = {};
185357
- for (const [methodName, methodObject] of Object.entries(service5.methods)) {
185357
+ for (const [methodName, methodObject] of Object.entries(service4.methods)) {
185358
185358
  const methodNameLowerCamelCase = (0, util_1.toLowerCamelCase)(methodName);
185359
185359
  methods2[methodNameLowerCamelCase] = methodObject;
185360
185360
  }
@@ -185400,7 +185400,7 @@ var require_fallback = __commonJS((exports, module) => {
185400
185400
  }
185401
185401
  return gax.constructSettings(serviceName, clientConfig, configOverrides, status_1.Status, { metadataBuilder: buildMetadata });
185402
185402
  }
185403
- async createStub(service5, opts, customServicePath) {
185403
+ async createStub(service4, opts, customServicePath) {
185404
185404
  if (!this.authClient) {
185405
185405
  if (this.auth && "getClient" in this.auth) {
185406
185406
  this.authClient = await this.auth.getClient();
@@ -185420,15 +185420,15 @@ var require_fallback = __commonJS((exports, module) => {
185420
185420
  throw new Error(`The configured universe domain (${opts.universeDomain}) does not match the universe domain found in the credentials (${universeFromAuth}). ` + "If you haven't configured the universe domain explicitly, googleapis.com is the default.");
185421
185421
  }
185422
185422
  }
185423
- service5.resolveAll();
185424
- const methods2 = GrpcClient.getServiceMethods(service5);
185423
+ service4.resolveAll();
185424
+ const methods2 = GrpcClient.getServiceMethods(service4);
185425
185425
  const protocol = opts.protocol || "https";
185426
185426
  let servicePath = opts.servicePath;
185427
- if (!servicePath && service5.options && service5.options["(google.api.default_host)"]) {
185428
- servicePath = service5.options["(google.api.default_host)"];
185427
+ if (!servicePath && service4.options && service4.options["(google.api.default_host)"]) {
185428
+ servicePath = service4.options["(google.api.default_host)"];
185429
185429
  }
185430
185430
  if (!servicePath) {
185431
- throw new Error(`Cannot determine service API path for service ${service5.name}.`);
185431
+ throw new Error(`Cannot determine service API path for service ${service4.name}.`);
185432
185432
  }
185433
185433
  let servicePort;
185434
185434
  const match = servicePath.match(/^(.*):(\d+)$/);
@@ -191540,7 +191540,7 @@ var require_resolving_load_balancer = __commonJS((exports) => {
191540
191540
  "SERVICE",
191541
191541
  "EMPTY"
191542
191542
  ];
191543
- function hasMatchingName(service5, method, methodConfig, matchLevel) {
191543
+ function hasMatchingName(service4, method, methodConfig, matchLevel) {
191544
191544
  for (const name of methodConfig.name) {
191545
191545
  switch (matchLevel) {
191546
191546
  case "EMPTY":
@@ -191549,21 +191549,21 @@ var require_resolving_load_balancer = __commonJS((exports) => {
191549
191549
  }
191550
191550
  break;
191551
191551
  case "SERVICE":
191552
- if (name.service === service5 && !name.method) {
191552
+ if (name.service === service4 && !name.method) {
191553
191553
  return true;
191554
191554
  }
191555
191555
  break;
191556
191556
  case "SERVICE_AND_METHOD":
191557
- if (name.service === service5 && name.method === method) {
191557
+ if (name.service === service4 && name.method === method) {
191558
191558
  return true;
191559
191559
  }
191560
191560
  }
191561
191561
  }
191562
191562
  return false;
191563
191563
  }
191564
- function findMatchingConfig(service5, method, methodConfigs, matchLevel) {
191564
+ function findMatchingConfig(service4, method, methodConfigs, matchLevel) {
191565
191565
  for (const config5 of methodConfigs) {
191566
- if (hasMatchingName(service5, method, config5, matchLevel)) {
191566
+ if (hasMatchingName(service4, method, config5, matchLevel)) {
191567
191567
  return config5;
191568
191568
  }
191569
191569
  }
@@ -191574,11 +191574,11 @@ var require_resolving_load_balancer = __commonJS((exports) => {
191574
191574
  invoke(methodName, metadata) {
191575
191575
  var _a2, _b2;
191576
191576
  const splitName = methodName.split("/").filter((x2) => x2.length > 0);
191577
- const service5 = (_a2 = splitName[0]) !== null && _a2 !== undefined ? _a2 : "";
191577
+ const service4 = (_a2 = splitName[0]) !== null && _a2 !== undefined ? _a2 : "";
191578
191578
  const method = (_b2 = splitName[1]) !== null && _b2 !== undefined ? _b2 : "";
191579
191579
  if (serviceConfig && serviceConfig.methodConfig) {
191580
191580
  for (const matchLevel of NAME_MATCH_LEVEL_ORDER) {
191581
- const matchingConfig = findMatchingConfig(service5, method, serviceConfig.methodConfig, matchLevel);
191581
+ const matchingConfig = findMatchingConfig(service4, method, serviceConfig.methodConfig, matchLevel);
191582
191582
  if (matchingConfig) {
191583
191583
  return {
191584
191584
  methodConfig: matchingConfig,
@@ -193845,7 +193845,7 @@ var require_make_client = __commonJS((exports) => {
193845
193845
  const result = {};
193846
193846
  for (const serviceFqn in packageDef) {
193847
193847
  if (Object.prototype.hasOwnProperty.call(packageDef, serviceFqn)) {
193848
- const service5 = packageDef[serviceFqn];
193848
+ const service4 = packageDef[serviceFqn];
193849
193849
  const nameComponents = serviceFqn.split(".");
193850
193850
  if (nameComponents.some((comp) => isPrototypePolluted(comp))) {
193851
193851
  continue;
@@ -193858,10 +193858,10 @@ var require_make_client = __commonJS((exports) => {
193858
193858
  }
193859
193859
  current = current[packageName];
193860
193860
  }
193861
- if (isProtobufTypeDefinition(service5)) {
193862
- current[serviceName] = service5;
193861
+ if (isProtobufTypeDefinition(service4)) {
193862
+ current[serviceName] = service4;
193863
193863
  } else {
193864
- current[serviceName] = makeClientConstructor(service5, serviceName, {});
193864
+ current[serviceName] = makeClientConstructor(service4, serviceName, {});
193865
193865
  }
193866
193866
  }
193867
193867
  }
@@ -195927,13 +195927,13 @@ var require_descriptor3 = __commonJS((exports, module) => {
195927
195927
  Service.fromDescriptor = function fromDescriptor(descriptor, edition, nested) {
195928
195928
  if (typeof descriptor.length === "number")
195929
195929
  descriptor = exports.ServiceDescriptorProto.decode(descriptor);
195930
- var service5 = new Service(descriptor.name && descriptor.name.length ? descriptor.name : "Service" + unnamedServiceIndex++, fromDescriptorOptions(descriptor.options, exports.ServiceOptions));
195930
+ var service4 = new Service(descriptor.name && descriptor.name.length ? descriptor.name : "Service" + unnamedServiceIndex++, fromDescriptorOptions(descriptor.options, exports.ServiceOptions));
195931
195931
  if (!nested)
195932
- service5._edition = edition;
195932
+ service4._edition = edition;
195933
195933
  if (descriptor.method)
195934
195934
  for (var i2 = 0;i2 < descriptor.method.length; ++i2)
195935
- service5.add(Method.fromDescriptor(descriptor.method[i2]));
195936
- return service5;
195935
+ service4.add(Method.fromDescriptor(descriptor.method[i2]));
195936
+ return service4;
195937
195937
  };
195938
195938
  Service.prototype.toDescriptor = function toDescriptor() {
195939
195939
  var methods2 = [];
@@ -197593,9 +197593,9 @@ var require_src21 = __commonJS((exports) => {
197593
197593
  options: mapMethodOptions(method.parsedOptions)
197594
197594
  };
197595
197595
  }
197596
- function createServiceDefinition(service5, name, options, fileDescriptors) {
197596
+ function createServiceDefinition(service4, name, options, fileDescriptors) {
197597
197597
  const def = {};
197598
- for (const method of service5.methodsArray) {
197598
+ for (const method of service4.methodsArray) {
197599
197599
  def[method.name] = createMethodDefinition(method, name, options, fileDescriptors);
197600
197600
  }
197601
197601
  return def;
@@ -204299,16 +204299,16 @@ var require_server = __commonJS((exports) => {
204299
204299
  addProtoService() {
204300
204300
  throw new Error("Not implemented. Use addService() instead");
204301
204301
  }
204302
- addService(service5, implementation) {
204303
- if (service5 === null || typeof service5 !== "object" || implementation === null || typeof implementation !== "object") {
204302
+ addService(service4, implementation) {
204303
+ if (service4 === null || typeof service4 !== "object" || implementation === null || typeof implementation !== "object") {
204304
204304
  throw new Error("addService() requires two objects as arguments");
204305
204305
  }
204306
- const serviceKeys = Object.keys(service5);
204306
+ const serviceKeys = Object.keys(service4);
204307
204307
  if (serviceKeys.length === 0) {
204308
204308
  throw new Error("Cannot add an empty service to a server");
204309
204309
  }
204310
204310
  serviceKeys.forEach((name) => {
204311
- const attrs = service5[name];
204311
+ const attrs = service4[name];
204312
204312
  let methodType;
204313
204313
  if (attrs.requestStream) {
204314
204314
  if (attrs.responseStream) {
@@ -204339,13 +204339,13 @@ var require_server = __commonJS((exports) => {
204339
204339
  }
204340
204340
  });
204341
204341
  }
204342
- removeService(service5) {
204343
- if (service5 === null || typeof service5 !== "object") {
204342
+ removeService(service4) {
204343
+ if (service4 === null || typeof service4 !== "object") {
204344
204344
  throw new Error("removeService() requires object as argument");
204345
204345
  }
204346
- const serviceKeys = Object.keys(service5);
204346
+ const serviceKeys = Object.keys(service4);
204347
204347
  serviceKeys.forEach((name) => {
204348
- const attrs = service5[name];
204348
+ const attrs = service4[name];
204349
204349
  this.unregister(attrs.path);
204350
204350
  });
204351
204351
  }
@@ -207725,9 +207725,9 @@ var require_src23 = __commonJS((exports) => {
207725
207725
  options: mapMethodOptions(method.parsedOptions)
207726
207726
  };
207727
207727
  }
207728
- function createServiceDefinition(service5, name, options, fileDescriptors) {
207728
+ function createServiceDefinition(service4, name, options, fileDescriptors) {
207729
207729
  const def = {};
207730
- for (const method of service5.methodsArray) {
207730
+ for (const method of service4.methodsArray) {
207731
207731
  def[method.name] = createMethodDefinition(method, name, options, fileDescriptors);
207732
207732
  }
207733
207733
  return def;
@@ -276056,6 +276056,7 @@ var companyServiceBookingTable = companySchema.table("service_booking", {
276056
276056
  var companyAccountTable = companySchema.table("account", {
276057
276057
  ...base_schema_helper_default,
276058
276058
  companyId: uuid5().notNull(),
276059
+ branchId: uuid5(),
276059
276060
  bank: varchar().notNull(),
276060
276061
  account: varchar().notNull(),
276061
276062
  description: varchar()
@@ -279824,86 +279825,6 @@ var requestLogger = new Elysia({ name: "Middleware.RequestLogger" }).onRequest((
279824
279825
  });
279825
279826
  }).as("global");
279826
279827
 
279827
- // src/lib/db/helpers/pagination.helper.ts
279828
- function withPagination(qb, { size, page }) {
279829
- return qb.limit(size).offset((page - 1) * size);
279830
- }
279831
- var totalCountSql = sql3`count(*) over()`.mapWith(Number);
279832
- var pagination_helper_default = withPagination;
279833
-
279834
- // src/lib/db/helpers/soft-delete.helper.ts
279835
- var softDeletedFilter = (table) => {
279836
- return isNull2(table.deletedAt);
279837
- };
279838
-
279839
- // src/lib/db/helpers/crud.helper.ts
279840
- class CrudHelper {
279841
- table;
279842
- NOT_FOUND_MESSAGE = "";
279843
- constructor(table, ntMessage) {
279844
- this.table = table;
279845
- this.NOT_FOUND_MESSAGE = ntMessage ?? "";
279846
- }
279847
- async get(input, filter) {
279848
- const wheres = [softDeletedFilter(this.table)];
279849
- if (!filter) {
279850
- const tableKeys = Object.keys(this.table);
279851
- for (const key of Object.keys(input)) {
279852
- if (!tableKeys.includes(key)) {
279853
- continue;
279854
- }
279855
- const column = this.table[key];
279856
- const type = column.getSQLType();
279857
- const value = input[key];
279858
- if (!value) {
279859
- continue;
279860
- }
279861
- if (type === "varchar") {
279862
- wheres.push(ilike(column, `%${input[key]}%`));
279863
- }
279864
- if (!type.includes("[]")) {
279865
- wheres.push(eq(column, input[key]));
279866
- }
279867
- }
279868
- }
279869
- const columns = getTableColumns(this.table);
279870
- const baseQuery = db_default.select({
279871
- ...columns,
279872
- totalCount: totalCountSql
279873
- }).from(this.table).where(filter ?? and(...wheres)).$dynamic();
279874
- const result = await pagination_helper_default(baseQuery, input.pagination);
279875
- const content = {
279876
- totalCount: result[0]?.totalCount ?? 0,
279877
- totalPage: result.length === 0 ? 0 : Math.ceil(result[0].totalCount / input.pagination.size)
279878
- };
279879
- return {
279880
- result: result.map(({ totalCount, ...rest }) => rest),
279881
- ...content
279882
- };
279883
- }
279884
- async create(input) {
279885
- const [result] = await db_default.insert(this.table).values({
279886
- ...input
279887
- }).returning();
279888
- return result;
279889
- }
279890
- async update(id, input) {
279891
- const [result] = await db_default.update(this.table).set(input).where(eq(this.table.id, id)).returning();
279892
- if (!result) {
279893
- return status("Not Found", this.NOT_FOUND_MESSAGE);
279894
- }
279895
- return result;
279896
- }
279897
- async delete(id) {
279898
- const [result] = await db_default.update(this.table).set({
279899
- deletedAt: nowSql_helper_default
279900
- }).where(eq(this.table.id, id)).returning();
279901
- if (!result) {
279902
- return status("Not Found", this.NOT_FOUND_MESSAGE);
279903
- }
279904
- }
279905
- }
279906
-
279907
279828
  // src/lib/validation.ts
279908
279829
  var OmitBaseSchema = (type) => {
279909
279830
  return t.Omit(type, ["id", "createdAt", "updatedAt", "deletedAt"]);
@@ -280001,9 +279922,42 @@ var betterAuthMacro = new Elysia({ name: "betterAuth" }).macro({
280001
279922
  });
280002
279923
  var better_auth_default = betterAuthMacro;
280003
279924
 
279925
+ // src/lib/db/helpers/pagination.helper.ts
279926
+ function withPagination(qb, { size, page }) {
279927
+ return qb.limit(size).offset((page - 1) * size);
279928
+ }
279929
+ var totalCountSql = sql3`count(*) over()`.mapWith(Number);
279930
+ var pagination_helper_default = withPagination;
279931
+
279932
+ // src/lib/db/helpers/soft-delete.helper.ts
279933
+ var softDeletedFilter = (table) => {
279934
+ return isNull2(table.deletedAt);
279935
+ };
279936
+
279937
+ // src/lib/utils/getPaginationContent.ts
279938
+ function getPaginationContent(result, size) {
279939
+ const totalCount = result[0]?.totalCount ?? 0;
279940
+ const totalPage = result.length === 0 ? 0 : Math.ceil(totalCount / size);
279941
+ return {
279942
+ totalCount,
279943
+ totalPage,
279944
+ result: result.map(({ totalCount: totalCount2, ...res }) => res)
279945
+ };
279946
+ }
279947
+
280004
279948
  // src/routes/company/account/logic.ts
279949
+ var NOT_FOUND_MESSAGE = "\u0414\u0430\u043D\u0441 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.";
280005
279950
  var CompanyAccountLogic;
280006
279951
  ((CompanyAccountLogic) => {
279952
+ CompanyAccountLogic.select = async (query, user2) => {
279953
+ const filter = and(eq(companyAccountTable.companyId, user2.companyId), or(eq(companyAccountTable.branchId, user2.branchId), isNull2(companyAccountTable.branchId))?.if(user2.kind === "CUSTOMER"), softDeletedFilter(companyAccountTable));
279954
+ const baseQuery = db_default.select({
279955
+ account: companyAccountTable,
279956
+ totalCount: totalCountSql
279957
+ }).from(companyAccountTable).where(filter).orderBy(desc(companyAccountTable.createdAt)).$dynamic();
279958
+ const result = await pagination_helper_default(baseQuery, query.pagination);
279959
+ return getPaginationContent(result, query.pagination.size);
279960
+ };
280007
279961
  CompanyAccountLogic.create = async (body, user2) => {
280008
279962
  let companyId = user2.companyId;
280009
279963
  if (user2.kind === "ADMIN" && body.companyId) {
@@ -280015,6 +279969,21 @@ var CompanyAccountLogic;
280015
279969
  }).returning();
280016
279970
  return account2;
280017
279971
  };
279972
+ CompanyAccountLogic.update = async (id, body, user2) => {
279973
+ const [result] = await db_default.update(companyAccountTable).set(body).where(and(eq(companyAccountTable.id, id), eq(companyAccountTable.companyId, user2.companyId), or(eq(companyAccountTable.branchId, user2.branchId), isNull2(companyAccountTable.branchId))?.if(user2.kind === "CUSTOMER"))).returning();
279974
+ if (!result) {
279975
+ return status("Not Found", NOT_FOUND_MESSAGE);
279976
+ }
279977
+ return result;
279978
+ };
279979
+ CompanyAccountLogic.remove = async (id, user2) => {
279980
+ const [result] = await db_default.update(companyAccountTable).set({
279981
+ deletedAt: new Date().toISOString()
279982
+ }).where(and(eq(companyAccountTable.id, id), eq(companyAccountTable.companyId, user2.companyId), or(eq(companyAccountTable.branchId, user2.branchId), isNull2(companyAccountTable.branchId))?.if(user2.kind === "CUSTOMER"))).returning();
279983
+ if (!result) {
279984
+ return status("Not Found", NOT_FOUND_MESSAGE);
279985
+ }
279986
+ };
280018
279987
  })(CompanyAccountLogic ||= {});
280019
279988
  var logic_default = CompanyAccountLogic;
280020
279989
 
@@ -280321,49 +280290,38 @@ var CompanyAccountModel;
280321
280290
  ((CompanyAccountModel) => {
280322
280291
  const createSchema = createInsertSchema2(companyAccountTable);
280323
280292
  const updateSchema = createUpdateSchema(companyAccountTable);
280324
- const selectSchema = createSelectSchema(companyAccountTable);
280325
280293
  CompanyAccountModel.create = OmitBaseSchema(createSchema);
280326
280294
  CompanyAccountModel.update = OmitBaseSchema(updateSchema);
280327
280295
  CompanyAccountModel.select = t.Composite([
280328
- t.Partial(selectSchema),
280296
+ t.Partial(t.Object({
280297
+ branchId: t.String({ format: "uuid" })
280298
+ })),
280329
280299
  PaginationSchema
280330
280300
  ]);
280331
280301
  })(CompanyAccountModel ||= {});
280332
280302
  var model_default = CompanyAccountModel;
280333
280303
 
280334
280304
  // src/routes/company/account/index.ts
280335
- var service = new CrudHelper(companyAccountTable, "\u0414\u0430\u043D\u0441 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
280336
280305
  var accountRoutes = new Elysia({
280337
280306
  prefix: "/account"
280338
280307
  }).use(better_auth_default).guard({
280339
280308
  auth: true,
280340
280309
  tags: ["CompanyAccount"]
280341
- }).get("/", async ({ query }) => await service.get(query), {
280310
+ }).get("/", async ({ query, user: user2 }) => await logic_default.select(query, user2), {
280342
280311
  query: model_default.select
280343
280312
  }).post("/", async ({ body, user: user2 }) => await logic_default.create(body, user2), {
280344
280313
  body: model_default.create,
280345
280314
  userKind: "COMPANY_ADMIN"
280346
280315
  }).guard({
280347
280316
  params: IdSchema
280348
- }).put("/:id", async ({ params: { id }, body }) => await service.update(id, body), {
280317
+ }).put("/:id", async ({ params: { id }, body, user: user2 }) => await logic_default.update(id, body, user2), {
280349
280318
  body: model_default.update,
280350
280319
  userKind: "COMPANY_ADMIN"
280351
- }).delete("/:id", async ({ params: { id } }) => await service.delete(id), {
280320
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => await logic_default.remove(id, user2), {
280352
280321
  userKind: "COMPANY_ADMIN"
280353
280322
  });
280354
280323
  var account_default = accountRoutes;
280355
280324
 
280356
- // src/lib/utils/getPaginationContent.ts
280357
- function getPaginationContent(result, size) {
280358
- const totalCount = result[0]?.totalCount ?? 0;
280359
- const totalPage = result.length === 0 ? 0 : Math.ceil(totalCount / size);
280360
- return {
280361
- totalCount,
280362
- totalPage,
280363
- result: result.map(({ totalCount: totalCount2, ...res }) => res)
280364
- };
280365
- }
280366
-
280367
280325
  // src/routes/company/billingPlan/logic.ts
280368
280326
  var CompanyBillingPlanLogic;
280369
280327
  ((CompanyBillingPlanLogic) => {
@@ -280441,6 +280399,74 @@ var billingPlanRoutes = new Elysia({
280441
280399
  });
280442
280400
  var billingPlan_default = billingPlanRoutes;
280443
280401
 
280402
+ // src/lib/db/helpers/crud.helper.ts
280403
+ class CrudHelper {
280404
+ table;
280405
+ NOT_FOUND_MESSAGE = "";
280406
+ constructor(table, ntMessage) {
280407
+ this.table = table;
280408
+ this.NOT_FOUND_MESSAGE = ntMessage ?? "";
280409
+ }
280410
+ async get(input, filter) {
280411
+ const wheres = [softDeletedFilter(this.table)];
280412
+ if (!filter) {
280413
+ const tableKeys = Object.keys(this.table);
280414
+ for (const key of Object.keys(input)) {
280415
+ if (!tableKeys.includes(key)) {
280416
+ continue;
280417
+ }
280418
+ const column = this.table[key];
280419
+ const type = column.getSQLType();
280420
+ const value = input[key];
280421
+ if (!value) {
280422
+ continue;
280423
+ }
280424
+ if (type === "varchar") {
280425
+ wheres.push(ilike(column, `%${input[key]}%`));
280426
+ }
280427
+ if (!type.includes("[]")) {
280428
+ wheres.push(eq(column, input[key]));
280429
+ }
280430
+ }
280431
+ }
280432
+ const columns = getTableColumns(this.table);
280433
+ const baseQuery = db_default.select({
280434
+ ...columns,
280435
+ totalCount: totalCountSql
280436
+ }).from(this.table).where(filter ?? and(...wheres)).$dynamic();
280437
+ const result = await pagination_helper_default(baseQuery, input.pagination);
280438
+ const content = {
280439
+ totalCount: result[0]?.totalCount ?? 0,
280440
+ totalPage: result.length === 0 ? 0 : Math.ceil(result[0].totalCount / input.pagination.size)
280441
+ };
280442
+ return {
280443
+ result: result.map(({ totalCount, ...rest }) => rest),
280444
+ ...content
280445
+ };
280446
+ }
280447
+ async create(input) {
280448
+ const [result] = await db_default.insert(this.table).values({
280449
+ ...input
280450
+ }).returning();
280451
+ return result;
280452
+ }
280453
+ async update(id, input) {
280454
+ const [result] = await db_default.update(this.table).set(input).where(eq(this.table.id, id)).returning();
280455
+ if (!result) {
280456
+ return status("Not Found", this.NOT_FOUND_MESSAGE);
280457
+ }
280458
+ return result;
280459
+ }
280460
+ async delete(id) {
280461
+ const [result] = await db_default.update(this.table).set({
280462
+ deletedAt: nowSql_helper_default
280463
+ }).where(eq(this.table.id, id)).returning();
280464
+ if (!result) {
280465
+ return status("Not Found", this.NOT_FOUND_MESSAGE);
280466
+ }
280467
+ }
280468
+ }
280469
+
280444
280470
  // src/routes/company/branch/logic.ts
280445
280471
  var CompanyBranchLogic;
280446
280472
  ((CompanyBranchLogic) => {
@@ -280479,16 +280505,16 @@ var CompanyBranchModel;
280479
280505
  var model_default3 = CompanyBranchModel;
280480
280506
 
280481
280507
  // src/routes/company/branch/index.ts
280482
- var service2 = new CrudHelper(companyBranchTable, "\u0421\u0430\u043B\u0431\u0430\u0440 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
280508
+ var service = new CrudHelper(companyBranchTable, "\u0421\u0430\u043B\u0431\u0430\u0440 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
280483
280509
  var branchRoutes = new Elysia({
280484
280510
  prefix: "/branch"
280485
280511
  }).use(better_auth_default).guard({
280486
280512
  auth: true,
280487
280513
  tags: ["CompanyBranch"]
280488
- }).get("/", async ({ query }) => await service2.get(query), {
280514
+ }).get("/", async ({ query }) => await service.get(query), {
280489
280515
  query: model_default3.select,
280490
280516
  userKind: "COMPANY_ADMIN"
280491
- }).get("/me", async ({ user: user2 }) => service2.get({
280517
+ }).get("/me", async ({ user: user2 }) => service.get({
280492
280518
  id: user2.branchId,
280493
280519
  pagination: {
280494
280520
  page: 1,
@@ -280499,10 +280525,10 @@ var branchRoutes = new Elysia({
280499
280525
  userKind: "COMPANY_ADMIN"
280500
280526
  }).guard({
280501
280527
  params: IdSchema
280502
- }).put("/:id", async ({ params: { id }, body }) => await service2.update(id, body), {
280528
+ }).put("/:id", async ({ params: { id }, body }) => await service.update(id, body), {
280503
280529
  body: model_default3.update,
280504
280530
  userKind: "COMPANY_ADMIN"
280505
- }).delete("/:id", async ({ params: { id } }) => await service2.delete(id), {
280531
+ }).delete("/:id", async ({ params: { id } }) => await service.delete(id), {
280506
280532
  userKind: "COMPANY_ADMIN"
280507
280533
  });
280508
280534
  var branch_default = branchRoutes;
@@ -280526,24 +280552,24 @@ var CompanyCompanyModel;
280526
280552
  var model_default4 = CompanyCompanyModel;
280527
280553
 
280528
280554
  // src/routes/company/company/index.ts
280529
- var service3 = new CrudHelper(companyCompanyTable, "\u0411\u0430\u0439\u0433\u0443\u0443\u043B\u043B\u0430\u0433\u0430 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
280555
+ var service2 = new CrudHelper(companyCompanyTable, "\u0411\u0430\u0439\u0433\u0443\u0443\u043B\u043B\u0430\u0433\u0430 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
280530
280556
  var companyRoutes = new Elysia({
280531
280557
  prefix: "/company"
280532
280558
  }).use(better_auth_default).guard({
280533
280559
  auth: true,
280534
280560
  tags: ["Company"]
280535
- }).get("/", async ({ query }) => await service3.get(query), {
280561
+ }).get("/", async ({ query }) => await service2.get(query), {
280536
280562
  query: model_default4.select,
280537
280563
  userKind: "ADMIN"
280538
280564
  }).post("/", async ({ body }) => {
280539
- const result = await service3.create(body);
280565
+ const result = await service2.create(body);
280540
280566
  return result;
280541
280567
  }, {
280542
280568
  body: model_default4.create,
280543
280569
  userKind: "ADMIN"
280544
280570
  }).guard({
280545
280571
  params: IdSchema
280546
- }).put("/:id", async ({ body, params: { id } }) => service3.update(id, body), {
280572
+ }).put("/:id", async ({ body, params: { id } }) => service2.update(id, body), {
280547
280573
  body: model_default4.update,
280548
280574
  userKind: "COMPANY_ADMIN",
280549
280575
  beforeHandle({ status: status2, params: { id }, user: user2 }) {
@@ -280551,7 +280577,7 @@ var companyRoutes = new Elysia({
280551
280577
  return status2("Forbidden", "\u0417\u04E9\u0432\u0445\u04E9\u043D \u04E9\u04E9\u0440\u0438\u0439\u043D \u0431\u0430\u0439\u0433\u0443\u0443\u043B\u043B\u0430\u0433\u044B\u043D \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0437\u0430\u0441\u0430\u0445 \u0431\u043E\u043B\u043E\u043C\u0436\u0442\u043E\u0439.");
280552
280578
  }
280553
280579
  }
280554
- }).delete("/:id", async ({ params: { id } }) => service3.delete(id), {
280580
+ }).delete("/:id", async ({ params: { id } }) => service2.delete(id), {
280555
280581
  userKind: "ADMIN"
280556
280582
  });
280557
280583
  var company_default = companyRoutes;
@@ -280915,19 +280941,19 @@ var CompanyPackageModel;
280915
280941
  var model_default8 = CompanyPackageModel;
280916
280942
 
280917
280943
  // src/routes/company/package/index.ts
280918
- var service4 = new CrudHelper(companyPackageTable, "\u0411\u0430\u0433\u0446 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
280944
+ var service3 = new CrudHelper(companyPackageTable, "\u0411\u0430\u0433\u0446 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
280919
280945
  var packageRoutes = new Elysia({
280920
280946
  prefix: "/package"
280921
280947
  }).use(better_auth_default).guard({
280922
280948
  auth: true,
280923
280949
  tags: ["CompanyPackage"]
280924
- }).get("/", async ({ query }) => await service4.get(query), {
280950
+ }).get("/", async ({ query }) => await service3.get(query), {
280925
280951
  query: PaginationSchema
280926
- }).post("/", async ({ body }) => await service4.create(body), {
280952
+ }).post("/", async ({ body }) => await service3.create(body), {
280927
280953
  body: model_default8.create
280928
280954
  }).guard({
280929
280955
  params: IdSchema
280930
- }).put("/:id", async ({ params: { id }, body }) => await service4.update(id, body), { body: model_default8.update }).delete("/:id", async ({ params: { id } }) => await service4.delete(id));
280956
+ }).put("/:id", async ({ params: { id }, body }) => await service3.update(id, body), { body: model_default8.update }).delete("/:id", async ({ params: { id } }) => await service3.delete(id));
280931
280957
  var _package_default = packageRoutes;
280932
280958
 
280933
280959
  // src/routes/company/serviceKind/logic.ts
@@ -281043,6 +281069,21 @@ var companySchemaRoutes = new Elysia({
281043
281069
  }).use(company_default).use(branch_default).use(_package_default).use(serviceKind_default).use(employee_default).use(account_default).use(billingPlan_default).use(invoice_default);
281044
281070
  var company_default2 = companySchemaRoutes;
281045
281071
 
281072
+ // src/lib/db/helpers/catch-duplicated-error.ts
281073
+ var catchDuplicatedError = (err2, message2) => {
281074
+ if (err2 instanceof DrizzleQueryError) {
281075
+ if (err2.cause instanceof DatabaseError) {
281076
+ return status("Conflict", message2);
281077
+ }
281078
+ return status("Internal Server Error", {
281079
+ message: err2.message,
281080
+ name: err2.name,
281081
+ query: err2.query
281082
+ });
281083
+ }
281084
+ return status("Internal Server Error", err2);
281085
+ };
281086
+
281046
281087
  // src/lib/utils/dataStore.logic.ts
281047
281088
  var DataStoreLogic;
281048
281089
  ((DataStoreLogic) => {
@@ -281194,7 +281235,8 @@ var ERRORS = {
281194
281235
  EMPLOYEE_REQUIRED: "\u0410\u0436\u0438\u043B\u0442\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0448\u0430\u0430\u0440\u0434\u043B\u0430\u0433\u0430\u0442\u0430\u0439.",
281195
281236
  ITEM_NOT_FOUND: "\u0410\u0433\u0443\u0443\u043B\u0430\u0445\u044B\u043D \u0431\u0430\u0440\u0430\u0430 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.",
281196
281237
  PRODUCT_NOT_FOUND: "\u0411\u0430\u0440\u0430\u0430\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.",
281197
- INSUFFICIENT_STOCK: "\u0411\u0430\u0440\u0430\u0430\u043D\u044B \u04AF\u043B\u0434\u044D\u0433\u0434\u044D\u043B \u0445\u04AF\u0440\u044D\u043B\u0446\u044D\u0445\u0433\u04AF\u0439 \u0431\u0430\u0439\u043D\u0430."
281238
+ INSUFFICIENT_STOCK: "\u0411\u0430\u0440\u0430\u0430\u043D\u044B \u04AF\u043B\u0434\u044D\u0433\u0434\u044D\u043B \u0445\u04AF\u0440\u044D\u043B\u0446\u044D\u0445\u0433\u04AF\u0439 \u0431\u0430\u0439\u043D\u0430.",
281239
+ ITEM_CONFLICT: "\u0422\u0443\u0445\u0430\u0439\u043D \u0430\u0433\u0443\u0443\u043B\u0430\u0445\u0430\u0434 \u0431\u0430\u0440\u0430\u0430\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0434\u0430\u0432\u0445\u0446\u0430\u0436 \u0431\u0430\u0439\u043D\u0430."
281198
281240
  };
281199
281241
  var WarehouseItemLogic;
281200
281242
  ((WarehouseItemLogic) => {
@@ -281220,15 +281262,23 @@ var WarehouseItemLogic;
281220
281262
  return result[0]?.count ?? 0;
281221
281263
  };
281222
281264
  WarehouseItemLogic.create = async (body) => {
281223
- const [result] = await db_default.insert(warehouseItemTable).values(body).returning();
281224
- return result;
281265
+ try {
281266
+ const [result] = await db_default.insert(warehouseItemTable).values(body).returning();
281267
+ return result;
281268
+ } catch (err2) {
281269
+ return catchDuplicatedError(err2, ERRORS.ITEM_CONFLICT);
281270
+ }
281225
281271
  };
281226
281272
  WarehouseItemLogic.update = async (id, body) => {
281227
- const [result] = await db_default.update(warehouseItemTable).set(body).where(eq(warehouseItemTable.id, id)).returning();
281228
- if (!result) {
281229
- return status("Not Found", ERRORS.ITEM_NOT_FOUND);
281273
+ try {
281274
+ const [result] = await db_default.update(warehouseItemTable).set(body).where(eq(warehouseItemTable.id, id)).returning();
281275
+ if (!result) {
281276
+ return status("Not Found", ERRORS.ITEM_NOT_FOUND);
281277
+ }
281278
+ return result;
281279
+ } catch (err2) {
281280
+ return catchDuplicatedError(err2, ERRORS.ITEM_CONFLICT);
281230
281281
  }
281231
- return result;
281232
281282
  };
281233
281283
  WarehouseItemLogic.upload = async (body) => {
281234
281284
  const productIds = body.map((item) => item.productId);
@@ -281732,7 +281782,7 @@ var CrmSpPackageLogic;
281732
281782
  const services = rows.map((row) => row.service ? {
281733
281783
  ...row.service,
281734
281784
  name: row.serviceName
281735
- } : undefined).filter((i2) => Boolean(i2)).filter((service5, index2, self2) => index2 === self2.findIndex((t2) => t2.id === service5?.id));
281785
+ } : undefined).filter((i2) => Boolean(i2)).filter((service4, index2, self2) => index2 === self2.findIndex((t2) => t2.id === service4?.id));
281736
281786
  return {
281737
281787
  spPackage,
281738
281788
  products,
@@ -288377,10 +288427,7 @@ var NotificationChannelLogic;
288377
288427
  const [result] = await db_default.insert(nmChannelTable).values(body).returning();
288378
288428
  return result;
288379
288429
  } catch (err2) {
288380
- if (err2 instanceof DrizzleQueryError && err2.cause instanceof DatabaseError && err2.cause.code === "23505") {
288381
- return status("Conflict", "nmKey \u0434\u0430\u0432\u0445\u0446\u0430\u0436 \u0431\u0430\u0439\u043D\u0430.");
288382
- }
288383
- return status("Internal Server Error", "\u0421\u0443\u0432\u0430\u0433 \u04AF\u04AF\u0441\u0433\u044D\u0445\u044D\u0434 \u0430\u043B\u0434\u0430\u0430 \u0433\u0430\u0440\u043B\u0430\u0430.");
288430
+ return catchDuplicatedError(err2, "nmKey \u0434\u0430\u0432\u0445\u0446\u0430\u0436 \u0431\u0430\u0439\u043D\u0430.");
288384
288431
  }
288385
288432
  };
288386
288433
  NotificationChannelLogic.update = async (id, body) => {
@@ -288391,10 +288438,7 @@ var NotificationChannelLogic;
288391
288438
  }
288392
288439
  return result;
288393
288440
  } catch (err2) {
288394
- if (err2 instanceof DrizzleQueryError && err2.cause instanceof DatabaseError && err2.cause.code === "23505") {
288395
- return status("Conflict", "nmKey \u0434\u0430\u0432\u0445\u0446\u0430\u0436 \u0431\u0430\u0439\u043D\u0430.");
288396
- }
288397
- return status("Internal Server Error", "\u0421\u0443\u0432\u0430\u0433 \u0437\u0430\u0441\u0430\u0445\u044D\u0434 \u0430\u043B\u0434\u0430\u0430 \u0433\u0430\u0440\u043B\u0430\u0430.");
288441
+ return catchDuplicatedError(err2, "nmKey \u0434\u0430\u0432\u0445\u0446\u0430\u0436 \u0431\u0430\u0439\u043D\u0430.");
288398
288442
  }
288399
288443
  };
288400
288444
  NotificationChannelLogic.remove = async (id) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.81",
3
+ "version": "1.2.83",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",