@chevre/domain 21.2.0-alpha.151 → 21.2.0-alpha.153

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.
@@ -0,0 +1,190 @@
1
+ // tslint:disable:no-console
2
+ import * as moment from 'moment';
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
+ // tslint:disable-next-line:max-func-body-length
10
+ async function main() {
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
12
+
13
+ const eventRepo = new chevre.repository.Event(mongoose.connection);
14
+
15
+ const result = await eventRepo.createManyIfNotExist<chevre.factory.eventType.ScreeningEvent>([{
16
+ attributes: {
17
+ typeOf: chevre.factory.eventType.ScreeningEvent,
18
+ project: { id: PROJECT_ID, typeOf: chevre.factory.organizationType.Project },
19
+ name: {
20
+ en: 'PetPetPetPet',
21
+ ja: 'ペット'
22
+ },
23
+ doorTime: moment('2023-06-27T00:00:00.000Z')
24
+ .toDate(),
25
+ endDate: moment('2023-06-27T01:00:00.000Z')
26
+ .toDate(),
27
+ eventStatus: chevre.factory.eventStatusType.EventCancelled,
28
+ location: {
29
+ typeOf: chevre.factory.placeType.ScreeningRoom,
30
+ branchCode: '30',
31
+ name: {
32
+ ja: 'シネマ3',
33
+ en: 'CINEMA3'
34
+ },
35
+ address: {
36
+ ja: '7階',
37
+ en: '7F'
38
+ }
39
+ },
40
+ startDate: moment('2023-06-27T00:00:00.000Z')
41
+ .toDate(),
42
+ superEvent: {
43
+ typeOf: chevre.factory.eventType.ScreeningEventSeries,
44
+ id: '7k9ayl8hc',
45
+ videoFormat: [
46
+ {
47
+ typeOf: '2D',
48
+ name: '2D'
49
+ }
50
+ ],
51
+ soundFormat: [],
52
+ workPerformed: {
53
+ typeOf: chevre.factory.creativeWorkType.Movie,
54
+ identifier: '1622100',
55
+ id: '5bfb841d5a78d7948369980a',
56
+ name: {
57
+ en: 'Pet',
58
+ ja: 'ペット'
59
+ },
60
+ duration: 'PT2H3M'
61
+ },
62
+ location: {
63
+ typeOf: chevre.factory.placeType.MovieTheater,
64
+ id: '5bfb841d5a78d7948369979a',
65
+ branchCode: '118',
66
+ name: {
67
+ ja: 'シネモーション赤坂 ',
68
+ en: 'CineMotion Akasaka'
69
+ },
70
+ kanaName: 'シネモーションアカサカ'
71
+ },
72
+ kanaName: 'ペットカナタイトル',
73
+ name: {
74
+ en: 'PetPetPetPet',
75
+ ja: 'ペット'
76
+ },
77
+ additionalProperty: [
78
+ {
79
+ name: 'sortNumber',
80
+ value: '99'
81
+ }
82
+ ],
83
+ startDate: moment('2020-03-31T15:00:00.000Z')
84
+ .toDate(),
85
+ endDate: moment('2034-12-01T15:00:00.000Z')
86
+ .toDate(),
87
+ description: {
88
+ en: 'english description',
89
+ ja: 'ムビチケ検証用のイベントです。'
90
+ },
91
+ headline: {
92
+ en: 'headlineheadlineheadlineheadlineheadlineheadlineheadline',
93
+ ja: 'サブタイトルkanaName'
94
+ },
95
+ subtitleLanguage: {
96
+ typeOf: 'Language',
97
+ name: 'Japanese'
98
+ }
99
+ },
100
+ offers: {
101
+ typeOf: chevre.factory.offerType.Offer,
102
+ priceCurrency: chevre.factory.priceCurrency.JPY,
103
+ availabilityEnds: moment('2023-06-26T14:20:00.000Z')
104
+ .toDate(),
105
+ availabilityStarts: moment('2023-06-23T15:00:00.000Z')
106
+ .toDate(),
107
+ eligibleQuantity: {
108
+ typeOf: 'QuantitativeValue',
109
+ unitCode: chevre.factory.unitCode.C62,
110
+ maxValue: 6,
111
+ value: 1
112
+ },
113
+ itemOffered: {
114
+ id: '6308580bdef565000a9aa1fd',
115
+ name: {
116
+ ja: '通常興行カタログ'
117
+ },
118
+ serviceOutput: {
119
+ typeOf: chevre.factory.reservationType.EventReservation,
120
+ reservedTicket: {
121
+ typeOf: 'Ticket',
122
+ ticketedSeat: {
123
+ typeOf: chevre.factory.placeType.Seat
124
+ }
125
+ }
126
+ },
127
+ typeOf: chevre.factory.product.ProductType.EventService,
128
+ availableChannel: {
129
+ typeOf: 'ServiceChannel',
130
+ serviceLocation: {
131
+ typeOf: chevre.factory.placeType.ScreeningRoom,
132
+ branchCode: '30',
133
+ name: {
134
+ ja: 'シネマ3',
135
+ en: 'CINEMA3'
136
+ },
137
+ containedInPlace: {
138
+ typeOf: chevre.factory.placeType.MovieTheater,
139
+ id: '5bfb841d5a78d7948369979a',
140
+ branchCode: '118',
141
+ name: {
142
+ ja: 'シネモーション赤坂 ',
143
+ en: 'CineMotion Akasaka'
144
+ }
145
+ }
146
+ }
147
+ },
148
+ serviceType: {
149
+ codeValue: '0001',
150
+ id: '5e3361d01dc1ef1a20dd8737',
151
+ inCodeSet: {
152
+ typeOf: 'CategoryCodeSet',
153
+ identifier: chevre.factory.categoryCode.CategorySetIdentifier.ServiceType
154
+ },
155
+ typeOf: 'CategoryCode'
156
+ }
157
+ },
158
+ validFrom: moment('2023-06-23T15:00:00.000Z')
159
+ .toDate(),
160
+ validThrough: moment('2023-06-26T14:20:00.000Z')
161
+ .toDate(),
162
+ seller: {
163
+ typeOf: chevre.factory.organizationType.Corporation,
164
+ id: '59d20831e53ebc2b4e774466',
165
+ name: {
166
+ ja: 'シネモーション赤坂',
167
+ en: 'CineMotion Akasaka'
168
+ },
169
+ makesOffer: [
170
+ ]
171
+ }
172
+ },
173
+ maximumAttendeeCapacity: 90,
174
+ remainingAttendeeCapacity: 90,
175
+ additionalProperty: [{
176
+ name: 'eventIdentifier',
177
+ value: `bySample2023062701`
178
+ }]
179
+ },
180
+ filter: {
181
+ name: 'eventIdentifier'
182
+ }
183
+ }]);
184
+ console.log('result:', result);
185
+
186
+ }
187
+
188
+ main()
189
+ .then(console.log)
190
+ .catch(console.error);
@@ -0,0 +1,65 @@
1
+ import { Connection } from 'mongoose';
2
+ import * as factory from '../factory';
3
+ export type IAvailablePaymentServiceType = factory.service.paymentService.PaymentServiceType.CreditCard | factory.service.paymentService.PaymentServiceType.MovieTicket;
4
+ /**
5
+ * 決済サービスプロバイダーリポジトリ
6
+ */
7
+ export declare class MongoRepository {
8
+ private readonly productModel;
9
+ constructor(connection: Connection);
10
+ /**
11
+ * 決済サービスプロバイダー検索
12
+ */
13
+ search(params: {
14
+ limit?: number;
15
+ page?: number;
16
+ project?: {
17
+ id?: {
18
+ $eq?: string;
19
+ };
20
+ };
21
+ id?: {
22
+ $eq?: string;
23
+ };
24
+ provider?: {
25
+ id?: {
26
+ $eq?: string;
27
+ };
28
+ };
29
+ }): Promise<(Pick<factory.service.paymentService.IService, 'id' | 'name' | 'typeOf'> & {
30
+ provider: Pick<factory.service.paymentService.IProvider, 'id' | 'name' | 'credentials'>;
31
+ })[]>;
32
+ create(params: factory.service.paymentService.IProvider & {
33
+ project: {
34
+ id: string;
35
+ };
36
+ providesPaymentService: {
37
+ id: string;
38
+ typeOf: IAvailablePaymentServiceType;
39
+ };
40
+ }): Promise<{
41
+ id: string;
42
+ }>;
43
+ update(params: factory.service.paymentService.IProvider & {
44
+ project: {
45
+ id: string;
46
+ };
47
+ providesPaymentService: {
48
+ id: string;
49
+ typeOf: IAvailablePaymentServiceType;
50
+ };
51
+ }): Promise<{
52
+ id: string;
53
+ }>;
54
+ deleteOne(params: Pick<factory.service.paymentService.IProvider, 'id'> & {
55
+ project: {
56
+ id: string;
57
+ };
58
+ providesPaymentService: {
59
+ id: string;
60
+ typeOf: IAvailablePaymentServiceType;
61
+ };
62
+ }): Promise<{
63
+ id: string;
64
+ }>;
65
+ }
@@ -0,0 +1,156 @@
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.MongoRepository = void 0;
13
+ const mongoose_1 = require("mongoose");
14
+ const product_1 = require("./mongoose/schemas/product");
15
+ const factory = require("../factory");
16
+ const settings_1 = require("../settings");
17
+ /**
18
+ * 決済サービスプロバイダーリポジトリ
19
+ */
20
+ class MongoRepository {
21
+ constructor(connection) {
22
+ this.productModel = connection.model(product_1.modelName, product_1.schema);
23
+ }
24
+ /**
25
+ * 決済サービスプロバイダー検索
26
+ */
27
+ search(params) {
28
+ var _a, _b, _c, _d, _e;
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const matchStages = [];
31
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
32
+ if (typeof projectIdEq === 'string') {
33
+ matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
34
+ }
35
+ const idEq = (_c = params.id) === null || _c === void 0 ? void 0 : _c.$eq;
36
+ if (typeof idEq === 'string') {
37
+ matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(idEq) } } });
38
+ }
39
+ const providerIdEq = (_e = (_d = params.provider) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.$eq;
40
+ if (typeof providerIdEq === 'string') {
41
+ matchStages.push({ $match: { 'provider.id': { $exists: true, $eq: providerIdEq } } });
42
+ }
43
+ const aggregate = this.productModel.aggregate([
44
+ { $sort: { productID: factory.sortType.Ascending } },
45
+ {
46
+ $unwind: {
47
+ path: '$provider'
48
+ }
49
+ },
50
+ ...matchStages,
51
+ {
52
+ $project: {
53
+ _id: 0,
54
+ provider: {
55
+ id: '$provider.id',
56
+ name: '$provider.name',
57
+ credentials: '$provider.credentials'
58
+ },
59
+ id: { $toString: '$_id' },
60
+ name: '$name',
61
+ typeOf: '$typeOf'
62
+ }
63
+ }
64
+ ]);
65
+ if (typeof params.limit === 'number' && params.limit > 0) {
66
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
67
+ aggregate.limit(params.limit * page)
68
+ .skip(params.limit * (page - 1));
69
+ }
70
+ return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
71
+ .exec();
72
+ });
73
+ }
74
+ create(params) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ // 決済サービス存在確認
77
+ let doc = yield this.productModel.findOne({
78
+ typeOf: { $eq: params.providesPaymentService.typeOf },
79
+ 'project.id': { $eq: params.project.id },
80
+ _id: { $eq: params.providesPaymentService.id }
81
+ }, { _id: 1, typeOf: 1 })
82
+ .exec();
83
+ if (doc === null) {
84
+ throw new factory.errors.NotFound(params.providesPaymentService.typeOf);
85
+ }
86
+ const creatingProvider = {
87
+ credentials: params.credentials,
88
+ id: params.id,
89
+ name: params.name,
90
+ typeOf: params.typeOf
91
+ };
92
+ doc = yield this.productModel.findOneAndUpdate({
93
+ typeOf: { $eq: params.providesPaymentService.typeOf },
94
+ 'project.id': { $eq: params.project.id },
95
+ _id: { $eq: params.providesPaymentService.id },
96
+ 'provider.id': { $ne: params.id }
97
+ }, {
98
+ $push: { provider: creatingProvider }
99
+ }, {
100
+ new: true,
101
+ projection: { _id: 1 }
102
+ })
103
+ .exec();
104
+ // 存在しなければプロバイダーID重複
105
+ if (doc === null) {
106
+ throw new factory.errors.AlreadyInUse('provider', ['id']);
107
+ }
108
+ return doc.toObject();
109
+ });
110
+ }
111
+ update(params) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ const doc = yield this.productModel.findOneAndUpdate({
114
+ typeOf: { $eq: params.providesPaymentService.typeOf },
115
+ 'project.id': { $eq: params.project.id },
116
+ _id: { $eq: params.providesPaymentService.id },
117
+ 'provider.id': { $eq: params.id }
118
+ }, Object.assign(Object.assign({ 'provider.$[seller].id': params.id }, (params.name !== undefined && params.name !== null)
119
+ ? { 'provider.$[seller].name': params.name }
120
+ : undefined), (params.credentials !== undefined && params.credentials !== null)
121
+ ? { 'provider.$[seller].credentials': params.credentials }
122
+ : undefined), {
123
+ new: true,
124
+ arrayFilters: [
125
+ { 'seller.id': { $eq: params.id } }
126
+ ],
127
+ projection: { _id: 1 }
128
+ })
129
+ .exec();
130
+ if (doc === null) {
131
+ throw new factory.errors.NotFound(params.providesPaymentService.typeOf);
132
+ }
133
+ return doc.toObject();
134
+ });
135
+ }
136
+ deleteOne(params) {
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ const doc = yield this.productModel.findOneAndUpdate({
139
+ typeOf: { $eq: params.providesPaymentService.typeOf },
140
+ 'project.id': { $eq: params.project.id },
141
+ _id: { $eq: params.providesPaymentService.id },
142
+ 'provider.id': { $eq: params.id }
143
+ }, {
144
+ $pull: { provider: { id: params.id } }
145
+ }, {
146
+ projection: { _id: 1 }
147
+ })
148
+ .exec();
149
+ if (doc === null) {
150
+ throw new factory.errors.NotFound(params.providesPaymentService.typeOf);
151
+ }
152
+ return doc.toObject();
153
+ });
154
+ }
155
+ }
156
+ exports.MongoRepository = MongoRepository;
@@ -88,6 +88,12 @@ export declare class MongoRepository {
88
88
  };
