autosync_backend2 1.2.78 → 1.2.81

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
@@ -12644,6 +12644,7 @@ export declare const app: Elysia<"", {
12644
12644
  nmKey: string | null;
12645
12645
  };
12646
12646
  401: "Токен олдсонгүй";
12647
+ 409: "nmKey давхцаж байна.";
12647
12648
  422: {
12648
12649
  type: "validation";
12649
12650
  on: string;
@@ -12653,6 +12654,7 @@ export declare const app: Elysia<"", {
12653
12654
  property?: string;
12654
12655
  expected?: string;
12655
12656
  };
12657
+ 500: "Суваг үүсгэхэд алдаа гарлаа.";
12656
12658
  };
12657
12659
  };
12658
12660
  };
@@ -12683,7 +12685,8 @@ export declare const app: Elysia<"", {
12683
12685
  oldId: number | null;
12684
12686
  };
12685
12687
  401: "Токен олдсонгүй";
12686
- 404: "Channel not found";
12688
+ 404: "Бүртгэл олдсонгүй.";
12689
+ 409: "nmKey давхцаж байна.";
12687
12690
  422: {
12688
12691
  type: "validation";
12689
12692
  on: string;
@@ -12693,6 +12696,7 @@ export declare const app: Elysia<"", {
12693
12696
  property?: string;
12694
12697
  expected?: string;
12695
12698
  };
12699
+ 500: "Суваг засахэд алдаа гарлаа.";
12696
12700
  };
12697
12701
  };
12698
12702
  };
package/dist/index.js CHANGED
@@ -288373,15 +288373,29 @@ var NotificationChannelLogic;
288373
288373
  return getPaginationContent(result, query.pagination.size);
288374
288374
  };
288375
288375
  NotificationChannelLogic.create = async (body) => {
288376
- const [result] = await db_default.insert(nmChannelTable).values(body).returning();
288377
- return result;
288376
+ try {
288377
+ const [result] = await db_default.insert(nmChannelTable).values(body).returning();
288378
+ return result;
288379
+ } 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.");
288384
+ }
288378
288385
  };
288379
288386
  NotificationChannelLogic.update = async (id, body) => {
288380
- const [result] = await db_default.update(nmChannelTable).set(body).where(eq(nmChannelTable.id, id)).returning();
288381
- if (!result) {
288382
- return status("Not Found", "Channel not found");
288387
+ try {
288388
+ const [result] = await db_default.update(nmChannelTable).set(body).where(eq(nmChannelTable.id, id)).returning();
288389
+ if (!result) {
288390
+ return status("Not Found", "\u0411\u04AF\u0440\u0442\u0433\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
288391
+ }
288392
+ return result;
288393
+ } 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.");
288383
288398
  }
288384
- return result;
288385
288399
  };
288386
288400
  NotificationChannelLogic.remove = async (id) => {
288387
288401
  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.78",
3
+ "version": "1.2.81",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",