@yimingliao/cms 0.0.93 → 0.0.94

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.
@@ -3251,8 +3251,16 @@ function createFileSoftDeleteManyAction(ctx) {
3251
3251
  const { ids: ids2 } = await fileSoftDeleteManyValidator(schemas).parseAsync(formData);
3252
3252
  const foundFiles = await fileQueryRepository.findManyByIds({ ids: ids2 });
3253
3253
  if (foundFiles.length === 0) throw ServerError.notFound();
3254
- const targetIds = foundFiles.filter((f) => !f.isLocked).map((f) => f.id);
3255
- const hasLockedFile = ids2.length !== targetIds.length;
3254
+ const lockedFiles = [];
3255
+ const targetIds = [];
3256
+ for (const file of foundFiles) {
3257
+ if (isFileLocked(file)) {
3258
+ lockedFiles.push(file.id);
3259
+ } else {
3260
+ targetIds.push(file.id);
3261
+ }
3262
+ }
3263
+ const hasLockedFile = lockedFiles.length > 0;
3256
3264
  const count = await fileCommandRepository.softDeleteMany({
3257
3265
  ids: targetIds
3258
3266
  });
@@ -3260,7 +3268,7 @@ function createFileSoftDeleteManyAction(ctx) {
3260
3268
  throw new ServerError({ i18nKey: "error.files-batch-destroy-no" });
3261
3269
  }
3262
3270
  return {
3263
- i18nKey: hasLockedFile ? "ok.destroy-ok" : "ok.files-batch-destroy-has-locked"
3271
+ i18nKey: hasLockedFile ? "ok.files-batch-destroy-has-locked" : "ok.destroy-ok"
3264
3272
  };
3265
3273
  },
3266
3274
  { type: "command" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yimingliao/cms",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "author": "Yiming Liao",
5
5
  "license": "MIT",
6
6
  "type": "module",