@chevre/domain 21.27.0-alpha.21 → 21.27.0-alpha.22

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.
@@ -34,7 +34,7 @@ export interface IUpdateAggregateReservationParams {
34
34
  $set: {
35
35
  updatedAt: Date;
36
36
  aggregateReservation: factory.event.screeningEvent.IAggregateReservation;
37
- aggregateOffer?: factory.event.screeningEvent.IAggregateOffer;
37
+ aggregateOffer?: Pick<factory.event.screeningEvent.IAggregateOffer, 'aggregateDate' | 'offerCount' | 'typeOf'>;
38
38
  maximumAttendeeCapacity?: number;
39
39
  remainingAttendeeCapacity?: number;
40
40
  checkInCount?: number;
@@ -46,24 +46,6 @@ export interface IUpdateAggregateReservationParams {
46
46
  remainingAttendeeCapacity?: '';
47
47
  };
48
48
  }
49
- export interface IUpdateAggregateOfferParams {
50
- $set: {
51
- updatedAt: Date;
52
- aggregateOffer?: factory.event.screeningEvent.IAggregateOffer;
53
- };
54
- $unset: {
55
- noExistingAttributeName: 1;
56
- };
57
- }
58
- export interface IUpdateAggregateUseActionsParams {
59
- $set: {
60
- updatedAt: Date;
61
- aggregateEntranceGate: factory.event.screeningEvent.IAggregateEntranceGate;
62
- };
63
- $unset: {
64
- noExistingAttributeName: 1;
65
- };
66
- }
67
49
  export type ISearchConditions<T extends factory.eventType> = factory.event.ISearchConditions<T>;
68
50
  interface IAggregationByStatus {
69
51
  eventCount: number;
@@ -304,7 +286,7 @@ export declare class MongoRepository {
304
286
  */
305
287
  updateAggregationById<T extends factory.eventType>(params: {
306
288
  id: string;
307
- }, update: IUpdateAggregateReservationParams | IUpdateAggregateOfferParams | IUpdateAggregateUseActionsParams): Promise<Pick<factory.event.IEvent<T>, 'id' | 'typeOf' | 'project'>>;
289
+ }, update: IUpdateAggregateReservationParams): Promise<Pick<factory.event.IEvent<T>, 'id' | 'typeOf' | 'project'>>;
308
290
  bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteResult & {
309
291
  mongoose?: {
310
292
  validationErrors: import("mongoose").Error[];
@@ -1069,7 +1069,10 @@ class MongoRepository {
1069
1069
  /**
1070
1070
  * 集計属性を更新する
1071
1071
  */
1072
- updateAggregationById(params, update) {
1072
+ updateAggregationById(params, update
1073
+ // | IUpdateAggregateOfferParams // 廃止(2024-03-28)
1074
+ // | IUpdateAggregateUseActionsParams // 廃止(2024-03-28)
1075
+ ) {
1073
1076
  return __awaiter(this, void 0, void 0, function* () {
1074
1077
  const doc = yield this.eventModel.findOneAndUpdate({ _id: params.id }, update, {
1075
1078
  new: true,
@@ -64,17 +64,16 @@ function aggregateOffersByEvent(params) {
64
64
  screeningRoom: screeningRoom
65
65
  })(repos);
66
66
  debug('offers aggregated', aggregateOffer);
67
- // 値がundefinedの場合に更新しないように注意
68
67
  const update = {
69
- $set: Object.assign({ updatedAt: new Date() }, (typeof (aggregateOffer === null || aggregateOffer === void 0 ? void 0 : aggregateOffer.typeOf) === 'string') ? { aggregateOffer: aggregateOffer } : undefined),
70
- $unset: {
71
- noExistingAttributeName: 1 // $unsetは空だとエラーになるので
72
- }
68
+ $set: Object.assign({}, (typeof (aggregateOffer === null || aggregateOffer === void 0 ? void 0 : aggregateOffer.typeOf) === 'string') ? { aggregateOffer: aggregateOffer } : undefined)
69
+ // $unset: {
70
+ // noExistingAttributeName: 1 // $unsetは空だとエラーになるので
71
+ // }
73
72
  };
74
73
  debug('update:', update);
75
- // 保管
76
- const saveResult = yield repos.event.updateAggregationById({ id: event.id }, update);
77
- debug('aggregateOffersByEvent processd', saveResult);
74
+ // 廃止(2024-03-28~)
75
+ // const saveResult = await repos.event.updateAggregationById<typeof event.typeOf>({ id: event.id }, update);
76
+ // debug('aggregateOffersByEvent processd', saveResult);
78
77
  // aggregateReservationsにも保管(2024-03-25~)
79
78
  yield repos.aggregateReservation.save({
80
79
  project: event.project,
@@ -108,15 +108,15 @@ function aggregateByEvent(params) {
108
108
  // オファーごとの集計
109
109
  const aggregateOffer = yield aggregateOfferByEvent({
110
110
  aggregateDate: now,
111
- event: Object.assign(Object.assign({}, event), { maximumAttendeeCapacity,
112
- remainingAttendeeCapacity }),
113
- screeningRoom: screeningRoom
111
+ event,
112
+ screeningRoom
114
113
  })(repos);
115
114
  debug('offers aggregated', aggregateOffer);
116
115
  // 値がundefinedの場合に更新しないように注意
117
116
  const update = {
118
- $set: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
119
- aggregateReservation }, (typeof (aggregateOffer === null || aggregateOffer === void 0 ? void 0 : aggregateOffer.typeOf) === 'string') ? { aggregateOffer: aggregateOffer } : undefined), (maximumAttendeeCapacity !== undefined) ? { maximumAttendeeCapacity: maximumAttendeeCapacity } : undefined), (remainingAttendeeCapacity !== undefined) ? { remainingAttendeeCapacity: remainingAttendeeCapacity } : undefined), (aggregateReservation.checkInCount !== undefined) ? { checkInCount: aggregateReservation.checkInCount } : undefined), (aggregateReservation.attendeeCount !== undefined) ? { attendeeCount: aggregateReservation.attendeeCount } : undefined),
117
+ $set: Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
118
+ aggregateReservation,
119
+ aggregateOffer }, (maximumAttendeeCapacity !== undefined) ? { maximumAttendeeCapacity: maximumAttendeeCapacity } : undefined), (remainingAttendeeCapacity !== undefined) ? { remainingAttendeeCapacity: remainingAttendeeCapacity } : undefined), (aggregateReservation.checkInCount !== undefined) ? { checkInCount: aggregateReservation.checkInCount } : undefined), (aggregateReservation.attendeeCount !== undefined) ? { attendeeCount: aggregateReservation.attendeeCount } : undefined),
120
120
  $unset: Object.assign(Object.assign({ noExistingAttributeName: 1 }, (maximumAttendeeCapacity === undefined) ? { maximumAttendeeCapacity: '' } : undefined), (remainingAttendeeCapacity === undefined) ? { remainingAttendeeCapacity: '' } : undefined)
121
121
  };
122
122
  debug('update:', update);
@@ -168,48 +168,12 @@ function reservedSeatsAvailable(params) {
168
168
  }
169
169
  function aggregateOfferByEvent(params) {
170
170
  return (repos) => __awaiter(this, void 0, void 0, function* () {
171
- // プロジェクト限定(2023-02-22~)
172
- if (settings_1.settings.useAggregateOfferProjects.includes(params.event.project.id)) {
173
- // AggregateOffersタスクへ移行(2024-03-25~)
174
- // const availableOffers: factory.unitPriceOffer.IUnitPriceOffer[] = await findEventOffers(params)(repos);
175
- // // オファーごとの予約集計
176
- // const offersWithAggregateReservation: factory.event.screeningEvent.IOfferWithAggregateReservation[] = [];
177
- // for (const o of availableOffers) {
178
- // const { maximumAttendeeCapacity, remainingAttendeeCapacity, aggregateReservation } = await aggregateReservationByOffer({
179
- // aggregateDate: params.aggregateDate,
180
- // event: params.event,
181
- // screeningRoom: params.screeningRoom,
182
- // offer: o
183
- // })(repos);
184
- // offersWithAggregateReservation.push({
185
- // typeOf: <factory.offerType.Offer>o.typeOf,
186
- // id: o.id,
187
- // identifier: o.identifier,
188
- // aggregateReservation: aggregateReservation,
189
- // name: {
190
- // en: (<factory.multilingualString | undefined>o.name)?.en,
191
- // ja: (<factory.multilingualString | undefined>o.name)?.ja
192
- // },
193
- // ...(typeof maximumAttendeeCapacity === 'number') ? { maximumAttendeeCapacity } : undefined,
194
- // ...(typeof remainingAttendeeCapacity === 'number') ? { remainingAttendeeCapacity } : undefined,
195
- // // category情報を追加
196
- // ...(typeof o.category?.codeValue === 'string') ? { category: o.category } : undefined
197
- // });
198
- // }
199
- // return {
200
- // typeOf: factory.offerType.AggregateOffer,
201
- // offerCount: availableOffers.length,
202
- // offers: offersWithAggregateReservation
203
- // };
204
- }
205
- else {
206
- const { offerCount } = yield calculateOfferCount({ event: params.event })(repos);
207
- return {
208
- typeOf: factory.offerType.AggregateOffer,
209
- aggregateDate: params.aggregateDate,
210
- offerCount
211
- };
212
- }
171
+ const { offerCount } = yield calculateOfferCount({ event: params.event })(repos);
172
+ return {
173
+ typeOf: factory.offerType.AggregateOffer,
174
+ aggregateDate: params.aggregateDate,
175
+ offerCount
176
+ };
213
177
  });
214
178
  }
215
179
  function calculateOfferCount(params) {
@@ -33,19 +33,18 @@ function aggregateUseActionsOnEvent(params) {
33
33
  entranceGates
34
34
  })(repos);
35
35
  debug('entrances aggregated', aggregateEntranceGate);
36
- // 値がundefinedの場合に更新しないように注意
37
36
  const update = {
38
37
  $set: {
39
- updatedAt: new Date(),
38
+ // updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
40
39
  aggregateEntranceGate
41
- },
42
- $unset: {
43
- noExistingAttributeName: 1 // $unsetは空だとエラーになるので
44
40
  }
41
+ // $unset: {
42
+ // noExistingAttributeName: 1 // $unsetは空だとエラーになるので
43
+ // }
45
44
  };
46
45
  debug('update:', update);
47
- // 保管
48
- yield repos.event.updateAggregationById({ id: event.id }, update);
46
+ // 廃止(2024-03-28~)
47
+ // await repos.event.updateAggregationById({ id: event.id }, update);
49
48
  // aggregateReservationsにも保管(2024-03-25~)
50
49
  yield repos.aggregateReservation.save({
51
50
  project: event.project,
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.27.0-alpha.21"
113
+ "version": "21.27.0-alpha.22"
114
114
  }