@chevre/domain 23.1.0-alpha.32 → 23.1.0-alpha.34

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.
@@ -19,6 +19,7 @@ async function main() {
19
19
  limit: 100,
20
20
  page: 10,
21
21
  projectId: String(PROJECT_ID),
22
+ sellerId: '59d20831e53ebc2b4e774466',
22
23
  eventId: '693622f7876e9977c32ae270',
23
24
  /**
24
25
  * セクションコード
@@ -1,5 +1,6 @@
1
1
  import type { EventRepo } from '../repo/event';
2
2
  import type { SeatRepo } from '../repo/place/seat';
3
+ import type { SectionRepo } from '../repo/place/section';
3
4
  import type { StockHolderRepo } from '../repo/stockHolder';
4
5
  import * as factory from '../factory';
5
6
  import * as EventOfferService from './offer/event';
@@ -48,11 +49,17 @@ export declare function searchEventSeatOffersWithPaging(params: {
48
49
  id: string;
49
50
  };
50
51
  $projection?: factory.place.seat.IProjection;
51
- options: {};
52
+ options: {
53
+ /**
54
+ * 自動的にひとつめのセクションに絞るかどうか
55
+ */
56
+ useDefaultSection: boolean;
57
+ };
52
58
  }): (repos: {
53
59
  event: EventRepo;
54
60
  stockHolder: StockHolderRepo;
55
61
  seat: SeatRepo;
62
+ section: SectionRepo;
56
63
  }) => Promise<ISeatAsEventOffer[]>;
57
64
  /**
58
65
  * セクション指定でイベントに対する座席オファーを検索する
@@ -61,6 +68,7 @@ export declare function findEventSeatOffersBySection(params: {
61
68
  limit: number;
62
69
  page: number;
63
70
  projectId: string;
71
+ sellerId: string;
64
72
  eventId: string;
65
73
  /**
66
74
  * セクションコード
@@ -57,32 +57,49 @@ function addOffers2Seat(params) {
57
57
  /**
58
58
  * イベントに対する座席オファーを検索する
59
59
  */
60
- // tslint:disable-next-line:max-func-body-length
61
60
  function searchEventSeatOffersWithPaging(params) {
62
- // tslint:disable-next-line:max-func-body-length
63
61
  return (repos) => __awaiter(this, void 0, void 0, function* () {
64
62
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
65
- // const { excludePriceSpecification } = params.options;
63
+ const { useDefaultSection } = params.options;
66
64
  let offers = [];
67
65
  // optimize(2024-07-18~)
68
- const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, ['project', 'startDate', 'offers.itemOffered']);
66
+ const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, ['project', 'startDate', 'offers.itemOffered', 'organizer']);
69
67
  // 座席指定利用可能かどうか
70
68
  const eventOffers = event.offers;
71
69
  const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
72
70
  if (reservedSeatsAvailable) {
73
71
  const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
74
72
  const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
73
+ let defaultSectionCode;
74
+ if (useDefaultSection) {
75
+ const defaultSection = (yield repos.section.findSectionsByRoom({
76
+ limit: 1,
77
+ page: 1,
78
+ projectId: event.project.id,
79
+ sellerId: event.organizer.id,
80
+ movieTheaterCode: movieTheaterBranchCode,
81
+ roomCode: roomBranchCode
82
+ })).shift();
83
+ if (defaultSection === undefined) {
84
+ return [];
85
+ }
86
+ defaultSectionCode = defaultSection.branchCode;
87
+ // tslint:disable-next-line:no-console
88
+ console.log('searchEventSeatOffersWithPaging:defaultSectionCode:', defaultSectionCode);
89
+ }
75
90
  const seats = yield repos.seat.projectSeatsByScreeningRoom(Object.assign(Object.assign({}, params), { project: { id: { $eq: event.project.id } }, screeningRoom: {
76
91
  branchCode: { $eq: roomBranchCode },
77
92
  containedInPlace: {
78
93
  branchCode: { $eq: movieTheaterBranchCode }
79
94
  }
80
95
  }, containedInPlace: {
81
- branchCode: {
82
- $eq: (typeof ((_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq) === 'string')
83
- ? (_k = (_j = params.containedInPlace) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$eq
84
- : undefined
85
- }
96
+ branchCode: Object.assign({}, (typeof defaultSectionCode === 'string')
97
+ ? { $eq: defaultSectionCode }
98
+ : {
99
+ $eq: (typeof ((_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq) === 'string')
100
+ ? (_k = (_j = params.containedInPlace) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$eq
101
+ : undefined
102
+ })
86
103
  }, $projection: Object.assign({}, params.$projection) }));
87
104
  if (seats.length > 0) {
88
105
  const availabilities = yield repos.stockHolder.searchHolders({
@@ -99,31 +116,6 @@ function searchEventSeatOffersWithPaging(params) {
99
116
  };
100
117
  })
101
118
  });
102
- // ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
103
- // const uniqueSeatingTypes = await repos.seat.aggregateSeatingTypes({
104
- // project: { id: { $eq: event.project.id } },
105
- // containedInPlace: {
106
- // containedInPlace: {
107
- // branchCode: { $eq: roomBranchCode },
108
- // containedInPlace: { branchCode: { $eq: movieTheaterBranchCode } }
109
- // }
110
- // }
111
- // });
112
- // 座席タイプ価格仕様を検索
113
- // let priceSpecs: ICategoryCodeChargeSpecification[] = [];
114
- // if (!excludePriceSpecification) {
115
- // if (Array.isArray(uniqueSeatingTypes) && uniqueSeatingTypes.length > 0) {
116
- // priceSpecs =
117
- // await repos.priceSpecification.search<factory.priceSpecificationType.CategoryCodeChargeSpecification>({
118
- // project: { id: { $eq: event.project.id } },
119
- // typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
120
- // appliesToCategoryCode: {
121
- // inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } },
122
- // codeValue: { $in: uniqueSeatingTypes } // ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
123
- // }
124
- // });
125
- // }
126
- // }
127
119
  offers = seats.map((seat, index) => {
128
120
  return addOffers2Seat({
129
121
  seat,
@@ -144,10 +136,19 @@ function searchEventSeatOffersWithPaging(params) {
144
136
  function findEventSeatOffersBySection(params) {
145
137
  return (repos) => __awaiter(this, void 0, void 0, function* () {
146
138
  var _a, _b, _c, _d, _e, _f;
147
- const { limit, page, projectId, eventId, sectionCode } = params;
139
+ const { limit, page, projectId, sellerId, eventId, sectionCode } = params;
148
140
  let offers = [];
149
- // optimize(2024-07-18~)
150
- const event = yield repos.event.projectEventFieldsById({ id: eventId }, ['startDate', 'offers.itemOffered']);
141
+ const event = (yield repos.event.projectEventFields({
142
+ limit: 1,
143
+ page: 1,
144
+ project: { id: { $eq: projectId } },
145
+ organizer: { id: { $eq: sellerId } },
146
+ id: { $eq: eventId },
147
+ typeOf: factory.eventType.ScreeningEvent
148
+ }, ['startDate', 'offers.itemOffered'])).shift();
149
+ if (event === undefined) {
150
+ throw new factory.errors.NotFound(factory.eventType.ScreeningEvent);
151
+ }
151
152
  // 座席指定利用可能かどうか
152
153
  const eventOffers = event.offers;
153
154
  const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
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": "23.1.0-alpha.32"
118
+ "version": "23.1.0-alpha.34"
119
119
  }