@chevre/domain 23.2.0-alpha.25 → 23.2.0-alpha.27

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.
@@ -22,9 +22,7 @@ async function main() {
22
22
  typeOf: chevre.factory.offerType.Offer,
23
23
  eligibleQuantity: { maxValue: 6, unitCode: chevre.factory.unitCode.C62, typeOf: 'QuantitativeValue' },
24
24
  availabilityEndsGraceTime: { value: 6, unitCode: chevre.factory.unitCode.Sec, typeOf: 'QuantitativeValue' },
25
- availabilityStartsGraceTime: { value: 6, unitCode: chevre.factory.unitCode.Day, typeOf: 'QuantitativeValue' },
26
- availabilityEndsGraceTimeOnPOS: { value: 6, unitCode: chevre.factory.unitCode.Sec, typeOf: 'QuantitativeValue' },
27
- availabilityStartsGraceTimeOnPOS: { value: 6, unitCode: chevre.factory.unitCode.Day, typeOf: 'QuantitativeValue' }
25
+ availabilityStartsGraceTime: { value: 6, unitCode: chevre.factory.unitCode.Day, typeOf: 'QuantitativeValue' }
28
26
  }
29
27
 
30
28
  }
@@ -9,16 +9,20 @@ import { chevre } from '../../../lib/index';
9
9
  async function main() {
10
10
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
11
 
12
- const noteRepo = await chevre.repository.NoteAboutOrder.createInstance(mongoose.connection);
12
+ const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
13
13
 
14
14
  let updateResult: any;
15
15
 
16
- updateResult = await noteRepo.unsetUnnecessaryFields({
16
+ updateResult = await movieTheaterRepo.unsetUnnecessaryFields({
17
17
  filter: {
18
- 'about.identifier': { $exists: true }
18
+ $or: [
19
+ { 'offers.availabilityStartsGraceTimeOnPOS': { $exists: true } },
20
+ { 'offers.availabilityEndsGraceTimeOnPOS': { $exists: true } }
21
+ ]
19
22
  },
20
23
  $unset: {
21
- 'about.identifier': 1
24
+ 'offers.availabilityStartsGraceTimeOnPOS': 1,
25
+ 'offers.availabilityEndsGraceTimeOnPOS': 1
22
26
  }
23
27
  });
24
28
  console.log(updateResult);
@@ -23,10 +23,7 @@ function minimizeSuperEvent(params) {
23
23
  // ? { kanaName: params.superEventFromDB.location.kanaName }
24
24
  // : undefined
25
25
  );
26
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.eventType.ScreeningEventSeries,
27
- // 不要なので廃止(2023-06-09~)
28
- // project: { typeOf: chevre.factory.organizationType.Project, id: params.project.id },
29
- id: params.superEventFromDB.id, videoFormat: params.superEventFromDB.videoFormat, soundFormat: params.superEventFromDB.soundFormat, workPerformed,
26
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.eventType.ScreeningEventSeries, id: params.superEventFromDB.id, soundFormat: params.superEventFromDB.soundFormat, workPerformed,
30
27
  location, kanaName: params.superEventFromDB.kanaName, name: Object.assign(Object.assign({}, (typeof params.superEventFromDB.name.en === 'string') ? { en: params.superEventFromDB.name.en } : undefined), (typeof params.superEventFromDB.name.ja === 'string') ? { ja: params.superEventFromDB.name.ja } : undefined) }, (Array.isArray(params.superEventFromDB.additionalProperty))
31
28
  ? { additionalProperty: params.superEventFromDB.additionalProperty }
32
29
  : undefined), (params.superEventFromDB.startDate instanceof Date)
@@ -41,5 +38,8 @@ function minimizeSuperEvent(params) {
41
38
  ? { dubLanguage: params.superEventFromDB.dubLanguage }
42
39
  : undefined), (params.superEventFromDB.subtitleLanguage !== undefined)
43
40
  ? { subtitleLanguage: params.superEventFromDB.subtitleLanguage }
44
- : undefined);
41
+ : undefined), {
42
+ // 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
43
+ videoFormat: params.superEventFromDB.videoFormat
44
+ });
45
45
  }
