@chevre/domain 21.8.0-alpha.27 → 21.8.0-alpha.28

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.
@@ -16,6 +16,7 @@ async function main() {
16
16
 
17
17
  const categoryCodeRepo = new chevre.repository.CategoryCode(mongoose.connection);
18
18
  const offerRepo = new chevre.repository.Offer(mongoose.connection);
19
+ const taskRepo = new chevre.repository.Task(mongoose.connection);
19
20
  const masterService = new chevre.COA.service.Master(
20
21
  {
21
22
  endpoint: chevre.credentials.coa.endpoint,
@@ -27,7 +28,12 @@ async function main() {
27
28
  await chevre.service.offer.event.importFromCOA({
28
29
  project,
29
30
  theaterCode: '120'
30
- })({ categoryCode: categoryCodeRepo, offer: offerRepo, masterService });
31
+ })({
32
+ categoryCode: categoryCodeRepo,
33
+ offer: offerRepo,
34
+ task: taskRepo,
35
+ masterService
36
+ });
31
37
  console.log('imported');
32
38
  }
33
39
 
@@ -0,0 +1,23 @@
1
+ // tslint:disable:no-console
2
+ // import * as redis from 'redis';
3
+ import * as mongoose from 'mongoose';
4
+
5
+ import { chevre } from '../../../lib/index';
6
+
7
+ const project = { id: String(process.env.PROJECT_ID) };
8
+
9
+ async function main() {
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
+
12
+ const offerRepo = new chevre.repository.Offer(mongoose.connection);
13
+
14
+ const result = await offerRepo.sync2aggregateOffer({
15
+ project: { id: project.id },
16
+ identifier: { $in: ['COA-120-15'] }
17
+ });
18
+ console.log(result);
19
+ }
20
+
21
+ main()
22
+ .then(console.log)
23
+ .catch(console.error);
@@ -0,0 +1,71 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import { Schema } from 'mongoose';
26
+ declare const modelName = "AggregateOffer";
27
+ /**
28
+ * 集計オファースキーマ
29
+ */
30
+ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
31
+ collection: string;
32
+ id: true;
33
+ read: string;
34
+ writeConcern: import("mongodb").WriteConcern;
35
+ strict: true;
36
+ strictQuery: false;
37
+ timestamps: {
38
+ createdAt: string;
39
+ updatedAt: string;
40
+ };
41
+ toJSON: {
42
+ getters: false;
43
+ virtuals: false;
44
+ minimize: false;
45
+ versionKey: false;
46
+ };
47
+ toObject: {
48
+ getters: false;
49
+ virtuals: true;
50
+ minimize: false;
51
+ versionKey: false;
52
+ };
53
+ }, {
54
+ offers: any[];
55
+ _id?: string | undefined;
56
+ typeOf?: string | undefined;
57
+ project?: any;
58
+ }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
59
+ offers: any[];
60
+ _id?: string | undefined;
61
+ typeOf?: string | undefined;
62
+ project?: any;
63
+ }>> & Omit<import("mongoose").FlatRecord<{
64
+ offers: any[];
65
+ _id?: string | undefined;
66
+ typeOf?: string | undefined;
67
+ project?: any;
68
+ }> & Required<{
69
+ _id: string;
70
+ }>, never>>;
71
+ export { modelName, schema };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.schema = exports.modelName = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const writeConcern_1 = require("../writeConcern");
6
+ const modelName = 'AggregateOffer';
7
+ exports.modelName = modelName;
8
+ /**
9
+ * 集計オファースキーマ
10
+ */
11
+ const schema = new mongoose_1.Schema({
12
+ project: mongoose_1.SchemaTypes.Mixed,
13
+ _id: String,
14
+ typeOf: String,
15
+ offers: [mongoose_1.SchemaTypes.Mixed]
16
+ }, {
17
+ collection: 'aggregateOffers',
18
+ id: true,
19
+ read: 'primaryPreferred',
20
+ writeConcern: writeConcern_1.writeConcern,
21
+ strict: true,
22
+ strictQuery: false,
23
+ timestamps: {
24
+ createdAt: 'createdAt',
25
+ updatedAt: 'updatedAt'
26
+ },
27
+ toJSON: {
28
+ getters: false,
29
+ virtuals: false,
30
+ minimize: false,
31
+ versionKey: false
32
+ },
33
+ toObject: {
34
+ getters: false,
35
+ virtuals: true,
36
+ minimize: false,
37
+ versionKey: false
38
+ }
39
+ });
40
+ exports.schema = schema;
41
+ schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
42
+ schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
@@ -52,7 +52,6 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
52
52
  };