89
89
  typeOf: factory.placeType.ScreeningRoom;
90
90
  }>;
91
+ updateScreeningRoomsByContainedInPlaceId(screeningRoom: {
92
+ project: {
93
+ id: string;
94
+ };
95
+ containedInPlace: Pick<factory.place.screeningRoom.IContainedInPlace, 'id' | 'name'>;
96
+ }): Promise<void>;
91
97
  deleteScreeningRoom(screeningRoom: {
92
98
  project: {
93
99
  id: string;
@@ -552,6 +552,21 @@ class MongoRepository {
552
552
  }
553
553
  });
554
554
  }
555
+ updateScreeningRoomsByContainedInPlaceId(screeningRoom) {
556
+ var _a;
557
+ return __awaiter(this, void 0, void 0, function* () {
558
+ if (typeof ((_a = screeningRoom.containedInPlace.name) === null || _a === void 0 ? void 0 : _a.ja) === 'string') {
559
+ yield this.placeModel.updateMany({
560
+ typeOf: { $eq: factory.placeType.ScreeningRoom },
561
+ 'project.id': { $eq: screeningRoom.project.id },
562
+ 'containedInPlace.id': { $exists: true, $eq: screeningRoom.containedInPlace.id }
563
+ }, {
564
+ 'containedInPlace.name': screeningRoom.containedInPlace.name
565
+ })
566
+ .exec();
567
+ }
568
+ });
569
+ }
555
570
  deleteScreeningRoom(screeningRoom, useScreeningRoomType) {
556
571
  return __awaiter(this, void 0, void 0, function* () {
557
572
  if (useScreeningRoomType === true) {
@@ -55,28 +55,6 @@ export declare class MongoRepository {
55
55
  id: string;
56
56
  }): Promise<factory.product.IAvailableChannel>;
57
57
  searchPaymentServicesByProvider(params: Pick<factory.product.ISearchConditions, 'limit' | 'page' | 'sort' | 'project' | 'provider' | 'typeOf'>): Promise<IPaymentServiceByProvider[]>;
58
- /**
59
- * 決済サービスのプロバイダー検索
60
- */
61
- aggregateProvider(params: {
62
- limit?: number;
63
- page?: number;
64
- project?: {
65
- id?: {
66
- $eq?: string;
67
- };
68
- };
69
- id?: {
70
- $eq?: string;
71
- };
72
- provider?: {
73
- id?: {
74
- $eq?: string;
75
- };
76
- };
77
- }): Promise<(Pick<factory.service.paymentService.IService, 'id' | 'name'> & {
78
- provider: Pick<factory.service.paymentService.IProvider, 'id' | 'name' | 'credentials'>;
79
- })[]>;
80
58
  /**
81
59
  * プロダクトを保管する
82
60
  * 作成 or 更新
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
- const mongoose_1 = require("mongoose");
25
24
  const product_1 = require("./mongoose/schemas/product");
26
25
  const factory = require("../factory");
27
26
  const settings_1 = require("../settings");
@@ -292,55 +291,6 @@ class MongoRepository {
292
291
  .exec();
293
292
  });
294
293
  }
295
- /**
296
- * 決済サービスのプロバイダー検索
297
- */
298
- aggregateProvider(params) {
299
- var _a, _b, _c, _d, _e;
300
- return __awaiter(this, void 0, void 0, function* () {
301
- const matchStages = [];
302
- const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
303
- if (typeof projectIdEq === 'string') {
304
- matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
305
- }
306
- const idEq = (_c = params.id) === null || _c === void 0 ? void 0 : _c.$eq;
307
- if (typeof idEq === 'string') {
308
- matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(idEq) } } });
309
- }
310
- const providerIdEq = (_e = (_d = params.provider) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.$eq;
311
- if (typeof providerIdEq === 'string') {
312
- matchStages.push({ $match: { 'provider.id': { $exists: true, $eq: providerIdEq } } });
313
- }
314
- const aggregate = this.productModel.aggregate([
315
- { $sort: { productID: factory.sortType.Ascending } },
316
- {
317
- $unwind: {
318
- path: '$provider'
319
- }
320
- },
321
- ...matchStages,
322
- {
323
- $project: {
324
- _id: 0,
325
- provider: {
326
- id: '$provider.id',
327
- name: '$provider.name',
328
- credentials: '$provider.credentials'
329
- },
330
- id: { $toString: '$_id' },
331
- name: '$name'
332
- }
333
- }
334
- ]);
335
- if (typeof params.limit === 'number' && params.limit > 0) {
336
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
337
- aggregate.limit(params.limit * page)
338
- .skip(params.limit * (page - 1));
339
- }
340
- return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
341
- .exec();
342
- });
343
- }
344
294
  /**
345
295
  * プロダクトを保管する
346
296
  * 作成 or 更新
@@ -23,6 +23,7 @@ import { MongoRepository as OfferCatalogRepo } from './repo/offerCatalog';
23
23
  import { MongoRepository as OfferItemConditionRepo } from './repo/offerItemCondition';
24
24
  import { MongoRepository as OrderRepo } from './repo/order';
25
25
  import { MongoRepository as OwnershipInfoRepo } from './repo/ownershipInfo';
26
+ import { MongoRepository as PaymentServiceProviderRepo } from './repo/paymentServiceProvider';
26
27
  import { MongoRepository as PermitRepo } from './repo/permit';
27
28
  import { MongoRepository as PlaceRepo } from './repo/place';
28
29
  import { MongoRepository as PriceSpecificationRepo } from './repo/priceSpecification';
@@ -145,6 +146,11 @@ export declare class OrderNumber extends OrderNumberRepo {
145
146
  */