@@ -157,7 +157,9 @@ class MovieTheaterRepo {
157
157
  const filter = {
158
158
  typeOf: { $eq: factory.placeType.MovieTheater },
159
159
  'project.id': { $eq: project.id },
160
- branchCode: { $eq: branchCode }
160
+ branchCode: { $eq: branchCode },
161
+ // プロジェクトとコードでユニークな仕様だが、販売者も指定する -> 異なる販売者でコードが重複すればDuplicateErrorとなる
162
+ 'parentOrganization.id': { $exists: true, $eq: sellerId }
161
163
  };
162
164
  const initialMovieTheater = {
163
165
  typeOf: factory.placeType.MovieTheater,
@@ -36,9 +36,9 @@ function createReservationFor(params, useOptimizeReservation) {
36
36
  }
37
37
  function optimizeReservationSuperEvent(params, useOptimizeReservation) {
38
38
  const superEvent = params.superEvent;
39
- return Object.assign(Object.assign({ id: superEvent.id,
39
+ return Object.assign(Object.assign(Object.assign({ id: superEvent.id,
40
40
  // kanaName: superEvent.kanaName, // 廃止(2024-01-26~)
41
- location: superEvent.location, name: superEvent.name, soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, videoFormat: superEvent.videoFormat, workPerformed: superEvent.workPerformed }, (superEvent.headline !== undefined)
41
+ location: superEvent.location, name: superEvent.name, soundFormat: superEvent.soundFormat, typeOf: superEvent.typeOf, workPerformed: superEvent.workPerformed }, (superEvent.headline !== undefined)
42
42
  ? { headline: superEvent.headline }
43
43
  : undefined), (useOptimizeReservation)
44
44
  ? {}
@@ -46,7 +46,10 @@ function optimizeReservationSuperEvent(params, useOptimizeReservation) {
46
46
  additionalProperty: (Array.isArray(superEvent.additionalProperty))
47
47
  ? superEvent.additionalProperty
48
48
  : []
49
- });
49
+ }), {
50
+ // 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
51
+ videoFormat: superEvent.videoFormat
52
+ });
50
53
  }
51
54
  function createIssuedThrough(params) {
52
55
  var _a;
@@ -124,17 +124,19 @@ function createMovieTheaterFromCOA(project, seller, theaterFromCOA, screensFromC
124
124
  typeOf: 'QuantitativeValue',
125
125
  value: 1200,
126
126
  unitCode: factory.unitCode.Sec
127
- },
128
- availabilityStartsGraceTimeOnPOS: {
129
- typeOf: 'QuantitativeValue',
130
- value: -93,
131
- unitCode: factory.unitCode.Day
132
- },
133
- availabilityEndsGraceTimeOnPOS: {
134
- typeOf: 'QuantitativeValue',
135
- value: 2678400,
136
- unitCode: factory.unitCode.Sec
137
127
  }
128
+ // discontinue(2026-01-15~)
129
+ // availabilityStartsGraceTimeOnPOS: {
130
+ // typeOf: 'QuantitativeValue',
131
+ // value: -93,
132
+ // unitCode: factory.unitCode.Day
133
+ // },
134
+ // discontinue(2026-01-15~)
135
+ // availabilityEndsGraceTimeOnPOS: {
136
+ // typeOf: 'QuantitativeValue',
137
+ // value: 2678400,
138
+ // unitCode: factory.unitCode.Sec
139
+ // }
138
140
  },
139
141
  parentOrganization: { id: seller.id, typeOf: factory.organizationType.Corporation }
140
142
  };
@@ -178,13 +178,14 @@ function minimizeSuperEvent(params) {
178
178
  // offers,
179
179
  // eventStatus
180
180
  } = params.superEvent;
181
- return {
182
- workPerformed, videoFormat, startDate, soundFormat,
181
+ return Object.assign({ workPerformed, startDate, soundFormat,
183
182
  name, location, kanaName, identifier,
184
183
  endDate, duration, coaInfo, alternativeHeadline,
185
184
  // additionalProperty,
186
- typeOf, id
187
- };
185
+ typeOf, id }, {
186
+ // 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
187
+ videoFormat
188
+ });
188
189
  }
