@chevre/domain 22.14.0-alpha.2 → 22.14.0-alpha.3

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.
@@ -1,4 +1,4 @@
1
- import type { BulkWriteResult } from 'mongodb';
1
+ import type { BulkWriteResult, DeleteResult } from 'mongodb';
2
2
  import type { Connection, FilterQuery } from 'mongoose';
3
3
  import * as factory from '../factory';
4
4
  type INoteDigitalDocument = factory.creativeWork.noteDigitalDocument.INoteDigitalDocument;
@@ -32,12 +32,24 @@ export declare class NoteRepo {
32
32
  id: string;
33
33
  }[];
34
34
  } | void>;
35
- deleteManyByAbout(params: {
35
+ /**
36
+ * 既知のメモIDリストからメモを削除する
37
+ */
38
+ deleteNotesByIds(params: {
39
+ project: {
40
+ id: string;
41
+ };
42
+ ids: string[];
43
+ }): Promise<DeleteResult | void>;
44
+ /**
45
+ * 主題リソースから全メモを削除する
46
+ */
47
+ deleteNotesByAbout(params: {
36
48
  about: {
37
49
  id: string;
38
50
  typeOf: factory.creativeWork.noteDigitalDocument.IAbout['typeOf'];
39
51
  };
40
- }): Promise<import("mongodb").DeleteResult>;
52
+ }): Promise<DeleteResult>;
41
53
  unsetUnnecessaryFields(params: {
42
54
  filter: any;
43
55
  $unset: any;
@@ -179,7 +179,25 @@ class NoteRepo {
179
179
  }
180
180
  });
181
181
  }
182
- deleteManyByAbout(params) {
182
+ /**
183
+ * 既知のメモIDリストからメモを削除する
184
+ */
185
+ deleteNotesByIds(params) {
186
+ return __awaiter(this, void 0, void 0, function* () {
187
+ const { project, ids } = params;
188
+ if (Array.isArray(ids) && ids.length > 0) {
189
+ return this.noteModel.deleteMany({
190
+ 'project.id': { $eq: project.id },
191
+ _id: { $in: ids }
192
+ })
193
+ .exec();
194
+ }
195
+ });
196
+ }
197
+ /**
198
+ * 主題リソースから全メモを削除する
199
+ */
200
+ deleteNotesByAbout(params) {
183
201
  return __awaiter(this, void 0, void 0, function* () {
184
202
  return this.noteModel.deleteMany({
185
203
  'about.id': { $eq: String(params.about.id) },
@@ -44,7 +44,7 @@ function deleteOrder(params) {
44
44
  // 経理レポート削除
45
45
  yield repos.accountingReport.deleteByOrderNumber({ mainEntity: { orderNumber: order.orderNumber } });
46
46
  // メモ削除(2024-02-15~)
47
- yield repos.note.deleteManyByAbout({
47
+ yield repos.note.deleteNotesByAbout({
48
48
  about: {
49
49
  id: order.id,
50
50
  typeOf: factory.order.OrderType.Order
@@ -7,6 +7,7 @@ import type { CreativeWorkRepo } from '../../../repo/creativeWork';
7
7
  import type { EventRepo } from '../../../repo/event';
8
8
  import type { EventSeriesRepo } from '../../../repo/eventSeries';
9
9
  import type { MemberRepo } from '../../../repo/member';
10
+ import type { NoteRepo } from '../../../repo/note';
10
11
  import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
11
12
  import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
12
13
  import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
@@ -30,6 +31,7 @@ export declare function onResourceDeleted(params: factory.task.onResourceUpdated
30
31
  hasPOS: HasPOSRepo;
31
32
  member: MemberRepo;
32
33
  movieTheater: MovieTheaterRepo;
34
+ note: NoteRepo;
33
35
  paymentServiceProvider: PaymentServiceProviderRepo;
34
36
  offer: OfferRepo;
35
37
  offerCatalog: OfferCatalogRepo;
@@ -414,6 +414,7 @@ function deleteResourcesByProduct(params) {
414
414
  try {
415
415
  let deleteEventResult;
416
416
  let updateOfferResult;
417
+ let deleteNoteResult;
417
418
  // 興行を設定されたイベント削除
418
419
  deleteEventResult = yield repos.event.deleteManyEventsByItemOfferedId({
419
420
  project: { id: params.project.id },
@@ -424,7 +425,11 @@ function deleteResourcesByProduct(params) {
424
425
  project: { id: params.project.id },
425
426
  addOn: { itemOffered: { id: { $in: [productId] } } }
426
427
  });
427
- deleteResult = { deleteEventResult, updateOfferResult };
428
+ // メモを削除(2025-09-18~)
429
+ deleteNoteResult = yield repos.note.deleteNotesByAbout({
430
+ about: { id: productId, typeOf: params.typeOf }
431
+ });
432
+ deleteResult = { deleteEventResult, updateOfferResult, deleteNoteResult };
428
433
  }
429
434
  catch (error) {
430
435
  try {
package/package.json CHANGED
@@ -115,5 +115,5 @@
115
115
  "postversion": "git push origin --tags",
116
116
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
117
  },
118
- "version": "22.14.0-alpha.2"
118
+ "version": "22.14.0-alpha.3"
119
119
  }