@chevre/domain 22.6.0-alpha.25 → 22.6.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.
@@ -20,7 +20,7 @@ async function main() {
20
20
  if (findOneIdResult === null) {
21
21
  if (typeof COA_ENDPOINT === 'string' && typeof COA_REFRESH_TOKEN === 'string') {
22
22
  await interfaceRepo.saveOne({
23
- project: { id: 'sskts-development', typeOf: chevre.factory.organizationType.Project },
23
+ project: { id: 'xxx', typeOf: chevre.factory.organizationType.Project },
24
24
  availableChannel: {
25
25
  typeOf: 'ServiceChannel',
26
26
  credentials: {
@@ -30,14 +30,7 @@ async function main() {
30
30
  },
31
31
  importEventsInWeeks: 5,
32
32
  excludeMovieTheaters: [
33
- '102',
34
- '106',
35
- '108',
36
- '113',
37
- '114',
38
- '115',
39
- '116',
40
- '121'
33
+ '007'
41
34
  ]
42
35
  },
43
36
  typeOf: 'WebAPI'
@@ -1,6 +1,6 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import * as factory from '../../../factory';
3
- type IDocType = factory.schedule.ISchedule4ttts | factory.schedule.IEventWithSchedule;
3
+ type IDocType = factory.schedule.IEventWithSchedule;
4
4
  type IModel = Model<IDocType>;
5
5
  type ISchemaDefinition = SchemaDefinition<IDocType>;
6
6
  type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
@@ -6,7 +6,6 @@ import * as factory from '../factory';
6
6
  export declare class ScheduleRepo {
7
7
  private readonly scheduleModel;
8
8
  constructor(connection: Connection);
9
- saveOne(params: factory.schedule.ISchedule4ttts): Promise<void>;
10
9
  findOne(filter: {
11
10
  id?: {
12
11
  $eq?: string;
@@ -16,8 +15,8 @@ export declare class ScheduleRepo {
16
15
  $eq?: string;
17
16
  };
18
17
  };
19
- }): Promise<factory.schedule.ISchedule4ttts | factory.schedule.IEventWithSchedule | null>;
20
- findOneId(): Promise<(Pick<factory.schedule.ISchedule4ttts, 'project'> & {
18
+ }): Promise<factory.schedule.IEventWithSchedule | null>;
19
+ findOneId(): Promise<(Pick<factory.schedule.IEventWithSchedule, 'project'> & {
21
20
  id: string;
22
21
  }) | null>;
23
22
  }
@@ -18,11 +18,9 @@ class ScheduleRepo {
18
18
  constructor(connection) {
19
19
  this.scheduleModel = connection.model(schedule_1.modelName, (0, schedule_1.createSchema)());
20
20
  }
21
- saveOne(params) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- yield this.scheduleModel.create(params);
24
- });
25
- }
21
+ // public async saveOne(params: factory.schedule.IEventWithSchedule): Promise<void> {
22
+ // await this.scheduleModel.create(params);
23
+ // }
26
24
  findOne(filter) {
27
25
  var _a, _b, _c;
28
26
  return __awaiter(this, void 0, void 0, function* () {
@@ -16,7 +16,9 @@ const moment = require("moment-timezone");
16
16
  const factory = require("../../../factory");
17
17
  const event_1 = require("../../event");
18
18
  const debug = createDebug('chevre-domain:service:task');
19
- function createEvents(schedule, createDate) {
19
+ function createEvents(
20
+ // schedule: factory.schedule.ISchedule4ttts | factory.schedule.IEventWithSchedule,
21
+ schedule, createDate) {
20
22
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
21
23
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
22
24
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -36,9 +38,10 @@ function createEvents(schedule, createDate) {
36
38
  }
37
39
  const project = schedule.project;
38
40
  // 引数情報取得
39
- const targetInfo = (schedule.eventSchedule !== undefined)
40
- ? getTargetInfoByEventWithSchedule(schedule, createDate)
41
- : getTargetInfoForCreateFromSetting(schedule, createDate);
41
+ if (schedule.eventSchedule === undefined) {
42
+ throw new factory.errors.NotFound('eventSchedule');
43
+ }
44
+ const targetInfo = getTargetInfoByEventWithSchedule(schedule, createDate);
42
45
  debug(targetInfo.length, 'targetInfos ->', targetInfo);
43
46
  // fs.writeFileSync(
44
47
  // `${__dirname}/../../../../../targetInfo_${schedule.eventSchedule?.typeOf}.json`,
@@ -230,64 +233,62 @@ function createEvents(schedule, createDate) {
230
233
  /**
231
234
  * パフォーマンス作成・作成対象情報取得
232
235
  */
233
- function getTargetInfoForCreateFromSetting(settings, createDate) {
234
- const performanceInfos = [];
235
- const { days, duration, noPerformanceTimes, hours, minutes, tours } = settings;
236
- // 作成対象時間: 9,10,11など
237
- // const hours: string[] = ['9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22'];
238
- // 作成開始が今日から何日後か: 30
239
- // const start: number = 91;
240
- // 何日分作成するか: 7
241
- // const days: number = 1;
242
- // const minutes = ['00', '15', '30', '45'];
243
- // const tours = ['1', '2', '3', '4'];
244
- // 本日日付+開始日までの日数から作成開始日セット
245
- // 作成日数分の作成対象日付作成
246
- for (let index = 0; index < days; index = index + 1) {
247
- const now = (createDate instanceof Date)
248
- ? moment(createDate)
249
- .add(index, 'days')
250
- : moment()
251
- .add(index, 'days');
252
- hours.forEach((hourStr) => {
253
- // 2桁でない時は'0'詰め
254
- // tslint:disable-next-line:no-magic-numbers
255
- const hour = `0${hourStr}`.slice(-2);
256
- minutes.forEach((minute, minuteIndex) => {
257
- // ツアー情報作成
258
- const tourNumber = `${hour}${tours[minuteIndex]}`;
259
- const startDate = moment(`${now.tz('Asia/Tokyo')
260
- .format('YYYYMMDD')} ${hour}:${minute}:00+09:00`, 'YYYYMMDD HH:mm:ssZ');
261
- const endDate = moment(startDate)
262
- .add(duration, 'minutes');
263
- const day = moment(startDate)
264
- .tz('Asia/Tokyo')
265
- .format('YYYYMMDD');
266
- const startTime = moment(startDate)
267
- .tz('Asia/Tokyo')
268
- .format('HHmm');
269
- const endTime = moment(endDate)
270
- .tz('Asia/Tokyo')
271
- .format('HHmm');
272
- // パフォーマンスを作成しない時刻に指定されていなかったら作成
273
- if (noPerformanceTimes.indexOf(`${hour}${minute}`) < 0) {
274
- performanceInfos.push({
275
- day: day,
276
- start_time: startTime,
277
- end_time: endTime,
278
- door_time: startDate.toDate(),
279
- start_date: startDate.toDate(),
280
- end_date: endDate.toDate(),
281
- tour_number: tourNumber,
282
- duration: moment.duration(duration, 'minutes')
283
- .toISOString()
284
- });
285
- }
286
- });
287
- });
288
- }
289
- return performanceInfos;
290
- }
236
+ // function getTargetInfoForCreateFromSetting(
237
+ // settings: factory.schedule.ISchedule4ttts,
238
+ // createDate: Date
239
+ // ): ITargetPerformanceInfo[] {
240
+ // const performanceInfos: ITargetPerformanceInfo[] = [];
241
+ // const { days, duration, noPerformanceTimes, hours, minutes, tours } = settings;
242
+ // // 本日日付+開始日までの日数から作成開始日セット
243
+ // // 作成日数分の作成対象日付作成
244
+ // for (let index = 0; index < days; index = index + 1) {
245
+ // const now = (createDate instanceof Date)
246
+ // ? moment(createDate)
247
+ // .add(index, 'days')
248
+ // : moment()
249
+ // .add(index, 'days');
250
+ // hours.forEach((hourStr) => {
251
+ // // 2桁でない時は'0'詰め
252
+ // // tslint:disable-next-line:no-magic-numbers
253
+ // const hour = `0${hourStr}`.slice(-2);
254
+ // minutes.forEach((minute, minuteIndex) => {
255
+ // // ツアー情報作成
256
+ // const tourNumber = `${hour}${tours[minuteIndex]}`;
257
+ // const startDate = moment(
258
+ // `${now.tz('Asia/Tokyo')
259
+ // .format('YYYYMMDD')} ${hour}:${minute}:00+09:00`,
260
+ // 'YYYYMMDD HH:mm:ssZ'
261
+ // );
262
+ // const endDate = moment(startDate)
263
+ // .add(duration, 'minutes');
264
+ // const day = moment(startDate)
265
+ // .tz('Asia/Tokyo')
266
+ // .format('YYYYMMDD');
267
+ // const startTime = moment(startDate)
268
+ // .tz('Asia/Tokyo')
269
+ // .format('HHmm');
270
+ // const endTime = moment(endDate)
271
+ // .tz('Asia/Tokyo')
272
+ // .format('HHmm');
273
+ // // パフォーマンスを作成しない時刻に指定されていなかったら作成
274
+ // if (noPerformanceTimes.indexOf(`${hour}${minute}`) < 0) {
275
+ // performanceInfos.push({
276
+ // day: day,
277
+ // start_time: startTime,
278
+ // end_time: endTime,
279
+ // door_time: startDate.toDate(),
280
+ // start_date: startDate.toDate(),
281
+ // end_date: endDate.toDate(),
282
+ // tour_number: tourNumber,
283
+ // duration: moment.duration(duration, 'minutes')
284
+ // .toISOString()
285
+ // });
286
+ // }
287
+ // });
288
+ // });
289
+ // }
290
+ // return performanceInfos;
291
+ // }
291
292
  function getTargetInfoByEventWithSchedule(settings, createDate) {
292
293
  const performanceInfos = [];
293
294
  const { eventSchedule } = settings;
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.389.0-alpha.16",
14
+ "@chevre/factory": "4.389.0-alpha.18",
15
15
  "@cinerino/sdk": "10.16.0-alpha.9",
16
16
  "@motionpicture/coa-service": "9.5.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
@@ -108,5 +108,5 @@
108
108
  "postversion": "git push origin --tags",
109
109
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
110
110
  },
111
- "version": "22.6.0-alpha.25"
111
+ "version": "22.6.0-alpha.27"
112
112
  }