189
190
  /**
190
191
  * コアデータからイベントを作成する
@@ -297,7 +297,10 @@ function createReservation(params) {
297
297
  startDate: moment(event.startDate)
298
298
  .toDate(),
299
299
  // 最適化(2022-05-31~)
300
- superEvent: Object.assign(Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, videoFormat: event.superEvent.videoFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined)
300
+ superEvent: Object.assign(Object.assign(Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined), {
301
+ // 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
302
+ videoFormat: event.superEvent.videoFormat
303
+ })
301
304
  };
302
305
  if (params.issuedThrough.typeOf !== factory.product.ProductType.EventService) {
303
306
  throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.EventService}`);
@@ -122,19 +122,10 @@ function responseBody2acceptedOffers4result(params) {
122
122
  branchCode: event.location.branchCode,
123
123
  name: event.location.name
124
124
  }, name: event.name, startDate: moment(event.startDate)
125
- .toDate(), superEvent: {
126
- typeOf: event.superEvent.typeOf,
127
- id: event.superEvent.id,
128
- identifier: event.superEvent.identifier,
129
- name: event.superEvent.name,
130
- alternativeHeadline: event.superEvent.alternativeHeadline,
131
- location: event.superEvent.location,
132
- videoFormat: event.superEvent.videoFormat,
133
- soundFormat: event.superEvent.soundFormat,
134
- workPerformed: workPerformed,
135
- duration: event.superEvent.duration,
136
- coaInfo: event.superEvent.coaInfo
137
- }, id: event.id });
125
+ .toDate(), superEvent: Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, identifier: event.superEvent.identifier, name: event.superEvent.name, alternativeHeadline: event.superEvent.alternativeHeadline, location: event.superEvent.location, soundFormat: event.superEvent.soundFormat, workPerformed: workPerformed, duration: event.superEvent.duration, coaInfo: event.superEvent.coaInfo }, {
126
+ // 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
127
+ videoFormat: event.superEvent.videoFormat
128
+ }), id: event.id });
138
129
  const ticketNumber = util.format('%s:%s:%s', reservationFor.id, tmpReserve.seatSection, tmpReserve.seatNum);
139
130
  const ticketedSeat = {
140
131
  typeOf: factory.placeType.Seat,
@@ -50,6 +50,11 @@ export declare function searchEventSeatOffersWithPaging(params: {
50
50
  };
51
51
  $projection?: factory.place.seat.IProjection;
52
52
  options: {
53
+ /**
54
+ * レスポンスにセクションコードを含める要素をひとつめのみにするかどうか
55
+ * 2026-01-14~
56
+ */
57
+ includeSectionCodeOnlyFirstElement: boolean;
53
58
  /**
54
59
  * 自動的にひとつめのセクションに絞るかどうか
55
60
  */
@@ -61,7 +61,7 @@ function searchEventSeatOffersWithPaging(params) {
61
61
  // tslint:disable-next-line:max-func-body-length
62
62
  return (repos) => __awaiter(this, void 0, void 0, function* () {
63
63
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
64
- const { useDefaultSection } = params.options;
64
+ const { includeSectionCodeOnlyFirstElement, useDefaultSection } = params.options;
65
65
  let offers = [];
66
66
  // optimize(2024-07-18~)
67
67
  const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, ['project', 'startDate', 'offers.itemOffered', 'organizer']);
@@ -117,9 +117,21 @@ function searchEventSeatOffersWithPaging(params) {
117
117
  })
118
118
  });
