autosync_backend2 1.2.79 → 1.2.82

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/index.d.ts CHANGED
@@ -1169,6 +1169,7 @@ export declare const app: Elysia<"", {
1169
1169
  };
1170
1170
  401: "Токен олдсонгүй";
1171
1171
  403: "Хандах эрхгүй байна.";
1172
+ 409: "Агуулахын барааны мэдээлэл давхцаж байна.";
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: "Агуулахын барааны мэдээлэл давхцаж байна.";
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
  };
@@ -12643,8 +12647,8 @@ export declare const app: Elysia<"", {
12643
12647
  description: string | null;
12644
12648
  nmKey: string | null;
12645
12649
  };
12646
- 400: "nmKey давхцаж байна.";
12647
12650
  401: "Токен олдсонгүй";
12651
+ 409: "nmKey давхцаж байна.";
12648
12652
  422: {
12649
12653
  type: "validation";
12650
12654
  on: string;
@@ -12654,7 +12658,7 @@ export declare const app: Elysia<"", {
12654
12658
  property?: string;
12655
12659
  expected?: string;
12656
12660
  };
12657
- 500: "Failed to create channel";
12661
+ 500: "Суваг үүсгэхэд алдаа гарлаа.";
12658
12662
  };
12659
12663
  };
12660
12664
  };
@@ -12685,7 +12689,8 @@ export declare const app: Elysia<"", {
12685
12689
  oldId: number | null;
12686
12690
  };
12687
12691
  401: "Токен олдсонгүй";
12688
- 404: "Channel not found";
12692
+ 404: "Бүртгэл олдсонгүй.";
12693
+ 409: "nmKey давхцаж байна.";
12689
12694
  422: {
12690
12695
  type: "validation";
12691
12696
  on: string;
@@ -12695,6 +12700,7 @@ export declare const app: Elysia<"", {
12695
12700
  property?: string;
12696
12701
  expected?: string;
12697
12702
  };
12703
+ 500: "Суваг засахэд алдаа гарлаа.";
12698
12704
  };
12699
12705
  };
12700
12706
  };
package/dist/index.js CHANGED
@@ -281194,7 +281194,8 @@ var ERRORS = {
281194
281194
  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
281195
  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
281196
  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."
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.",
281198
+ ITEM_CONFLICT: "\u0410\u0433\u0443\u0443\u043B\u0430\u0445\u044B\u043D \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
281199
  };
281199
281200
  var WarehouseItemLogic;
281200
281201
  ((WarehouseItemLogic) => {
@@ -281220,15 +281221,29 @@ var WarehouseItemLogic;
281220
281221
  return result[0]?.count ?? 0;
281221
281222
  };
281222
281223
  WarehouseItemLogic.create = async (body) => {
281223
- const [result] = await db_default.insert(warehouseItemTable).values(body).returning();
281224
- return result;
281224
+ try {
281225
+ const [result] = await db_default.insert(warehouseItemTable).values(body).returning();
281226
+ return result;
281227
+ } catch (err2) {
281228
+ if (err2 instanceof DrizzleQueryError && err2.cause instanceof DatabaseError) {
281229
+ return status("Conflict", ERRORS.ITEM_CONFLICT);
281230
+ }
281231
+ return status("Internal Server Error", err2);
281232
+ }
281225
281233
  };
281226
281234
  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);
281235
+ try {
281236
+ const [result] = await db_default.update(warehouseItemTable).set(body).where(eq(warehouseItemTable.id, id)).returning();
281237
+ if (!result) {
281238
+ return status("Not Found", ERRORS.ITEM_NOT_FOUND);
281239
+ }
281240
+ return result;
281241
+ } catch (err2) {
281242
+ if (err2 instanceof DrizzleQueryError && err2.cause instanceof DatabaseError) {
281243
+ return status("Conflict", ERRORS.ITEM_CONFLICT);
281244
+ }
281245
+ return status("Internal Server Error", err2);
281230
281246
  }
281231
- return result;
281232
281247
  };
281233
281248
  WarehouseItemLogic.upload = async (body) => {
281234
281249
  const productIds = body.map((item) => item.productId);
@@ -288378,17 +288393,24 @@ var NotificationChannelLogic;
288378
288393
  return result;
288379
288394
  } catch (err2) {
288380
288395
  if (err2 instanceof DrizzleQueryError && err2.cause instanceof DatabaseError && err2.cause.code === "23505") {
288381
- return status("Bad Request", "nmKey \u0434\u0430\u0432\u0445\u0446\u0430\u0436 \u0431\u0430\u0439\u043D\u0430.");
288396
+ return status("Conflict", "nmKey \u0434\u0430\u0432\u0445\u0446\u0430\u0436 \u0431\u0430\u0439\u043D\u0430.");
288382
288397
  }
288383
- return status("Internal Server Error", "Failed to create channel");
288398
+ 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.");
288384
288399
  }
288385
288400
  };
288386
288401
  NotificationChannelLogic.update = async (id, body) => {
288387
- const [result] = await db_default.update(nmChannelTable).set(body).where(eq(nmChannelTable.id, id)).returning();
288388
- if (!result) {
288389
- return status("Not Found", "Channel not found");
288402
+ try {
288403
+ const [result] = await db_default.update(nmChannelTable).set(body).where(eq(nmChannelTable.id, id)).returning();
288404
+ if (!result) {
288405
+ return status("Not Found", "\u0411\u04AF\u0440\u0442\u0433\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
288406
+ }
288407
+ return result;
288408
+ } catch (err2) {
288409
+ if (err2 instanceof DrizzleQueryError && err2.cause instanceof DatabaseError && err2.cause.code === "23505") {
288410
+ return status("Conflict", "nmKey \u0434\u0430\u0432\u0445\u0446\u0430\u0436 \u0431\u0430\u0439\u043D\u0430.");
288411
+ }
288412
+ 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.");
288390
288413
  }
288391
- return result;
288392
288414
  };
288393
288415
  NotificationChannelLogic.remove = async (id) => {
288394
288416
  await db_default.update(nmChannelTable).set({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.79",
3
+ "version": "1.2.82",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",