53
53
  }, {
54
54
  additionalProperty: any[];
55
- offers: any[];
56
55
  addOn: any[];
57
56
  availability: string;
58
57
  availableAtOrFrom: any[];
@@ -84,7 +83,6 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
84
83
  validRateLimit?: any;
85
84
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
86
85
  additionalProperty: any[];
87
- offers: any[];
88
86
  addOn: any[];
89
87
  availability: string;
90
88
  availableAtOrFrom: any[];
@@ -116,7 +114,6 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
116
114
  validRateLimit?: any;
117
115
  }>> & Omit<import("mongoose").FlatRecord<{
118
116
  additionalProperty: any[];
119
- offers: any[];
120
117
  addOn: any[];
121
118
  availability: string;
122
119
  availableAtOrFrom: any[];
@@ -29,7 +29,7 @@ const schema = new mongoose_1.Schema({
29
29
  availableAtOrFrom: [mongoose_1.SchemaTypes.Mixed],
30
30
  hasMerchantReturnPolicy: mongoose_1.SchemaTypes.Mixed,
31
31
  itemOffered: mongoose_1.SchemaTypes.Mixed,
32
- offers: [mongoose_1.SchemaTypes.Mixed],
32
+ // offers: [SchemaTypes.Mixed],
33
33
  priceCurrency: String,
34
34
  priceSpecification: mongoose_1.SchemaTypes.Mixed,
35
35
  eligibleCustomerType: mongoose_1.SchemaTypes.Mixed,
@@ -22,6 +22,7 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ import { BulkWriteResult as BulkWriteOpResultObject } from 'mongodb';
25
26
  import { Connection } from 'mongoose';
26
27
  import * as factory from '../factory';
27
28
  interface IProjection {
@@ -31,6 +32,7 @@ interface IProjection {
31
32
  * オファーリポジトリ
32
33
  */
33
34
  export declare class MongoRepository {
35
+ private readonly aggregateOfferModel;
34
36
  private readonly offerModel;
35
37
  private readonly offerCatalogModel;
36
38
  constructor(connection: Connection);
@@ -66,12 +68,12 @@ export declare class MongoRepository {
66
68
  }): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
67
69
  count(params: factory.unitPriceOffer.ISearchConditions): Promise<number>;
68
70
  search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<factory.unitPriceOffer.IUnitPriceOffer[]>;
69
- save(params: factory.aggregateOffer.IAggregateOffer): Promise<factory.aggregateOffer.IAggregateOffer>;
71
+ save(params: factory.unitPriceOffer.IUnitPriceOffer): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
70
72
  /**
71
73
  * sskts専用オファー保管
72
74
  */
73
75
  saveManyByIdentifier(params: {
74
- attributes: factory.aggregateOffer.IAggregateOffer;
76
+ attributes: factory.unitPriceOffer.IUnitPriceOffer;
75
77
  upsert?: boolean;
76
78
  }[]): Promise<void>;
77
79
  /**
@@ -102,5 +104,16 @@ export declare class MongoRepository {
102
104
  filter: any;
103
105
  $unset: any;
104
106
  }): Promise<import("mongodb").UpdateResult>;
107
+ sync2aggregateOffer(params: {
108
+ id?: {
109
+ $in: string[];
110
+ };
111
+ identifier?: {
112
+ $in: string[];
113
+ };
114
+ project: {
115
+ id: string;
116
+ };
117
+ }): Promise<BulkWriteOpResultObject | void>;
105
118
  }
106
119
  export {};
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const uniqid = require("uniqid");
25
25
  const factory = require("../factory");
26
+ const aggregateOffer_1 = require("./mongoose/schemas/aggregateOffer");
26
27
  const offer_1 = require("./mongoose/schemas/offer");
27
28
  const offerCatalog_1 = require("./mongoose/schemas/offerCatalog");
28
29
  const settings_1 = require("../settings");
@@ -31,6 +32,7 @@ const settings_1 = require("../settings");
31
32
  */
32
33
  class MongoRepository {
33
34
  constructor(connection) {
35
+ this.aggregateOfferModel = connection.model(aggregateOffer_1.modelName, aggregateOffer_1.schema);
34
36
  this.offerModel = connection.model(offer_1.modelName, offer_1.schema);
35
37
  this.offerCatalogModel = connection.model(offerCatalog_1.modelName, offerCatalog_1.schema);
36
38
  }
@@ -447,14 +449,9 @@ class MongoRepository {
447
449
  save(params) {
448
450
  return __awaiter(this, void 0, void 0, function* () {
449
451
  let doc;
450
- // AggregateOffer対応(2023-09-03~)
451
- if (!Array.isArray(params.offers) || params.offers.length === 0) {
452
- throw new factory.errors.ArgumentNull('aggregateOffer.offers');
453
- }
454
452
  if (params.id === '') {
455
453
  const id = uniqid();
456
- doc = yield this.offerModel.create(Object.assign(Object.assign({}, params), { _id: id, 'offers.id': id // AggregateOffer対応(2023-09-03~)
457
- }));
454
+ doc = yield this.offerModel.create(Object.assign(Object.assign({}, params), { _id: id }));
458
455
  }
459
456
  else {
460
457
  // 上書き禁止属性を除外(2022-08-24~)
@@ -476,10 +473,6 @@ class MongoRepository {
476
473
  const bulkWriteOps = [];
477
474
  if (Array.isArray(params)) {
478
475
  params.forEach((p) => {
479
- // AggregateOffer対応(2023-09-03~)
480
- if (!Array.isArray(p.attributes.offers) || p.attributes.offers.length === 0) {
481
- throw new factory.errors.ArgumentNull('aggregateOffer.offers');
482
- }
483
476
  const id = uniqid();
484
477
  const $set = Object.assign({}, p.attributes);
485
478
  if (typeof $set.id === 'string') {
@@ -499,8 +492,7 @@ class MongoRepository {
499
492
  update: {
500
493
  $set: $set,
501
494
  $setOnInsert: {
502
- _id: id,
503
- 'offers.id': id // AggregateOffer対応(2023-09-03~)
495
+ _id: id
504
496
  }
505
497
  },
506
498
  upsert: (p.upsert !== undefined) ? p.upsert : false
@@ -528,9 +520,6 @@ class MongoRepository {
528
520
  $pull: {
529
521
  addOn: {
530
522
  'itemOffered.id': { $in: params.addOn.itemOffered.id.$in }
531
- },
532
- 'offers.addOn': {
533
- 'itemOffered.id': { $in: params.addOn.itemOffered.id.$in } // AggregateOffer対応(2023-09-03~)
534
523
  }
535
524
  }
536
525
  })
@@ -562,5 +551,66 @@ class MongoRepository {
562
551
  .exec();
563
552
  });
564
553
  }
554
+ sync2aggregateOffer(params) {
555
+ var _a, _b;
556
+ return __awaiter(this, void 0, void 0, function* () {
557
+ let unitPriceOffers = [];
558
+ const idIn = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$in;
559
+ if (Array.isArray(idIn) && idIn.length > 0) {
560
+ unitPriceOffers = yield this.offerModel.find({
561
+ 'project.id': { $eq: params.project.id },
562
+ _id: { $in: idIn }
563
+ }, {
564
+ __v: 0,
565
+ createdAt: 0,
566
+ updatedAt: 0,
567
+ offers: 0
568
+ })
569
+ .exec()
570
+ .then((docs) => docs.map((doc) => doc.toObject()));
571
+ }
572
+ const identifierIn = (_b = params.identifier) === null || _b === void 0 ? void 0 : _b.$in;
573
+ if (Array.isArray(identifierIn) && identifierIn.length > 0) {
574
+ unitPriceOffers = yield this.offerModel.find({
575
+ 'project.id': { $eq: params.project.id },
576
+ identifier: { $exists: true, $in: identifierIn }
577
+ }, {
578
+ __v: 0,
579
+ createdAt: 0,
580
+ updatedAt: 0,
581
+ offers: 0
582
+ })
583
+ .exec()
584
+ .then((docs) => docs.map((doc) => doc.toObject()));
585
+ }
586
+ const bulkWriteOps = [];
587
+ if (unitPriceOffers.length > 0) {
588
+ unitPriceOffers.forEach((unitPriceOffer) => {
589
+ delete unitPriceOffer._id;
590
+ const $set = {
591
+ project: unitPriceOffer.project,
592
+ typeOf: factory.offerType.AggregateOffer,
593
+ offers: [unitPriceOffer]
594
+ };
595
+ bulkWriteOps.push({
596
+ updateOne: {
597
+ filter: {
598
+ 'project.id': { $eq: unitPriceOffer.project.id },
599
+ _id: { $eq: unitPriceOffer.id }
600
+ },
601
+ update: {
602
+ $set,
603
+ $setOnInsert: { _id: unitPriceOffer.id }
604
+ },
605
+ upsert: true
606
+ }
607
+ });
608
+ });
609
+ }
610
+ if (bulkWriteOps.length > 0) {
611
+ return this.aggregateOfferModel.bulkWrite(bulkWriteOps, { ordered: false });
612
+ }
613
+ });
614
+ }
565
615
  }
566
616
  exports.MongoRepository = MongoRepository;
@@ -74,7 +74,7 @@ export declare class MongoRepository {
74
74
  */
75
75
  $nin?: factory.taskName[];
76
76
  };
77
- }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
77
+ }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncAggregateOffer").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
78
78
  retry(params: {
79
79
  intervalInMinutes: number;
80
80
  }): Promise<void>;
@@ -44,5 +44,5 @@ export declare function coaTicket2offer(params: {
44
44
  ticketResult: COA.factory.master.ITicketResult;
45
45
  defaultCurrencyType?: factory.categoryCode.ICategoryCode;
46
46
  defaultMembershipType?: factory.categoryCode.ICategoryCode;
47
- }): factory.aggregateOffer.IAggregateOffer;
47
+ }): factory.unitPriceOffer.IUnitPriceOffer;
48
48
  export {};
@@ -340,7 +340,7 @@ function coaTicket2offer(params) {
340
340
  ? params.ticketResult.ticketNameEng
341
341
  : ''
342
342
  };
343
- const unitPriceOffer = Object.assign(Object.assign(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY, id: '', identifier: identifier, name: offerName, description: {
343
+ return Object.assign(Object.assign(Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY, id: '', identifier: identifier, name: offerName, description: {
344
344
  ja: '',
345
345
  en: ''
346
346
  }, alternateName: {
@@ -357,7 +357,5 @@ function coaTicket2offer(params) {
357
357
  return { name: String(key), value: String(params.ticketResult[key]) };
358
358
  })
359
359
  ] });
360
- const subOffers = [unitPriceOffer];
361
- return Object.assign(Object.assign({}, unitPriceOffer), { offers: subOffers });
362
360
  }
363
361
  exports.coaTicket2offer = coaTicket2offer;
@@ -1,6 +1,7 @@
1
1
  import * as COA from '@motionpicture/coa-service';
2
2
  import { MongoRepository as CategoryCodeRepo } from '../../../repo/categoryCode';
3
3
  import { MongoRepository as OfferRepo } from '../../../repo/offer';
4
+ import { MongoRepository as TaskRepo } from '../../../repo/task';
4
5
  export declare function importFromCOA(params: {
5
6
  project: {
6
7
  id: string;
@@ -9,6 +10,7 @@ export declare function importFromCOA(params: {
9
10
  }): (repos: {
10
11
  categoryCode: CategoryCodeRepo;
11
12
  offer: OfferRepo;
13
+ task: TaskRepo;
12
14
  masterService: COA.service.Master;
13
15
  }) => Promise<void>;
14
16
  /**
@@ -43,6 +43,24 @@ function importFromCOA(params) {
43
43
  return { attributes: offer, upsert: true };
44
44
  });
45
45
  yield repos.offer.saveManyByIdentifier(saveParams);
46
+ // 同期タスク作成(2023-09-03~)
47
+ if (saveParams.length > 0) {
48
+ const syncAggregateOfferTask = {
49
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
50
+ name: factory.taskName.SyncAggregateOffer,
51
+ status: factory.taskStatus.Ready,
52
+ runsAt: new Date(),
53
+ remainingNumberOfTries: 3,
54
+ numberOfTried: 0,
55
+ executionResults: [],
56
+ data: {
57
+ project: { id: params.project.id },
58
+ identifier: { $in: saveParams.map((savingOffer) => savingOffer.attributes.identifier) },
59
+ typeOf: factory.offerType.Offer
60
+ }
61
+ };
62
+ yield repos.task.saveMany([syncAggregateOfferTask], { emitImmediately: true });
63
+ }
46
64
  }
47
65
  catch (error) {
48
66
  let throwsError = true;
@@ -26,17 +26,17 @@ export type IExternalOrder = Pick<factory.order.IOrder, 'project' | 'typeOf' | '
26
26
  */
27
27
  export declare function createOnOrderSentTasksByTransaction(params: {
28
28
  potentialActions?: factory.action.transfer.send.order.IPotentialActions;
29
- }): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
29
+ }): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncAggregateOffer").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
30
30
  /**
31
31
  * 注文返品後のアクション
32
32
  */
33
33
  export declare function createOnOrderReturnedTasksByTransaction(params: {
34
34
  potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
35
- }): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
35
+ }): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncAggregateOffer").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
36
36
  /**
37
37
  * 注文中止時のアクション
38
38
  */
39
39
  export declare function createOnOrderCancelledTasksByTransaction(params: {
40
40
  transaction?: factory.transaction.placeOrder.ITransaction;
41
- }): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
41
+ }): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncAggregateOffer").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
42
42
  export {};
@@ -13,6 +13,7 @@ exports.call = void 0;
13
13
  const COA = require("@motionpicture/coa-service");
14
14
  const categoryCode_1 = require("../../repo/categoryCode");
15
15
  const offer_1 = require("../../repo/offer");
16
+ const task_1 = require("../../repo/task");
16
17
  const credentials_1 = require("../../credentials");
17
18
  const OfferService = require("../offer");
18
19
  const coaAuthClient = new COA.auth.RefreshToken({
@@ -26,6 +27,7 @@ function call(data) {
26
27
  return (settings) => __awaiter(this, void 0, void 0, function* () {
27
28
  const categoryCodeRepo = new categoryCode_1.MongoRepository(settings.connection);
28
29
  const offerRepo = new offer_1.MongoRepository(settings.connection);
30
+ const taskRepo = new task_1.MongoRepository(settings.connection);
29
31
  const masterService = new COA.service.Master({
30
32
  endpoint: credentials_1.credentials.coa.endpoint,
31
33
  auth: coaAuthClient
@@ -33,6 +35,7 @@ function call(data) {
33
35
  yield OfferService.event.importFromCOA(data)({
34
36
  categoryCode: categoryCodeRepo,
35
37
  offer: offerRepo,
38
+ task: taskRepo,
36
39
  masterService
37
40
  });
38
41
  yield OfferService.event.importCategoryCodesFromCOA(data)({
@@ -0,0 +1,7 @@
1
+ import * as factory from '../../factory';
2
+ import { IConnectionSettings } from '../task';
3
+ export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
4
+ /**
5
+ * タスク実行関数
6
+ */
7
+ export declare function call(data: factory.task.syncAggregateOffer.IData): IOperation<void>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.call = void 0;
13
+ const offer_1 = require("../../repo/offer");
14
+ /**
15
+ * タスク実行関数
16
+ */
17
+ function call(data) {
18
+ return (connectionSettings) => __awaiter(this, void 0, void 0, function* () {
19
+ const offerRepo = new offer_1.MongoRepository(connectionSettings.connection);
20
+ yield offerRepo.sync2aggregateOffer(data);
21
+ });
22
+ }
23
+ exports.call = call;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.329.0-alpha.4",
12
+ "@chevre/factory": "4.329.0-alpha.5",
13
13
  "@cinerino/sdk": "3.166.0-alpha.5",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.8.0-alpha.27"
120
+ "version": "21.8.0-alpha.28"
121
121
  }