119
119
  offers = seats.map(({ branchCode, name, containedInPlace, seatingType }, index) => {
120
- // デフォルトセクション指定の場合、first elementのみセクションコードを含める
121
- const includeSectionCode = !useDefaultSection
122
- || (useDefaultSection && index === 0);
120
+ let includeSectionCode = false;
121
+ if (includeSectionCodeOnlyFirstElement) {
122
+ if (useDefaultSection) {
123
+ // デフォルトセクション指定の場合、first elementのみセクションコードを含める
124
+ if (index === 0) {
125
+ includeSectionCode = true;
126
+ }
127
+ }
128
+ else {
129
+ includeSectionCode = true;
130
+ }
131
+ }
132
+ else {
133
+ includeSectionCode = true;
134
+ }
123
135
  return Object.assign({ branchCode,
124
136
  name,
125
137
  seatingType,
@@ -93,7 +93,9 @@ function tour2creatingEvent(tour, movieTheater, screeningRoom, existingApplicati
93
93
  } }, { name: { ja: (typeof eventService.name === 'string') ? eventService.name : String((_a = eventService.name) === null || _a === void 0 ? void 0 : _a.ja) } }),
94
94
  seller: offersSeller
95
95
  };
96
- const screeningEventSuperEvent = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: screeningEventSeries.typeOf, id: screeningEventSeries.id, videoFormat: screeningEventSeries.videoFormat, soundFormat: screeningEventSeries.soundFormat, workPerformed: screeningEventSeries.workPerformed, location: screeningEventSeries.location, kanaName: screeningEventSeries.kanaName, name: screeningEventSeries.name }, (Array.isArray(screeningEventSeries.additionalProperty))
96
+ const screeningEventSuperEvent = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: screeningEventSeries.typeOf, id: screeningEventSeries.id,
97
+ // videoFormat: screeningEventSeries.videoFormat, // discontinue(2026-01-15~)
98
+ soundFormat: screeningEventSeries.soundFormat, workPerformed: screeningEventSeries.workPerformed, location: screeningEventSeries.location, kanaName: screeningEventSeries.kanaName, name: screeningEventSeries.name }, (Array.isArray(screeningEventSeries.additionalProperty))
97
99
  ? { additionalProperty: screeningEventSeries.additionalProperty }
98
100
  : undefined), (screeningEventSeries.startDate !== undefined)
99
101
  ? { startDate: screeningEventSeries.startDate }
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": "5.4.0-alpha.14",
15
- "@cinerino/sdk": "12.12.1",
14
+ "@chevre/factory": "5.4.0-alpha.16",
15
+ "@cinerino/sdk": "12.13.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",
@@ -116,5 +116,5 @@
116
116
  "postversion": "git push origin --tags",
117
117
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
118
118
  },
119
- "version": "23.2.0-alpha.25"
119
+ "version": "23.2.0-alpha.27"
120
120
  }