146
147
  export declare class OwnershipInfo extends OwnershipInfoRepo {
147
148
  }
149
+ /**
150
+ * 決済サービスプロバイダー
151
+ */
152
+ export declare class PaymentServiceProvider extends PaymentServiceProviderRepo {
153
+ }
148
154
  export declare namespace paymentMethod {
149
155
  /**
150
156
  * クレジットカードリポジトリ
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rateLimit = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalog = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
3
+ exports.rateLimit = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalog = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
4
4
  // tslint:disable:max-classes-per-file completed-docs
5
5
  /**
6
6
  * リポジトリ
@@ -27,6 +27,7 @@ const offerCatalog_1 = require("./repo/offerCatalog");
27
27
  const offerItemCondition_1 = require("./repo/offerItemCondition");
28
28
  const order_1 = require("./repo/order");
29
29
  const ownershipInfo_1 = require("./repo/ownershipInfo");
30
+ const paymentServiceProvider_1 = require("./repo/paymentServiceProvider");
30
31
  const permit_1 = require("./repo/permit");
31
32
  const place_1 = require("./repo/place");
32
33
  const priceSpecification_1 = require("./repo/priceSpecification");
@@ -175,6 +176,12 @@ exports.OrderNumber = OrderNumber;
175
176
  class OwnershipInfo extends ownershipInfo_1.MongoRepository {
176
177
  }
177
178
  exports.OwnershipInfo = OwnershipInfo;
179
+ /**
180
+ * 決済サービスプロバイダー
181
+ */
182
+ class PaymentServiceProvider extends paymentServiceProvider_1.MongoRepository {
183
+ }
184
+ exports.PaymentServiceProvider = PaymentServiceProvider;
178
185
  var paymentMethod;
179
186
  (function (paymentMethod) {
180
187
  /**
@@ -5,6 +5,3 @@ export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
5
5
  * タスク実行関数
6
6
  */
7
7
  export declare function call(data: factory.task.onResourceUpdated.IData): IOperation<void>;
8
- /**
9
- * 施設のcontainsPlaceをdocumentとして保管する
10
- */
@@ -78,17 +78,18 @@ function onResourceUpdated(params) {
78
78
  // no op
79
79
  }
80
80
  }
81
- // switch (params.typeOf) {
82
- // case factory.placeType.MovieTheater:
83
- // await syncScreeningRooms({
84
- // project: { id: params.project.id },
85
- // ids: params.id,
86
- // typeOf: params.typeOf
87
- // })(repos);
88
- // break;
89
- // default:
90
- // // no op
91
- // }
81
+ switch (params.typeOf) {
82
+ // 施設名称を同期する(2023-06-29~)
83
+ case factory.placeType.MovieTheater:
84
+ yield syncMovieTheater({
85
+ project: { id: params.project.id },
86
+ ids: params.id,
87
+ typeOf: params.typeOf
88
+ })(repos);
89
+ break;
90
+ default:
91
+ // no op
92
+ }
92
93
  });
