@chevre/domain 22.14.0-alpha.15 → 22.14.0-alpha.17

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.
@@ -6,7 +6,6 @@ import type { EventRepo } from '../../../repo/event';
6
6
  import type { EventSeriesRepo } from '../../../repo/eventSeries';
7
7
  import type { IssuerRepo } from '../../../repo/issuer';
8
8
  import type { MemberProgramRepo } from '../../../repo/memberProgram';
9
- import type { EventOfferRepo } from '../../../repo/offer/event';
10
9
  import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
11
10
  import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
12
11
  import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
@@ -24,7 +23,6 @@ interface IStartOperationRepos {
24
23
  advanceBookingRequirement: AdvanceBookingRequirementRepo;
25
24
  stockHolder: StockHolderRepo;
26
25
  event: EventRepo;
27
- eventOffer: EventOfferRepo;
28
26
  eventSeries: EventSeriesRepo;
29
27
  issuer: IssuerRepo;
30
28
  memberProgram: MemberProgramRepo;
@@ -47,9 +47,9 @@ function start(params, options) {
47
47
  now,
48
48
  store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id }
49
49
  })({
50
- eventOffer: repos.eventOffer,
51
50
  issuer: repos.issuer,
52
- memberProgram: repos.memberProgram
51
+ memberProgram: repos.memberProgram,
52
+ productOffer: repos.productOffer
53
53
  });
54
54
  // objectに必要な情報をそろえる
