@chevre/domain 22.14.0-alpha.29 → 22.14.0-alpha.30

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 { Connection, FilterQuery } from 'mongoose';
3
3
  import * as factory from '../factory';
4
4
  import { IDocType } from './mongoose/schemas/productOffer';
@@ -33,9 +33,20 @@ export declare class ProductOfferRepo {
33
33
  update: boolean;
34
34
  }): Promise<{
35
35
  bulkWriteResult: BulkWriteResult;
36
- modifiedNotes: {
36
+ modifiedProductOffers: {
37
37
  id: string;
38
38
  }[];
39
39
  } | void>;
40
+ /**
41
+ * 販売者の提供するプロダクトオファーを削除する
42
+ */
43
+ deleteProductOffersBySeller(params: {
44
+ project: {
45
+ id: string;
46
+ };
47
+ offeredBy: {
48
+ id: string;
49
+ };
50
+ }): Promise<DeleteResult>;
40
51
  }
41
52
  export {};
@@ -166,15 +166,42 @@ class ProductOfferRepo {
166
166
  if (bulkWriteOps.length > 0) {
167
167
  const bulkWriteResult = yield this.productOfferModel.bulkWrite(bulkWriteOps, { ordered: false });
168
168
  // modifiedの場合upsertedIdsに含まれないので、idを検索する
169
- const modifiedNotes = yield this.productOfferModel.find({ $or: queryFilters }, {
169
+ const modifiedProductOffers = yield this.productOfferModel.find({ $or: queryFilters }, {
170
170
  _id: 0,
171
171
  id: { $toString: '$_id' }
172
172
  })
173
173
  .lean()
174
174
  .exec();
175
- return { bulkWriteResult, modifiedNotes };
175
+ return { bulkWriteResult, modifiedProductOffers };
176
176
  }
177
177
  });
178
178
  }
179
+ // public async deleteProductOffersByIds(params: {
180
+ // project: { id: string };
181
+ // ids: string[];
182
+ // }): Promise<DeleteResult | void> {
183
+ // const { project, ids } = params;
184
+ // if (Array.isArray(ids) && ids.length > 0) {
185
+ // return this.productOfferModel.deleteMany(
186
+ // {
187
+ // 'project.id': { $eq: project.id },
188
+ // _id: { $in: ids }
189
+ // }
190
+ // )
191
+ // .exec();
192
+ // }
193
+ // }
194
+ /**
195
+ * 販売者の提供するプロダクトオファーを削除する
196
+ */
197
+ deleteProductOffersBySeller(params) {
198
+ return __awaiter(this, void 0, void 0, function* () {
199
+ return this.productOfferModel.deleteMany({
200
+ 'project.id': { $eq: params.project.id },
201
+ 'offeredBy.id': { $eq: params.offeredBy.id }
202
+ })
203
+ .exec();
204
+ });
205
+ }
179
206
  }
180
207
  exports.ProductOfferRepo = ProductOfferRepo;
@@ -17,6 +17,7 @@ import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
17
17
  import type { ScreeningRoomRepo } from '../../../repo/place/screeningRoom';
18
18
  import type { ProductRepo } from '../../../repo/product';
19
19
  import type { ProductModelRepo } from '../../../repo/productModel';
20
+ import type { ProductOfferRepo } from '../../../repo/productOffer';
20
21
  import type { SettingRepo } from '../../../repo/setting';
21
22
  import type { TaskRepo } from '../../../repo/task';
22
23
  export declare function onResourceDeleted(params: factory.task.onResourceUpdated.IData): (repos: {
@@ -38,6 +39,7 @@ export declare function onResourceDeleted(params: factory.task.onResourceUpdated
38
39
  screeningRoom: ScreeningRoomRepo;
39
40
  product: ProductRepo;
40
41
  productModel: ProductModelRepo;
42
+ productOffer: ProductOfferRepo;
41
43
  setting: SettingRepo;
42
44
  task: TaskRepo;
43
45
  }) => Promise<void>;
@@ -252,12 +252,6 @@ function deleteResourcesBySeller(params) {
252
252
  project: { id: params.project.id },
253
253
  id: sellerId
254
254
  });
255
- // productsドキュメント参照のoffers検証は廃止(2025-09-22~)
256
- // プロダクトオファー削除
257
- // const deleteProductOfferResult = await repos.productOffer.deleteManyBySellerId({
258
- // project: { id: params.project.id },
259
- // seller: { id: sellerId }
260
- // });
261
255
  // イベント削除
262
256
  const deleteEventResult = yield repos.event.deleteManyEventByOrganizerId({
263
257
  project: { id: params.project.id },
@@ -278,9 +272,14 @@ function deleteResourcesBySeller(params) {
278
272
  project: { id: params.project.id },
279
273
  parentOrganization: { id: sellerId }
280
274
  });
275
+ // プロダクトオファー削除(2025-10-02~)
276
+ const deleteProductOfferResult = yield repos.productOffer.deleteProductOffersBySeller({
277
+ project: { id: params.project.id },
278
+ offeredBy: { id: sellerId }
279
+ });
281
280
  deleteResult = {
282
281
  deleteMemberResult, deletePaymentServiceProviderResult,
283
- // deleteProductOfferResult,
282
+ deleteProductOfferResult,
284
283
  deleteEventResult, deleteEventSeriesResult, deleteScreeningRoomResult, deleteMovieTheaterResult
285
284
  };
286
285
  }
@@ -29,6 +29,7 @@ const movieTheater_1 = require("../../repo/place/movieTheater");
29
29
  const screeningRoom_1 = require("../../repo/place/screeningRoom");
30
30
  const product_1 = require("../../repo/product");
31
31
  const productModel_1 = require("../../repo/productModel");
32
+ const productOffer_1 = require("../../repo/productOffer");
32
33
  const setting_1 = require("../../repo/setting");
33
34
  const task_1 = require("../../repo/task");
34
35
  const onAggregateOfferUpdated_1 = require("./onResourceUpdated/onAggregateOfferUpdated");
@@ -60,7 +61,7 @@ function call(data) {
60
61
  screeningRoom: new screeningRoom_1.ScreeningRoomRepo(connection),
61
62
  product: new product_1.ProductRepo(connection),
62
63
  productModel: new productModel_1.ProductModelRepo(connection),
63
- // productOffer: new ProductOfferRepo(connection),
64
+ productOffer: new productOffer_1.ProductOfferRepo(connection),
64
65
  setting: new setting_1.SettingRepo(connection),
65
66
  task: new task_1.TaskRepo(connection)
66
67
  });
package/package.json CHANGED
@@ -11,8 +11,8 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "4.399.0-alpha.24",
15
- "@cinerino/sdk": "12.4.0",
14
+ "@chevre/factory": "4.399.0-alpha.25",
15
+ "@cinerino/sdk": "12.5.0-alpha.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
18
18
  "@sendgrid/client": "8.1.4",
@@ -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.29"
118
+ "version": "22.14.0-alpha.30"
119
119
  }