93
94
  }
94
95
  function createInformMovieTasks(params) {
@@ -374,45 +375,22 @@ function createInformAccountTitleTasks(params) {
374
375
  }
375
376
  });
376
377
  }
377
- /**
378
- * 施設のcontainsPlaceをdocumentとして保管する
379
- */
380
- // function syncScreeningRooms(params: {
381
- // project: { id: string };
382
- // ids: string[];
383
- // typeOf: factory.placeType.MovieTheater;
384
- // }) {
385
- // return async (repos: {
386
- // place: PlaceRepo;
387
- // }) => {
388
- // if (params.ids.length !== 1) {
389
- // throw new factory.errors.Argument('id', 'id.length must be 1');
390
- // }
391
- // const movieTheaters = <Pick<
392
- // factory.place.movieTheater.IPlace,
393
- // 'id' | 'branchCode' | 'name' | 'project' | 'typeOf' | 'containsPlace'
394
- // >[]>
395
- // await repos.place.searchMovieTheaters(
396
- // { id: { $eq: params.ids[0] } },
397
- // ['_id', 'branchCode', 'name', 'project', 'typeOf', 'containsPlace'],
398
- // []
399
- // );
400
- // const movieTheater = movieTheaters.shift();
401
- // if (movieTheater === undefined) {
402
- // throw new factory.errors.NotFound(factory.placeType.MovieTheater);
403
- // }
404
- // const creatingScreeningRooms: factory.place.screeningRoom.IPlace[] = movieTheater.containsPlace.map((place) => {
405
- // return {
406
- // ...place,
407
- // containedInPlace: {
408
- // id: movieTheater.id,
409
- // typeOf: movieTheater.typeOf,
410
- // branchCode: movieTheater.branchCode,
411
- // name: movieTheater.name
412
- // },
413
- // project: movieTheater.project
414
- // };
415
- // });
416
- // debug('sync processing', creatingScreeningRooms.length, 'screeningRooms...');
417
- // };
418
- // }
378
+ function syncMovieTheater(params) {
379
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
380
+ if (params.ids.length !== 1) {
381
+ throw new factory.errors.Argument('id', 'id.length must be 1');
382
+ }
383
+ const movieTheaters = yield repos.place.searchMovieTheaters({
384
+ id: { $eq: params.ids[0] },
385
+ project: { id: { $eq: params.project.id } }
386
+ }, ['_id', 'name'], []);
387
+ const movieTheater = movieTheaters.shift();
388
+ if (movieTheater === undefined) {
389
+ throw new factory.errors.NotFound(factory.placeType.MovieTheater);
390
+ }
391
+ yield repos.place.updateScreeningRoomsByContainedInPlaceId({
392
+ project: { id: params.project.id },
393
+ containedInPlace: movieTheater
394
+ });
395
+ });
396
+ }
package/package.json CHANGED
@@ -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.2.0-alpha.151"
120
+ "version": "21.2.0-alpha.153"
121
121
  }