@@ -1,191 +0,0 @@
1
- // tslint:disable:no-console no-magic-numbers
2
- import * as moment from 'moment-timezone';
3
- import * as mongoose from 'mongoose';
4
-
5
- import { chevre } from '../../../../lib/index';
6
-
7
- const project = { id: String(process.env.PROJECT_ID) };
8
- const ADDITIONAL_PROPERTY_NAME = 'sampleCreateId';
9
-
10
- // tslint:disable-next-line:max-func-body-length
11
- async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
-
14
- const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
15
-
16
- const today = moment()
17
- .tz('Asia/Tokyo')
18
- .format('YYYY-MM-DD');
19
- const identifier = `fromSamples:${moment()
20
- .format('YYYY-MM-DD HH:mm')}`;
21
- const settingEvent: chevre.factory.event.screeningEvent.IAttributes = {
22
- identifier,
23
- additionalProperty: [
24
- { name: ADDITIONAL_PROPERTY_NAME, value: identifier }
25
- ],
26
- project: {
27
- id: project.id,
28
- typeOf: chevre.factory.organizationType.Project
29
- },
30
- organizer: {
31
- id: '59d20831e53ebc2b4e774466'
32
- },
33
- typeOf: chevre.factory.eventType.ScreeningEvent,
34
- name: {
35
- en: 'pet IMAX2D',
36
- ja: 'ペット IMAX2D'
37
- },
38
- doorTime: moment(`${today}T13:00:00Z`)
39
- .toDate(),
40
- startDate: moment(`${today}T13:00:00Z`)
41
- .toDate(),
42
- endDate: moment(`${today}T14:00:00Z`)
43
- .toDate(),
44
- eventStatus: chevre.factory.eventStatusType.EventScheduled,
45
- location: {
46
- typeOf: chevre.factory.placeType.ScreeningRoom,
47
- branchCode: '70',
48
- name: {
49
- ja: 'シネマ7',
50
- en: 'CINEMA7'
51
- },
52
- address: {
53
- ja: '',
54
- en: ''
55
- }
56
- },
57
- superEvent: {
58
- typeOf: chevre.factory.eventType.ScreeningEventSeries,
59
- id: 'al9s38bj6',
60
- videoFormat: [
61
- {
62
- typeOf: '2D',
63
- name: '2D'
64
- },
65
- {
66
- typeOf: 'IMAX',
67
- name: 'IMAX'
68
- }
69
- ],
70
- soundFormat: [],
71
- workPerformed: {
72
- typeOf: chevre.factory.creativeWorkType.Movie,
73
- identifier: '1622100',
74
- id: '5bfb841d5a78d7948369980a',
75
- name: {
76
- en: 'Pet',
77
- ja: 'ペット'
78
- },
79
- duration: 'PT2H3M'
80
- },
81
- location: {
82
- typeOf: chevre.factory.placeType.MovieTheater,
83
- id: '5bfb841d5a78d7948369979a',
84
- branchCode: '118',
85
- name: {
86
- ja: 'シネモーション赤坂 ',
87
- en: 'CineMotion Akasaka'
88
- }
89
- },
90
- kanaName: 'ペット IMAX2D',
91
- name: {
92
- en: 'pet IMAX2D',
93
- ja: 'ペット IMAX2D'
94
- },
95
- additionalProperty: [],
96
- startDate: moment('2022-09-30T15:00:00.000Z')
97
- .toDate(),
98
- endDate: moment('2029-07-31T15:00:00.000Z')
99
- .toDate(),
100
- headline: {
101
- ja: 'IMAX2D上映'
102
- }
103
- },
104
- offers: {
105
- typeOf: chevre.factory.offerType.Offer,
106
- eligibleQuantity: {
107
- typeOf: 'QuantitativeValue',
108
- unitCode: chevre.factory.unitCode.C62,
109
- maxValue: 6
110
- },
111
- itemOffered: {
112
- id: '655dc6b02cbb99d946cb6081',
113
- name: {
114
- ja: '通常興行カタログ(サブカタログ版)'
115
- },
116
- serviceOutput: {
117
- typeOf: chevre.factory.reservationType.EventReservation,
118
- reservedTicket: {
119
- typeOf: 'Ticket',
120
- ticketedSeat: {
121
- typeOf: chevre.factory.placeType.Seat
122
- }
123
- }
124
- },
125
- typeOf: chevre.factory.product.ProductType.EventService,
126
- availableChannel: {
127
- typeOf: 'ServiceChannel',
128
- serviceLocation: {
129
- typeOf: chevre.factory.placeType.ScreeningRoom,
130
- branchCode: '70',
131
- name: {
132
- ja: 'シネマ7',
133
- en: 'CINEMA7'
134
- },
135
- containedInPlace: {
136
- typeOf: chevre.factory.placeType.MovieTheater,
137
- id: '5bfb841d5a78d7948369979a',
138
- branchCode: '118',
139
- name: {
140
- ja: 'シネモーション赤坂 ',
141
- en: 'CineMotion Akasaka'
142
- }
143
- }
144
- }
145
- }
146
- },
147
- seller: {
148
- typeOf: chevre.factory.organizationType.Corporation,
149
- id: '59d20831e53ebc2b4e774466',
150
- name: {
151
- ja: 'シネモーション赤坂',
152
- en: 'CineMotion Akasaka'
153
- },
154
- makesOffer: [
155
- ]
156
- }
157
- }
158
- };
159
-
160
- const createResult = await eventRepo.upsertManyScreeningEventByIdentifier(
161
- [
162
- {
163
- $set: settingEvent,
164
- $unset: {}
165
- }
166
- ],
167
- { update: false }
168
- );
169
- // tslint:disable-next-line:no-null-keyword
170
- console.dir(createResult, { depth: null });
171
-
172
- const updateResult = await eventRepo.upsertManyScreeningEventByIdentifier(
173
- [
174
- {
175
- $set: {
176
- ...settingEvent,
177
- eventStatus: chevre.factory.eventStatusType.EventCancelled
178
- },
179
- $unset: {}
180
- }
181
- ],
182
- { update: true }
183
- );
184
- // tslint:disable-next-line:no-null-keyword
185
- console.dir(updateResult, { depth: null });
186
-
187
- }
188
-
189
- main()
190
- .then()
191
- .catch(console.error);