@lacrous/omnicloud 0.2.23 → 0.2.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacrous/omnicloud",
3
- "version": "0.2.23",
3
+ "version": "0.2.24",
4
4
  "description": "SDK and core building blocks for OmniCloud — self-hosted cloud storage powered by your Telegram account.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -48,9 +48,9 @@
48
48
  "prisma": "^6.2.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@omnicloud/core": "0.2.23",
52
- "@omnicloud/shared": "0.2.23",
53
- "@omnicloud/telegram": "0.2.23",
51
+ "@omnicloud/core": "0.2.24",
52
+ "@omnicloud/shared": "0.2.24",
53
+ "@omnicloud/telegram": "0.2.24",
54
54
  "@types/node": "^22.10.0",
55
55
  "esbuild": "0.25.12",
56
56
  "tsup": "^8.3.0",
package/server/index.js CHANGED
@@ -1799,14 +1799,11 @@ var FolderService = class {
1799
1799
  );
1800
1800
  const restorableFileIds = restorableFiles.map((file) => file.id);
1801
1801
  if (restorableFolders.length > 0) {
1802
- await this.folders.updateMany(
1802
+ await this.folders.restoreSubtree(
1803
1803
  restorableFolders.map((folder) => folder.id),
1804
- { deletedAt: null, trashBatchId: null }
1804
+ restorableFileIds,
1805
+ { rootId: id, reparent: { parentId } }
1805
1806
  );
1806
- await this.folders.update(id, { parentId });
1807
- }
1808
- if (restorableFileIds.length > 0) {
1809
- await this.files.updateMany(restorableFileIds, { deletedAt: null, trashBatchId: null });
1810
1807
  }
1811
1808
  await this.activity.record({
1812
1809
  userId,
@@ -3798,6 +3795,28 @@ function createFolderRepo(prisma) {
3798
3795
  });
3799
3796
  return mapFolder(folder);
3800
3797
  },
3798
+ async restoreSubtree(folderIds, fileIds, options) {
3799
+ await prisma.$transaction(async (tx) => {
3800
+ if (folderIds.length > 0) {
3801
+ await tx.folder.updateMany({
3802
+ where: { id: { in: folderIds } },
3803
+ data: { deletedAt: null, trashBatchId: null }
3804
+ });
3805
+ }
3806
+ if (options.reparent) {
3807
+ await tx.folder.update({
3808
+ where: { id: options.rootId },
3809
+ data: { parentId: options.reparent.parentId }
3810
+ });
3811
+ }
3812
+ if (fileIds.length > 0) {
3813
+ await tx.file.updateMany({
3814
+ where: { id: { in: fileIds } },
3815
+ data: { deletedAt: null, trashBatchId: null }
3816
+ });
3817
+ }
3818
+ });
3819
+ },
3801
3820
  async trashSubtree(folderIds, fileIds, stamp) {
3802
3821
  await prisma.$transaction(async (tx) => {
3803
3822
  if (folderIds.length > 0) {
@@ -5068,7 +5087,7 @@ function encryptionCheck(configured) {
5068
5087
  }
5069
5088
 
5070
5089
  // ../../apps/api/src/routes/storage.ts
5071
- var VERSION = "0.2.23";
5090
+ var VERSION = "0.2.24";
5072
5091
  function registerStorageRoutes(app2, container2) {
5073
5092
  app2.get("/api/health", async () => {
5074
5093
  const database = await probeDatabase(container2);