@@ -1,39 +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 = process.env.PROJECT_ID;
7
-
8
- async function main() {
9
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
-
11
- const productRepo = new chevre.repository.Product(mongoose.connection);
12
-
13
- const paymentServices = await productRepo.aggregateProvider({
14
- project: { id: { $eq: PROJECT_ID } },
15
- provider: { id: { $eq: 'xxx' } }
16
- // id: { $eq: 'xxx' }
17
- });
18
- console.log(paymentServices);
19
- console.log(paymentServices[0]?.provider.credentials);
20
- console.log(paymentServices.length);
21
-
22
- // const paymentServices = await productRepo.searchPaymentServicesByProvider(
23
- // {
24
- // limit: 10,
25
- // page: 1,
26
- // sort: { productID: chevre.factory.sortType.Descending },
27
- // project: { id: { $eq: PROJECT_ID } },
28
- // typeOf: { $eq: chevre.factory.service.paymentService.PaymentServiceType.CreditCard },
29
- // provider: { id: { $eq: 'xxx' } }
30
- // }
31
- // );
32
- // console.log(paymentServices);
33
- // console.log(paymentServices[0]?.provider?.credentials);
34
- // console.log(paymentServices.length);
35
- }
36
-
37
- main()
38
- .then(console.log)
39
- .catch(console.error);