@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/dist/index.d.cts CHANGED
@@ -917,6 +917,16 @@ interface FolderRepository {
917
917
  deletedAt: Date;
918
918
  trashBatchId: string;
919
919
  }): Promise<void>;
920
+ /**
921
+ * Restores a folder subtree and its files in one atomic step. When `reparent` is
922
+ * given, the subtree root is moved under that parent in the same step.
923
+ */
924
+ restoreSubtree(folderIds: string[], fileIds: string[], options: {
925
+ rootId: string;
926
+ reparent: {
927
+ parentId: string | null;
928
+ } | null;
929
+ }): Promise<void>;
920
930
  deleteMany(ids: string[]): Promise<void>;
921
931
  countByUser(userId: string): Promise<number>;
922
932
  }
package/dist/index.d.ts CHANGED
@@ -917,6 +917,16 @@ interface FolderRepository {
917
917
  deletedAt: Date;
918
918
  trashBatchId: string;
919
919
  }): Promise<void>;
920
+ /**
921
+ * Restores a folder subtree and its files in one atomic step. When `reparent` is
922
+ * given, the subtree root is moved under that parent in the same step.
923
+ */
924
+ restoreSubtree(folderIds: string[], fileIds: string[], options: {
925
+ rootId: string;
926
+ reparent: {
927
+ parentId: string | null;
928
+ } | null;
929
+ }): Promise<void>;
920
930
  deleteMany(ids: string[]): Promise<void>;
921
931
  countByUser(userId: string): Promise<number>;
922
932
  }
package/dist/index.js CHANGED
@@ -2153,14 +2153,11 @@ var FolderService = class {
2153
2153
  );
2154
2154
  const restorableFileIds = restorableFiles.map((file) => file.id);
2155
2155
  if (restorableFolders.length > 0) {
2156
- await this.folders.updateMany(
2156
+ await this.folders.restoreSubtree(
2157
2157
  restorableFolders.map((folder) => folder.id),
2158
- { deletedAt: null, trashBatchId: null }
2158
+ restorableFileIds,
2159
+ { rootId: id, reparent: { parentId } }
2159
2160
  );
2160
- await this.folders.update(id, { parentId });
2161
- }
2162
- if (restorableFileIds.length > 0) {
2163
- await this.files.updateMany(restorableFileIds, { deletedAt: null, trashBatchId: null });
2164
2161
  }
2165
2162
  await this.activity.record({
2166
2163
  userId,