55
55
  const { acceptedOffers4transactionObject, objectSubReservations } = yield createObjectAttributes({
@@ -2,7 +2,7 @@ import * as factory from '../../../factory';
2
2
  import { IMinimizedIndividualEvent } from '../../../factory/event';
3
3
  import type { IssuerRepo } from '../../../repo/issuer';
4
4
  import type { MemberProgramRepo } from '../../../repo/memberProgram';
5
- import type { EventOfferRepo } from '../../../repo/offer/event';
5
+ import type { ProductOfferRepo } from '../../../repo/productOffer';
6
6
  declare function validateStartRequest(params: {
7
7
  object: factory.assetTransaction.reserve.IObjectWithoutDetail;
8
8
  event: Pick<IMinimizedIndividualEvent<factory.eventType.Event | factory.eventType.ScreeningEvent>, 'offers' | 'id' | 'project'>;
@@ -16,8 +16,8 @@ declare function validateStartRequest(params: {
16
16
  id?: string;
17
17
  };
18
18
  }): (repos: {
19
- eventOffer: EventOfferRepo;
20
19
  issuer: IssuerRepo;
21
20
  memberProgram: MemberProgramRepo;
21
+ productOffer: ProductOfferRepo;
22
22
  }) => Promise<void>;
23
23
  export { validateStartRequest };
@@ -13,7 +13,6 @@ exports.validateStartRequest = validateStartRequest;
13
13
  const jwt = require("jsonwebtoken");
14
14
  const moment = require("moment");
15
15
  const factory = require("../../../factory");
16
- const ROLE_DATE_FORMAT = 'YYYY-MM-DDTHH:mm:ssZ';
17
16
  function verifyOfferedByToken(params) {
18
17
  return __awaiter(this, void 0, void 0, function* () {
19
18
  let result;
@@ -67,7 +66,7 @@ function validateStartRequest(params) {
67
66
  function validateMemberTier(params) {
68
67
  return (repos) => __awaiter(this, void 0, void 0, function* () {
69
68
  var _a, _b, _c, _d, _e;
70
- const { acceptedDate, event, availableAt, verifiedValidForMemberTier, memberProgramIdentifierMustBe } = params;
69
+ const { acceptedDate, event, verifiedValidForMemberTier, memberProgramIdentifierMustBe, aggregateOfferIdentifier } = params;
71
70
  const tierIdentifier = (_b = (_a = verifiedValidForMemberTier.member) === null || _a === void 0 ? void 0 : _a.memberOf) === null || _b === void 0 ? void 0 : _b.identifier;
72
71
  const memberProgramIdentifier = (_e = (_d = (_c = verifiedValidForMemberTier.member) === null || _c === void 0 ? void 0 : _c.memberOf) === null || _d === void 0 ? void 0 : _d.isTierOf) === null || _e === void 0 ? void 0 : _e.identifier;
73
72
  if (typeof tierIdentifier !== 'string') {
@@ -79,28 +78,36 @@ function validateMemberTier(params) {
79
78
  if (memberProgramIdentifier !== memberProgramIdentifierMustBe) {
80
79
  throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'member program not matched');
81
80
  }
82
- // イベントオファーを検索して有効期間検証
83
- const eventOfferForMemberTier = (yield repos.eventOffer.projectFields({
81
+ // 有効なプロダクトオファーを検証
82
+ const productOfferForMemberTier = (yield repos.productOffer.findProductOffers({
84
83
  limit: 1,
85
84
  page: 1,
86
85
  project: { id: { $eq: event.project.id } },
87
- availableAtOrFrom: { id: { $eq: availableAt.id } },
88
- itemOffered: { id: { $eq: event.id } },
89
- validForMemberTier: { identifier: { $eq: tierIdentifier } }
90
- }, ['validFrom', 'validThrough'])).shift();
91
- if (eventOfferForMemberTier === undefined) {
92
- throw new factory.errors.NotFound(factory.offerType.Offer, 'event offer for member tier not found');
93
- }
94
- let validThroughMoment;
95
- let validFromMoment;
96
- validThroughMoment = moment(eventOfferForMemberTier.validThrough, ROLE_DATE_FORMAT, true);
97
- validFromMoment = moment(eventOfferForMemberTier.validFrom, ROLE_DATE_FORMAT, true);
98
- if (acceptedDate.isBefore(validFromMoment)) {
99
- throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', `the offer id valid from ${validFromMoment}`);
100
- }
101
- if (acceptedDate.isAfter(validThroughMoment)) {
102
- throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', `the offer id valid through ${validThroughMoment}`);
86
+ // availableAtOrFrom: { id: { $eq: availableAt.id } },
87
+ itemOffered: { identifier: { $eq: aggregateOfferIdentifier } }, // オファーコレクションコード
88
+ validForMemberTier: { identifier: { $eq: tierIdentifier } },
89
+ validFrom: { $lte: acceptedDate.toDate() },
90
+ validThrough: { $gte: acceptedDate.toDate() }
91
+ }, ['identifier'])).shift();
92
+ if (productOfferForMemberTier === undefined) {
93
+ throw new factory.errors.NotFound(factory.offerType.Offer, 'product offer for member tier not found');
103
94
  }
95
+ // let validThroughMoment: moment.Moment;
96
+ // let validFromMoment: moment.Moment;
97
+ // validThroughMoment = moment(productOfferForMemberTier.validThrough, ROLE_DATE_FORMAT, true);
98
+ // validFromMoment = moment(productOfferForMemberTier.validFrom, ROLE_DATE_FORMAT, true);
99
+ // if (acceptedDate.isBefore(validFromMoment)) {
100
+ // throw new factory.errors.Argument(
101
+ // 'reservationFor.offers.validForMemberTier',
102
+ // `the offer id valid from ${validFromMoment}`
103
+ // );
104
+ // }
105
+ // if (acceptedDate.isAfter(validThroughMoment)) {
106
+ // throw new factory.errors.Argument(
107
+ // 'reservationFor.offers.validForMemberTier',
108
+ // `the offer id valid through ${validThroughMoment}`
109
+ // );
110
+ // }
104
111
  });
105
112
  }
106
113
  /**
@@ -116,11 +123,11 @@ function validateEventOfferPeriod(params) {
116
123
  const makesOfferOnApplication = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.seller.makesOffer.find((offer) => {
117
124
  var _a, _b;
118
125
  // support non-array(2024-10-11~)
119
- return (Array.isArray(offer.availableAtOrFrom) && ((_a = offer.availableAtOrFrom.at(0)) === null || _a === void 0 ? void 0 : _a.id) === params.availableAt.id)
120
- || (!Array.isArray(offer.availableAtOrFrom) && ((_b = offer.availableAtOrFrom) === null || _b === void 0 ? void 0 : _b.id) === params.availableAt.id);
126
+ return (Array.isArray(offer.availableAtOrFrom) && ((_a = offer.availableAtOrFrom.at(0)) === null || _a === void 0 ? void 0 : _a.id) === availableAt.id)
127
+ || (!Array.isArray(offer.availableAtOrFrom) && ((_b = offer.availableAtOrFrom) === null || _b === void 0 ? void 0 : _b.id) === availableAt.id);
121
128
  });
122
129
  if (makesOfferOnApplication === undefined) {
123
- throw new factory.errors.Argument('reservationFor.id', `seller makes no available offer at ${params.availableAt.id}`);
130
+ throw new factory.errors.Argument('reservationFor.id', `seller makes no available offer at ${availableAt.id}`);
124
131
  }
125
132
  const validFrom = makesOfferOnApplication.validFrom;
126
133
  const validThrough = makesOfferOnApplication.validThrough;
@@ -137,37 +144,45 @@ function validateEventOfferPeriod(params) {
137
144
  }
138
145
  }
139
146
  // support validForMemberTier(2025-05-14~)
140
- const memberProgramIdentifierMustBe = (_b = (_a = makesOfferOnApplication.validForMemberTier) === null || _a === void 0 ? void 0 : _a.isTierOf) === null || _b === void 0 ? void 0 : _b.identifier;
141
- if (typeof memberProgramIdentifierMustBe === 'string') {
142
- if (typeof validForMemberTierToken !== 'string' || validForMemberTierToken === '') {
143
- throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier');
144
- }
145
- // トークン検証
146
- const memberProgram = (yield repos.memberProgram.projectMemberPrograms({
147
- limit: 1,
148
- page: 1,
149
- project: { id: { $eq: params.event.project.id } },
150
- identifier: { $eq: memberProgramIdentifierMustBe }
151
- })).shift();
152
- if (memberProgram === undefined) {
153
- throw new factory.errors.NotFound('MemberProgram');
154
- }
155
- const issuer = yield repos.issuer.findByIdentifier({
156
- project: { id: params.event.project.id },
157
- identifier: memberProgram.hostingOrganization.identifier
158
- });
159
- if (typeof issuer.tokenSecret !== 'string' || issuer.tokenSecret === '') {
160
- throw new factory.errors.NotFound('issuer.tokenSecret');
147
+ if (makesOfferOnApplication.typeOf === factory.offerType.AggregateOffer) {
148
+ const memberProgramIdentifierMustBe = (_b = (_a = makesOfferOnApplication.validForMemberTier) === null || _a === void 0 ? void 0 : _a.isTierOf) === null || _b === void 0 ? void 0 : _b.identifier;
149
+ if (typeof memberProgramIdentifierMustBe === 'string') {
150
+ // 有効メンバープログラムティアが存在する場合、ティアトークンが必須
151
+ if (typeof validForMemberTierToken !== 'string' || validForMemberTierToken === '') {
152
+ throw new factory.errors.ArgumentNull('reservationFor.offers.validForMemberTier');
153
+ }
154
+ // 有効メンバープログラムティアが存在する場合、オファーコレクションコードが必須
155
+ const aggregateOfferIdentifier = makesOfferOnApplication.identifier;
156
+ if (typeof aggregateOfferIdentifier !== 'string' || aggregateOfferIdentifier === '') {
157
+ throw new factory.errors.NotFound('makesOfferOnApplication.identifier');
158
+ }
159
+ // トークン検証
160
+ const memberProgram = (yield repos.memberProgram.projectMemberPrograms({
161
+ limit: 1,
162
+ page: 1,
163
+ project: { id: { $eq: params.event.project.id } },
164
+ identifier: { $eq: memberProgramIdentifierMustBe }
165
+ })).shift();
166
+ if (memberProgram === undefined) {
167
+ throw new factory.errors.NotFound('MemberProgram');
168
+ }
169
+ const issuer = yield repos.issuer.findByIdentifier({
170
+ project: { id: params.event.project.id },
171
+ identifier: memberProgram.hostingOrganization.identifier
172
+ });
173
+ if (typeof issuer.tokenSecret !== 'string' || issuer.tokenSecret === '') {
174
+ throw new factory.errors.NotFound('issuer.tokenSecret');
175
+ }
176
+ const verifiedValidForMemberTier = yield verifyOfferedByToken({
177
+ secret: issuer.tokenSecret,
178
+ issuer: issuer.url,
179
+ token: validForMemberTierToken
180
+ });
181
+ yield validateMemberTier({
182
+ event, acceptedDate, verifiedValidForMemberTier,
183
+ memberProgramIdentifierMustBe, aggregateOfferIdentifier
184
+ })(repos);
161
185
  }
162
- const verifiedValidForMemberTier = yield verifyOfferedByToken({
163
- secret: issuer.tokenSecret,
164
- issuer: issuer.url,
165
- token: validForMemberTierToken
166
- });
167
- yield validateMemberTier({
168
- event, availableAt, acceptedDate, verifiedValidForMemberTier,
169
- memberProgramIdentifierMustBe
170
- })(repos);
171
186
  }
172
187
  });
173
188
  }
@@ -8,7 +8,6 @@ import type { EventRepo, IMinimizedIndividualEvent } from '../../../../repo/even
8
8
  import { EventSeriesRepo } from '../../../../repo/eventSeries';
9
9
  import type { IssuerRepo } from '../../../../repo/issuer';
10
10
  import type { MemberProgramRepo } from '../../../../repo/memberProgram';
11
- import type { EventOfferRepo } from '../../../../repo/offer/event';
12
11
  import type { OfferRepo } from '../../../../repo/offer/unitPriceInCatalog';
13
12
  import type { OfferCatalogRepo } from '../../../../repo/offerCatalog';
14
13
  import type { OfferCatalogItemRepo } from '../../../../repo/offerCatalogItem';
@@ -53,7 +52,6 @@ declare function processStartReserve4chevre(params: {
53
52
  authorization: AuthorizationRepo;
54
53
  stockHolder: StockHolderRepo;
55
54
  event: EventRepo;
56
- eventOffer: EventOfferRepo;
57
55
  eventSeries: EventSeriesRepo;
58
56
  issuer: IssuerRepo;
59
57
  memberProgram: MemberProgramRepo;
@@ -8,7 +8,6 @@ import type { EventRepo } from '../../../repo/event';
8
8
  import { EventSeriesRepo } from '../../../repo/eventSeries';
9
9
  import type { IssuerRepo } from '../../../repo/issuer';
10
10
  import type { MemberProgramRepo } from '../../../repo/memberProgram';
11
- import type { EventOfferRepo } from '../../../repo/offer/event';
12
11
  import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
13
12
  import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
14
13
  import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
@@ -33,7 +32,6 @@ interface IAuthorizeRepos {
33
32
  assetTransaction: AssetTransactionRepo;
34
33
  authorization: AuthorizationRepo;
35
34
  event: EventRepo;
36
- eventOffer: EventOfferRepo;
37
35
  eventSeries: EventSeriesRepo;
38
36
  issuer: IssuerRepo;
39
37
  memberProgram: MemberProgramRepo;
@@ -8,7 +8,6 @@ import type { OrderInTransactionRepo } from '../../repo/orderInTransaction';
8
8
  import type { OrderNumberRepo } from '../../repo/orderNumber';
9
9
  import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
10
10
  import type { ProductRepo } from '../../repo/product';
11
- import type { ProductOfferRepo } from '../../repo/productOffer';
12
11
  import type { ProjectRepo } from '../../repo/project';
13
12
  import type { ServiceOutputRepo } from '../../repo/serviceOutput';
14
13
  import type { ServiceOutputIdentifierRepo } from '../../repo/serviceOutputIdentifier';
@@ -24,7 +23,6 @@ export interface IAuthorizeOperationRepos {
24
23
  orderNumber: OrderNumberRepo;
25
24
  ownershipInfo: OwnershipInfoRepo;
26
25
  product: ProductRepo;
27
- productOffer: ProductOfferRepo;
28
26
  project: ProjectRepo;
29
27
  serviceOutput: ServiceOutputRepo;
30
28
  serviceOutputIdentifier: ServiceOutputIdentifierRepo;
@@ -65,7 +63,6 @@ export declare function search(params: {
65
63
  offer: OfferRepo;
66
64
  offerCatalog: OfferCatalogRepo;
67
65
  product: ProductRepo;
68
- productOffer: ProductOfferRepo;
69
66
  }) => Promise<{
70
67
  offers: factory.product.ITicketOffer[];
71
68
  product: Pick<factory.product.IProduct, "id" | "productID" | "typeOf" | "name" | "project" | "serviceOutput" | "serviceType" | "description">;
@@ -13,7 +13,6 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = void 0;
13
13
  exports.search = search;
14
14
  exports.authorize = authorize;
15
15
  exports.voidTransaction = voidTransaction;
16
- const moment = require("moment");
17
16
  const factory = require("../../factory");
18
17
  const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
19
18
  const availableProductTypes_1 = require("../../factory/availableProductTypes");
@@ -28,8 +27,8 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = 'Already registered';
28
27
  */
29
28
  function search(params) {
30
29
  return (repos) => __awaiter(this, void 0, void 0, function* () {
30
+ // const now = moment();
31
31
  var _a;
32
- const now = moment();
33
32
  const searchProductsResult = yield repos.product.projectFields({
34
33
  limit: 1,
35
34
  page: 1,
@@ -47,28 +46,24 @@ function search(params) {
47
46
  || product.typeOf === factory.product.ProductType.PaymentCard) {
48
47
  const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
49
48
  if (typeof sellerId === 'string') {
50
- // const productOffers = product.offers;
51
- // if (!Array.isArray(productOffers)) {
49
+ // productsドキュメント参照のoffers検証は廃止(2025-09-22~)
50
+ // const productOffers = await repos.productOffer.search({
51
+ // project: { id: { $eq: params.project.id } },
52
+ // itemOffered: { id: { $eq: params.itemOffered.id } },
53
+ // seller: { id: { $eq: sellerId } }
54
+ // });
55
+ // const hasValidOffer = productOffers.some((o) => {
56
+ // return o.seller?.id === sellerId
57
+ // && o.validFrom !== undefined
58
+ // && moment(o.validFrom)
59
+ // .isSameOrBefore(now)
60
+ // && o.validThrough !== undefined
61
+ // && moment(o.validThrough)
62
+ // .isSameOrAfter(now);
63
+ // });
64
+ // if (!hasValidOffer) {
52
65
  // return { offers: [], product };
53
66
  // }
54
- const productOffers = yield repos.productOffer.search({
55
- project: { id: { $eq: params.project.id } },
56
- itemOffered: { id: { $eq: params.itemOffered.id } },
57
- seller: { id: { $eq: sellerId } }
58
- });
59
- const hasValidOffer = productOffers.some((o) => {
60
- var _a;
61
- return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === sellerId
62
- && o.validFrom !== undefined
63
- && moment(o.validFrom)
64
- .isSameOrBefore(now)
65
- && o.validThrough !== undefined
66
- && moment(o.validThrough)
67
- .isSameOrAfter(now);
68
- });
69
- if (!hasValidOffer) {
70
- return { offers: [], product };
71
- }
72
67
  }
73
68
  }
74
69
  const offers = yield (0, searchProductOffers_1.searchProductOffers)({
@@ -282,7 +277,7 @@ function processVoidRegisterServiceTransaction(params) {
282
277
  * 受け入れらたオファーの内容を検証
283
278
  */
284
279
  function validateAcceptedOffers(params) {
285
- return (repos) => __awaiter(this, void 0, void 0, function* () {
280
+ return (__) => __awaiter(this, void 0, void 0, function* () {
286
281
  let acceptedOfferWithoutDetail = params.object;
287
282
  if (!Array.isArray(acceptedOfferWithoutDetail)) {
288
283
  acceptedOfferWithoutDetail = [acceptedOfferWithoutDetail];
@@ -297,22 +292,18 @@ function validateAcceptedOffers(params) {
297
292
  typeOf: params.seller.typeOf
298
293
  };
299
294
  // 販売者を検証
300
- // const productOffers = params.product.offers;
301
- // if (!Array.isArray(productOffers)) {
302
- // throw new factory.errors.Argument('Product', 'Product offers undefined');
295
+ // productsドキュメント参照のoffers検証は廃止(2025-09-22~)
296
+ // const productOffers = await repos.productOffer.search({
297
+ // project: { id: { $eq: params.product.project.id } },
298
+ // itemOffered: { id: { $eq: String(params.product.id) } },
299
+ // seller: { id: { $eq: params.seller.id } }
300
+ // });
301
+ // const hasValidOffer = productOffers.some((o) => {
302
+ // return o.seller?.id === params.seller.id;
303
+ // });
304
+ // if (!hasValidOffer) {
305
+ // throw new factory.errors.Argument('Product', 'Product has no valid offer');
303
306
  // }
304
- const productOffers = yield repos.productOffer.search({
305
- project: { id: { $eq: params.product.project.id } },
306
- itemOffered: { id: { $eq: String(params.product.id) } },
307
- seller: { id: { $eq: params.seller.id } }
308
- });
309
- const hasValidOffer = productOffers.some((o) => {
310
- var _a;
311
- return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === params.seller.id;
312
- });
313
- if (!hasValidOffer) {
314
- throw new factory.errors.Argument('Product', 'Product has no valid offer');
315
- }
316
307
  // 利用可能なチケットオファーであれば受け入れる
317
308
  return Promise.all(acceptedOfferWithoutDetail.map((offerWithoutDetail) => {
318
309
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
@@ -17,7 +17,6 @@ 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';
21
20
  import type { SettingRepo } from '../../../repo/setting';
22
21
  import type { TaskRepo } from '../../../repo/task';
23
22
  export declare function onResourceDeleted(params: factory.task.onResourceUpdated.IData): (repos: {
@@ -39,7 +38,6 @@ export declare function onResourceDeleted(params: factory.task.onResourceUpdated
39
38
  screeningRoom: ScreeningRoomRepo;
40
39
  product: ProductRepo;
41
40
  productModel: ProductModelRepo;
42
- productOffer: ProductOfferRepo;
43
41
  setting: SettingRepo;
44
42
  task: TaskRepo;
45
43
  }) => Promise<void>;
@@ -252,11 +252,12 @@ function deleteResourcesBySeller(params) {
252
252
  project: { id: params.project.id },
253
253
  id: sellerId
254
254
  });
255
+ // productsドキュメント参照のoffers検証は廃止(2025-09-22~)
255
256
  // プロダクトオファー削除
256
- const deleteProductOfferResult = yield repos.productOffer.deleteManyBySellerId({
257
- project: { id: params.project.id },
258
- seller: { id: sellerId }
259
- });
257
+ // const deleteProductOfferResult = await repos.productOffer.deleteManyBySellerId({
258
+ // project: { id: params.project.id },
259
+ // seller: { id: sellerId }
260
+ // });
260
261
  // イベント削除
261
262
  const deleteEventResult = yield repos.event.deleteManyEventByOrganizerId({
262
263
  project: { id: params.project.id },
@@ -278,7 +279,8 @@ function deleteResourcesBySeller(params) {
278
279
  parentOrganization: { id: sellerId }
279
280
  });
280
281
  deleteResult = {
281
- deleteMemberResult, deletePaymentServiceProviderResult, deleteProductOfferResult,
282
+ deleteMemberResult, deletePaymentServiceProviderResult,
283
+ // deleteProductOfferResult,
282
284
  deleteEventResult, deleteEventSeriesResult, deleteScreeningRoomResult, deleteMovieTheaterResult
283
285
  };
284
286
  }
@@ -29,7 +29,6 @@ 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");
33
32
  const setting_1 = require("../../repo/setting");
34
33
  const task_1 = require("../../repo/task");
35
34
  const onAggregateOfferUpdated_1 = require("./onResourceUpdated/onAggregateOfferUpdated");
@@ -61,7 +60,7 @@ function call(data) {
61
60
  screeningRoom: new screeningRoom_1.ScreeningRoomRepo(connection),
62
61
  product: new product_1.ProductRepo(connection),
63
62
  productModel: new productModel_1.ProductModelRepo(connection),
64
- productOffer: new productOffer_1.ProductOfferRepo(connection),
63
+ // productOffer: new ProductOfferRepo(connection),
65
64
  setting: new setting_1.SettingRepo(connection),
66
65
  task: new task_1.TaskRepo(connection)
67
66
  });
package/package.json CHANGED
@@ -11,7 +11,7 @@
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.16",
14
+ "@chevre/factory": "4.399.0-alpha.17",
15
15
  "@cinerino/sdk": "12.2.0",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.4.0-alpha.1",
@@ -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.15"
118
+ "version": "22.14.0-alpha.17"
119
119
  }
@@ -1,67 +0,0 @@
1
- // tslint:disable:no-console
2
- import * as mongoose from 'mongoose';
3
-
4
- import { chevre } from '../../../../lib/index';
5
-
6
- const project = { id: String(process.env.PROJECT_ID) };
7
- const IDENTIFIER = 'xxx';
8
-
9
- async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
-
12
- // const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
13
- const eventOfferRepo = await chevre.repository.EventOffer.createInstance(mongoose.connection);
14
-
15
- let docs = await eventOfferRepo.projectFields(
16
- {
17
- project: { id: { $eq: project.id } },
18
- identifier: { $eq: IDENTIFIER }
19
- },
20
- ['availableAtOrFrom', 'identifier', 'itemOffered', 'project', 'validFrom']
21
- );
22
- console.log('docs:', docs);
23
- console.log(docs.length, 'docs found');
24
-
25
- if (docs.length > 0) {
26
- await eventOfferRepo.deleteById({
27
- project: { id: docs[0].project.id },
28
- id: docs[0].id
29
- });
30
- console.log('deleted', docs[0].id);
31
- }
32
-
33
- await eventOfferRepo.save({
34
- attributes: {
35
- identifier: IDENTIFIER,
36
- project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
37
- typeOf: chevre.factory.offerType.Offer,
38
- itemOffered: {
39
- id: 'xxxxx',
40
- typeOf: chevre.factory.eventType.ScreeningEvent
41
- },
42
- seller: {
43
- id: 'xxxxx',
44
- typeOf: chevre.factory.organizationType.Organization
45
- },
46
- availableAtOrFrom: { id: 'xxx' },
47
- validFrom: new Date(),
48
- validThrough: new Date(),
49
- validForMemberTier: { identifier: 'xxx', typeOf: 'MemberProgramTier' }
50
- }
51
- });
52
- console.log('created.');
53
-
54
- docs = await await eventOfferRepo.projectFields(
55
- {
56
- project: { id: { $eq: project.id } },
57
- identifier: { $eq: IDENTIFIER }
58
- },
59
- ['availableAtOrFrom', 'identifier', 'itemOffered', 'project', 'validFrom']
60
- );
61
- console.log('docs:', docs);
62
- console.log(docs.length, 'docs found');
63
- }
64
-
65
- main()
66
- .then()
67
- .catch(console.error);
@@ -1,10 +0,0 @@
1
- import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
- import * as factory from '../../../../factory';
3
- type IDocType = factory.eventOffer.IEventOfferForMemberTier;
4
- type IModel = Model<IDocType>;
5
- type ISchemaDefinition = SchemaDefinition<IDocType>;
6
- type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
7
- declare const modelName = "Offer.Event";
8
- declare const indexes: [d: IndexDefinition, o: IndexOptions][];
9
- declare function createSchema(): ISchema;
10
- export { createSchema, IDocType, IModel, indexes, modelName };
@@ -1,38 +0,0 @@
1
- import { Connection, FilterQuery } from 'mongoose';
2
- import * as factory from '../../factory';
3
- import { IDocType } from '../mongoose/schemas/offer/event';
4
- type ISearchConditions = factory.eventOffer.ISearchConditions;
5
- export type ISavingOffer = Pick<IDocType, 'availableAtOrFrom' | 'identifier' | 'itemOffered' | 'project' | 'seller' | 'typeOf' | 'validForMemberTier' | 'validFrom' | 'validThrough'> & {
6
- id?: never;
7
- };
8
- interface IUnset {
9
- $unset?: {
10
- [key: string]: 1;
11
- };
12
- }
13
- type IDocWithId = IDocType & {
14
- id: string;
15
- };
16
- type IKeyOfProjection = keyof IDocType;
17
- /**
18
- * イベントオファーリポジトリ
19
- */
20
- export declare class EventOfferRepo {
21
- private readonly eventOfferModel;
22
- constructor(connection: Connection);
23
- static CREATE_FILTER_QUERY(params: ISearchConditions): FilterQuery<IDocType>[];
24
- save(params: {
25
- id?: string;
26
- attributes: ISavingOffer & IUnset;
27
- }): Promise<{
28
- id: string;
29
- }>;
30
- projectFields(conditions: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IDocWithId[]>;
31
- deleteById(params: {
32
- id: string;
33
- project: {
34
- id: string;
35
- };
36
- }): Promise<void>;
37
- }
38
- export {};