@chevre/domain 21.4.0-alpha.1 → 21.4.0-alpha.10
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.
- package/example/src/chevre/cleanActions.ts +23 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +6 -0
- package/example/src/chevre/migrateEventOrganizer.ts +112 -0
- package/example/src/chevre/searchEvents.ts +1 -9
- package/example/src/chevre/searchProductOffers.ts +6 -0
- package/lib/chevre/repo/action.d.ts +6 -0
- package/lib/chevre/repo/action.js +13 -0
- package/lib/chevre/repo/event.d.ts +9 -4
- package/lib/chevre/repo/event.js +101 -60
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +7 -4
- package/lib/chevre/repo/mongoose/schemas/event.js +15 -2
- package/lib/chevre/repo/productOffer.d.ts +45 -5
- package/lib/chevre/repo/productOffer.js +113 -14
- package/lib/chevre/repo/seller.d.ts +4 -3
- package/lib/chevre/repo/seller.js +40 -38
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +4 -3
- package/lib/chevre/service/assetTransaction/reserve/factory.js +6 -2
- package/lib/chevre/service/event.js +18 -22
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +15 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard.js +9 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
- package/lib/chevre/service/payment/movieTicket.js +19 -2
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
- package/lib/chevre/service/transaction/returnOrder.js +9 -3
- package/package.json +3 -3
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +0 -90
- package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -75
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +0 -64
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +0 -79
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { Schema } from 'mongoose';
|
|
26
26
|
declare const modelName = "Event";
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* イベントスキーマ
|
|
29
29
|
*/
|
|
30
30
|
declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
31
31
|
collection: string;
|
|
@@ -53,11 +53,12 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
53
53
|
};
|
|
54
54
|
}, {
|
|
55
55
|
typeOf: string;
|
|
56
|
+
project: any;
|
|
56
57
|
checkInCount: number;
|
|
57
58
|
attendeeCount: number;
|
|
59
|
+
organizer: any;
|
|
58
60
|
_id?: string | undefined;
|
|
59
61
|
name?: any;
|
|
60
|
-
project?: any;
|
|
61
62
|
alternateName?: any;
|
|
62
63
|
description?: any;
|
|
63
64
|
additionalProperty?: any;
|
|
@@ -86,11 +87,12 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
86
87
|
kanaName?: string | undefined;
|
|
87
88
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
88
89
|
typeOf: string;
|
|
90
|
+
project: any;
|
|
89
91
|
checkInCount: number;
|
|
90
92
|
attendeeCount: number;
|
|
93
|
+
organizer: any;
|
|
91
94
|
_id?: string | undefined;
|
|
92
95
|
name?: any;
|
|
93
|
-
project?: any;
|
|
94
96
|
alternateName?: any;
|
|
95
97
|
description?: any;
|
|
96
98
|
additionalProperty?: any;
|
|
@@ -119,11 +121,12 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
119
121
|
kanaName?: string | undefined;
|
|
120
122
|
}>> & Omit<import("mongoose").FlatRecord<{
|
|
121
123
|
typeOf: string;
|
|
124
|
+
project: any;
|
|
122
125
|
checkInCount: number;
|
|
123
126
|
attendeeCount: number;
|
|
127
|
+
organizer: any;
|
|
124
128
|
_id?: string | undefined;
|
|
125
129
|
name?: any;
|
|
126
|
-
project?: any;
|
|
127
130
|
alternateName?: any;
|
|
128
131
|
description?: any;
|
|
129
132
|
additionalProperty?: any;
|
|
@@ -7,10 +7,17 @@ const factory = require("../../../factory");
|
|
|
7
7
|
const modelName = 'Event';
|
|
8
8
|
exports.modelName = modelName;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* イベントスキーマ
|
|
11
11
|
*/
|
|
12
12
|
const schema = new mongoose_1.Schema({
|
|
13
|
-
project:
|
|
13
|
+
project: {
|
|
14
|
+
type: mongoose_1.SchemaTypes.Mixed,
|
|
15
|
+
required: true
|
|
16
|
+
},
|
|
17
|
+
organizer: {
|
|
18
|
+
type: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
14
21
|
_id: String,
|
|
15
22
|
typeOf: {
|
|
16
23
|
type: String,
|
|
@@ -78,6 +85,12 @@ schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
|
|
|
78
85
|
schema.index({ 'project.id': 1, startDate: 1 }, {
|
|
79
86
|
name: 'searchByProjectId-v20220721'
|
|
80
87
|
});
|
|
88
|
+
schema.index({ 'organizer.id': 1, startDate: 1 }, {
|
|
89
|
+
name: 'searchByOrganizerId',
|
|
90
|
+
partialFilterExpression: {
|
|
91
|
+
'organizer.id': { $exists: true }
|
|
92
|
+
}
|
|
93
|
+
});
|
|
81
94
|
schema.index({ typeOf: 1, startDate: 1 }, { name: 'searchByTypeOf' });
|
|
82
95
|
schema.index({ eventStatus: 1, startDate: 1 }, { name: 'searchByEventStatus' });
|
|
83
96
|
schema.index({ name: 1, startDate: 1 }, { name: 'searchByName' });
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Connection } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
|
-
export type IAvailablePaymentServiceType = factory.service.paymentService.PaymentServiceType.CreditCard | factory.service.paymentService.PaymentServiceType.MovieTicket;
|
|
4
3
|
/**
|
|
5
4
|
* プロダクトオファーリポジトリ
|
|
6
5
|
*/
|
|
@@ -18,15 +17,56 @@ export declare class MongoRepository {
|
|
|
18
17
|
$eq?: string;
|
|
19
18
|
};
|
|
20
19
|
};
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
itemOffered?: {
|
|
21
|
+
id?: {
|
|
22
|
+
$eq?: string;
|
|
23
|
+
};
|
|
23
24
|
};
|
|
24
25
|
seller?: {
|
|
25
26
|
id?: {
|
|
26
27
|
$eq?: string;
|
|
27
28
|
};
|
|
28
29
|
};
|
|
29
|
-
}): Promise<(Pick<factory.product.
|
|
30
|
-
|
|
30
|
+
}): Promise<(Pick<factory.product.IOffer, 'availabilityEnds' | 'availabilityStarts' | 'seller' | 'validFrom' | 'validThrough'> & {
|
|
31
|
+
itemOffered: Pick<factory.product.IProduct, 'id' | 'name' | 'typeOf'>;
|
|
31
32
|
})[]>;
|
|
33
|
+
create(params: factory.product.IOffer & {
|
|
34
|
+
project: {
|
|
35
|
+
id: string;
|
|
36
|
+
};
|
|
37
|
+
itemOffered: {
|
|
38
|
+
/**
|
|
39
|
+
* プロダクトID
|
|
40
|
+
*/
|
|
41
|
+
id: string;
|
|
42
|
+
};
|
|
43
|
+
}): Promise<{
|
|
44
|
+
id: string;
|
|
45
|
+
}>;
|
|
46
|
+
update(params: factory.product.IOffer & {
|
|
47
|
+
project: {
|
|
48
|
+
id: string;
|
|
49
|
+
};
|
|
50
|
+
itemOffered: {
|
|
51
|
+
/**
|
|
52
|
+
* プロダクトID
|
|
53
|
+
*/
|
|
54
|
+
id: string;
|
|
55
|
+
};
|
|
56
|
+
}): Promise<{
|
|
57
|
+
id: string;
|
|
58
|
+
}>;
|
|
59
|
+
deleteOne(params: Pick<factory.product.IOffer, 'seller'> & {
|
|
60
|
+
project: {
|
|
61
|
+
id: string;
|
|
62
|
+
};
|
|
63
|
+
itemOffered: {
|
|
64
|
+
/**
|
|
65
|
+
* プロダクトID
|
|
66
|
+
*/
|
|
67
|
+
id: string;
|
|
68
|
+
};
|
|
69
|
+
}): Promise<{
|
|
70
|
+
id: string;
|
|
71
|
+
}>;
|
|
32
72
|
}
|
|
@@ -25,7 +25,7 @@ class MongoRepository {
|
|
|
25
25
|
* プロダクトオファー検索
|
|
26
26
|
*/
|
|
27
27
|
search(params) {
|
|
28
|
-
var _a, _b, _c, _d, _e;
|
|
28
|
+
var _a, _b, _c, _d, _e, _f;
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
const matchStages = [{
|
|
31
31
|
$match: {
|
|
@@ -41,11 +41,11 @@ class MongoRepository {
|
|
|
41
41
|
if (typeof projectIdEq === 'string') {
|
|
42
42
|
matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
if (typeof
|
|
46
|
-
matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(
|
|
44
|
+
const itemOfferedIdEq = (_d = (_c = params.itemOffered) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
45
|
+
if (typeof itemOfferedIdEq === 'string') {
|
|
46
|
+
matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(itemOfferedIdEq) } } });
|
|
47
47
|
}
|
|
48
|
-
const sellerIdEq = (
|
|
48
|
+
const sellerIdEq = (_f = (_e = params.seller) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
49
49
|
if (typeof sellerIdEq === 'string') {
|
|
50
50
|
matchStages.push({ $match: { 'offers.seller.id': { $exists: true, $eq: sellerIdEq } } });
|
|
51
51
|
}
|
|
@@ -60,16 +60,16 @@ class MongoRepository {
|
|
|
60
60
|
{
|
|
61
61
|
$project: {
|
|
62
62
|
_id: 0,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
validThrough: '$offers.validThrough',
|
|
68
|
-
seller: '$offers.seller'
|
|
63
|
+
itemOffered: {
|
|
64
|
+
id: { $toString: '$_id' },
|
|
65
|
+
name: '$name',
|
|
66
|
+
typeOf: '$typeOf'
|
|
69
67
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
availabilityEnds: '$offers.availabilityEnds',
|
|
69
|
+
availabilityStarts: '$offers.availabilityStarts',
|
|
70
|
+
validFrom: '$offers.validFrom',
|
|
71
|
+
validThrough: '$offers.validThrough',
|
|
72
|
+
seller: '$offers.seller'
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
]);
|
|
@@ -82,5 +82,104 @@ class MongoRepository {
|
|
|
82
82
|
.exec();
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
+
create(params) {
|
|
86
|
+
var _a;
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
89
|
+
if (typeof sellerId !== 'string' || sellerId.length === 0) {
|
|
90
|
+
throw new factory.errors.ArgumentNull('seller.id');
|
|
91
|
+
}
|
|
92
|
+
// プロダクト存在確認
|
|
93
|
+
let doc = yield this.productModel.findOne({
|
|
94
|
+
'project.id': { $eq: params.project.id },
|
|
95
|
+
_id: { $eq: params.itemOffered.id }
|
|
96
|
+
}, { _id: 1 })
|
|
97
|
+
.exec();
|
|
98
|
+
if (doc === null) {
|
|
99
|
+
throw new factory.errors.NotFound('Product');
|
|
100
|
+
}
|
|
101
|
+
const creatingOffer = {
|
|
102
|
+
priceCurrency: factory.priceCurrency.JPY,
|
|
103
|
+
availabilityEnds: params.availabilityEnds,
|
|
104
|
+
availabilityStarts: params.availabilityStarts,
|
|
105
|
+
validFrom: params.validFrom,
|
|
106
|
+
validThrough: params.validThrough,
|
|
107
|
+
seller: { id: sellerId },
|
|
108
|
+
typeOf: factory.offerType.Offer
|
|
109
|
+
};
|
|
110
|
+
doc = yield this.productModel.findOneAndUpdate({
|
|
111
|
+
'project.id': { $eq: params.project.id },
|
|
112
|
+
_id: { $eq: params.itemOffered.id },
|
|
113
|
+
'offers.seller.id': { $ne: sellerId }
|
|
114
|
+
}, {
|
|
115
|
+
$push: { offers: creatingOffer }
|
|
116
|
+
}, {
|
|
117
|
+
new: true,
|
|
118
|
+
projection: { _id: 1 }
|
|
119
|
+
})
|
|
120
|
+
.exec();
|
|
121
|
+
// 存在しなければプロバイダーID重複
|
|
122
|
+
if (doc === null) {
|
|
123
|
+
throw new factory.errors.AlreadyInUse('offers.seller', ['id']);
|
|
124
|
+
}
|
|
125
|
+
return doc.toObject();
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
update(params) {
|
|
129
|
+
var _a;
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
132
|
+
if (typeof sellerId !== 'string' || sellerId.length === 0) {
|
|
133
|
+
throw new factory.errors.ArgumentNull('seller.id');
|
|
134
|
+
}
|
|
135
|
+
const doc = yield this.productModel.findOneAndUpdate({
|
|
136
|
+
'project.id': { $eq: params.project.id },
|
|
137
|
+
_id: { $eq: params.itemOffered.id },
|
|
138
|
+
'offers.seller.id': { $exists: true, $eq: sellerId }
|
|
139
|
+
}, Object.assign(Object.assign(Object.assign(Object.assign({}, (params.availabilityEnds instanceof Date)
|
|
140
|
+
? { 'offers.$[offerBySeller].availabilityEnds': params.availabilityEnds }
|
|
141
|
+
: undefined), (params.availabilityStarts instanceof Date)
|
|
142
|
+
? { 'offers.$[offerBySeller].availabilityStarts': params.availabilityStarts }
|
|
143
|
+
: undefined), (params.validFrom instanceof Date)
|
|
144
|
+
? { 'offers.$[offerBySeller].validFrom': params.validFrom }
|
|
145
|
+
: undefined), (params.validThrough instanceof Date)
|
|
146
|
+
? { 'offers.$[offerBySeller].validThrough': params.validThrough }
|
|
147
|
+
: undefined), {
|
|
148
|
+
new: true,
|
|
149
|
+
arrayFilters: [
|
|
150
|
+
{ 'offerBySeller.seller.id': { $eq: sellerId } }
|
|
151
|
+
],
|
|
152
|
+
projection: { _id: 1 }
|
|
153
|
+
})
|
|
154
|
+
.exec();
|
|
155
|
+
if (doc === null) {
|
|
156
|
+
throw new factory.errors.NotFound('Product');
|
|
157
|
+
}
|
|
158
|
+
return doc.toObject();
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
deleteOne(params) {
|
|
162
|
+
var _a;
|
|
163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
165
|
+
if (typeof sellerId !== 'string' || sellerId.length === 0) {
|
|
166
|
+
throw new factory.errors.ArgumentNull('seller.id');
|
|
167
|
+
}
|
|
168
|
+
const doc = yield this.productModel.findOneAndUpdate({
|
|
169
|
+
'project.id': { $eq: params.project.id },
|
|
170
|
+
_id: { $eq: params.itemOffered.id },
|
|
171
|
+
'offers.seller.id': { $exists: true, $eq: sellerId }
|
|
172
|
+
}, {
|
|
173
|
+
$pull: { offers: { 'seller.id': { $exists: true, $eq: sellerId } } }
|
|
174
|
+
}, {
|
|
175
|
+
projection: { _id: 1 }
|
|
176
|
+
})
|
|
177
|
+
.exec();
|
|
178
|
+
if (doc === null) {
|
|
179
|
+
throw new factory.errors.NotFound('Product');
|
|
180
|
+
}
|
|
181
|
+
return doc.toObject();
|
|
182
|
+
});
|
|
183
|
+
}
|
|
85
184
|
}
|
|
86
185
|
exports.MongoRepository = MongoRepository;
|
|
@@ -34,10 +34,8 @@ export declare class MongoRepository {
|
|
|
34
34
|
static CREATE_MONGO_CONDITIONS(params: factory.seller.ISearchConditions): any[];
|
|
35
35
|
/**
|
|
36
36
|
* 特定販売者検索
|
|
37
|
+
* searchに置き換え(2023-07-13~)
|
|
37
38
|
*/
|
|
38
|
-
findById(conditions: {
|
|
39
|
-
id: string;
|
|
40
|
-
}, inclusion: string[], exclusion: string[]): Promise<ISeller>;
|
|
41
39
|
/**
|
|
42
40
|
* 販売者を保管する
|
|
43
41
|
*/
|
|
@@ -73,6 +71,9 @@ export declare class MongoRepository {
|
|
|
73
71
|
* 販売者を削除する
|
|
74
72
|
*/
|
|
75
73
|
deleteById(params: {
|
|
74
|
+
project: {
|
|
75
|
+
id: string;
|
|
76
|
+
};
|
|
76
77
|
id: string;
|
|
77
78
|
}): Promise<void>;
|
|
78
79
|
/**
|
|
@@ -128,37 +128,39 @@ class MongoRepository {
|
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* 特定販売者検索
|
|
131
|
+
* searchに置き換え(2023-07-13~)
|
|
131
132
|
*/
|
|
132
|
-
findById(
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
133
|
+
// public async findById(
|
|
134
|
+
// conditions: {
|
|
135
|
+
// id: string;
|
|
136
|
+
// },
|
|
137
|
+
// inclusion: string[],
|
|
138
|
+
// exclusion: string[]
|
|
139
|
+
// ): Promise<ISeller> {
|
|
140
|
+
// let projection: { [key: string]: number } = {};
|
|
141
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
142
|
+
// inclusion.forEach((field) => {
|
|
143
|
+
// projection[field] = 1;
|
|
144
|
+
// });
|
|
145
|
+
// } else {
|
|
146
|
+
// projection = {
|
|
147
|
+
// __v: 0,
|
|
148
|
+
// createdAt: 0,
|
|
149
|
+
// updatedAt: 0
|
|
150
|
+
// };
|
|
151
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
152
|
+
// exclusion.forEach((field) => {
|
|
153
|
+
// projection[field] = 0;
|
|
154
|
+
// });
|
|
155
|
+
// }
|
|
156
|
+
// }
|
|
157
|
+
// const doc = await this.organizationModel.findOne({ _id: conditions.id }, projection)
|
|
158
|
+
// .exec();
|
|
159
|
+
// if (doc === null) {
|
|
160
|
+
// throw new factory.errors.NotFound(this.organizationModel.modelName);
|
|
161
|
+
// }
|
|
162
|
+
// return doc.toObject();
|
|
163
|
+
// }
|
|
162
164
|
/**
|
|
163
165
|
* 販売者を保管する
|
|
164
166
|
*/
|
|
@@ -172,7 +174,10 @@ class MongoRepository {
|
|
|
172
174
|
else {
|
|
173
175
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
174
176
|
const _a = params.attributes, { id, branchCode, project, typeOf } = _a, updateFields = __rest(_a, ["id", "branchCode", "project", "typeOf"]);
|
|
175
|
-
const doc = yield this.organizationModel.findOneAndUpdate({
|
|
177
|
+
const doc = yield this.organizationModel.findOneAndUpdate({
|
|
178
|
+
_id: params.id,
|
|
179
|
+
'project.id': { $eq: project.id }
|
|
180
|
+
}, updateFields, { upsert: false, new: true })
|
|
176
181
|
.exec();
|
|
177
182
|
if (doc === null) {
|
|
178
183
|
throw new factory.errors.NotFound(this.organizationModel.modelName);
|
|
@@ -182,12 +187,6 @@ class MongoRepository {
|
|
|
182
187
|
return organization;
|
|
183
188
|
});
|
|
184
189
|
}
|
|
185
|
-
// public async count(params: factory.seller.ISearchConditions): Promise<number> {
|
|
186
|
-
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
187
|
-
// return this.organizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
188
|
-
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
189
|
-
// .exec();
|
|
190
|
-
// }
|
|
191
190
|
/**
|
|
192
191
|
* 販売者検索
|
|
193
192
|
*/
|
|
@@ -270,7 +269,10 @@ class MongoRepository {
|
|
|
270
269
|
*/
|
|
271
270
|
deleteById(params) {
|
|
272
271
|
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
-
yield this.organizationModel.findOneAndRemove({
|
|
272
|
+
yield this.organizationModel.findOneAndRemove({
|
|
273
|
+
_id: params.id,
|
|
274
|
+
'project.id': { $eq: params.project.id }
|
|
275
|
+
})
|
|
274
276
|
.exec();
|
|
275
277
|
});
|
|
276
278
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
1
|
+
import { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '../../../repo/event';
|
|
2
2
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
3
3
|
import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
4
4
|
import { MongoRepository as PlaceRepo } from '../../../repo/place';
|
|
@@ -28,5 +28,5 @@ export declare function aggregateScreeningEvent(params: {
|
|
|
28
28
|
id: string;
|
|
29
29
|
}): IAggregateScreeningEventOperation<void>;
|
|
30
30
|
export declare function aggregateByEvent(params: {
|
|
31
|
-
event: factory.
|
|
31
|
+
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
|
|
32
32
|
}): IAggregateScreeningEventOperation<void>;
|
|
@@ -28,7 +28,15 @@ function validateAccount(params) {
|
|
|
28
28
|
if (typeof sellerId !== 'string') {
|
|
29
29
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const sellers = yield repos.seller.search({
|
|
32
|
+
limit: 1,
|
|
33
|
+
page: 1,
|
|
34
|
+
id: { $eq: sellerId }
|
|
35
|
+
}, ['paymentAccepted'], []);
|
|
36
|
+
const seller = sellers.shift();
|
|
37
|
+
if (seller === undefined) {
|
|
38
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
39
|
+
}
|
|
32
40
|
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
33
41
|
if (paymentAccepted !== true) {
|
|
34
42
|
throw new factory.errors.Argument('recipient', `payment not accepted`);
|
|
@@ -210,7 +210,15 @@ function validateSeller(params) {
|
|
|
210
210
|
if (typeof sellerId !== 'string') {
|
|
211
211
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
212
212
|
}
|
|
213
|
-
const
|
|
213
|
+
const sellers = yield repos.seller.search({
|
|
214
|
+
limit: 1,
|
|
215
|
+
page: 1,
|
|
216
|
+
id: { $eq: sellerId }
|
|
217
|
+
}, ['paymentAccepted'], []);
|
|
218
|
+
const seller = sellers.shift();
|
|
219
|
+
if (seller === undefined) {
|
|
220
|
+
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
221
|
+
}
|
|
214
222
|
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.typeOf;
|
|
215
223
|
if (typeof paymentMethodType !== 'string') {
|
|
216
224
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
|
+
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
2
3
|
import { IAcceptedAddOn } from './factory/price';
|
|
3
4
|
type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
|
|
4
5
|
export { IAcceptedAddOn };
|
|
@@ -46,9 +47,9 @@ export declare function createAdditionalTicketText(params: {
|
|
|
46
47
|
reservedTicket: factory.reservation.ITicket;
|
|
47
48
|
}): string | undefined;
|
|
48
49
|
export type IUnitPriceSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.UnitPriceSpecification>;
|
|
49
|
-
export declare function createReservationFor(params: factory.
|
|
50
|
+
export declare function createReservationFor(params: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>): factory.assetTransaction.reserve.IReservationFor;
|
|
50
51
|
export declare function createIssuedThrough(params: {
|
|
51
|
-
reservationFor: factory.
|
|
52
|
+
reservationFor: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
|
|
52
53
|
}): {
|
|
53
54
|
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
54
55
|
};
|
|
@@ -61,7 +62,7 @@ export declare function createReservation(params: {
|
|
|
61
62
|
reserveDate: Date;
|
|
62
63
|
agent: factory.assetTransaction.reserve.IAgent;
|
|
63
64
|
reservationNumber: string;
|
|
64
|
-
reservationFor: factory.
|
|
65
|
+
reservationFor: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
|
|
65
66
|
reservedTicket: factory.reservation.ITicket;
|
|
66
67
|
additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
|
|
67
68
|
additionalTicketText?: string;
|
|
@@ -327,7 +327,9 @@ function createAdditionalTicketText(params) {
|
|
|
327
327
|
return (_b = (_a = params.acceptedOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.additionalTicketText;
|
|
328
328
|
}
|
|
329
329
|
exports.createAdditionalTicketText = createAdditionalTicketText;
|
|
330
|
-
function createReservationFor(
|
|
330
|
+
function createReservationFor(
|
|
331
|
+
// params: factory.event.screeningEvent.IEvent | factory.event.event.IEvent
|
|
332
|
+
params) {
|
|
331
333
|
var _a, _b;
|
|
332
334
|
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
333
335
|
return Object.assign({ endDate: params.endDate, id: params.id, location: params.location, name: params.name, startDate: params.startDate, superEvent: optimizeReservationSuperEvent(params), typeOf: params.typeOf }, (params.doorTime instanceof Date)
|
|
@@ -343,7 +345,9 @@ function createReservationFor(params) {
|
|
|
343
345
|
}
|
|
344
346
|
}
|
|
345
347
|
exports.createReservationFor = createReservationFor;
|
|
346
|
-
function optimizeReservationSuperEvent(
|
|
348
|
+
function optimizeReservationSuperEvent(
|
|
349
|
+
// params: factory.event.screeningEvent.IEvent
|
|
350
|
+
params) {
|
|
347
351
|
const superEvent = params.superEvent;
|
|
348
352
|
return Object.assign(Object.assign({ additionalProperty: (Array.isArray(superEvent.additionalProperty))
|
|
349
353
|
? superEvent.additionalProperty
|
|
@@ -92,6 +92,7 @@ function importFromCOA(params) {
|
|
|
92
92
|
const sellersWithSameBranchCode = yield repos.seller.search({
|
|
93
93
|
limit: 1,
|
|
94
94
|
page: 1,
|
|
95
|
+
project: { id: { $eq: project.id } },
|
|
95
96
|
branchCode: { $eq: params.locationBranchCode }
|
|
96
97
|
}, ['_id'], []);
|
|
97
98
|
const seller = sellersWithSameBranchCode.shift();
|
|
@@ -119,6 +120,7 @@ function importFromCOA(params) {
|
|
|
119
120
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
120
121
|
}
|
|
121
122
|
const screeningRooms = yield repos.place.searchScreeningRooms({
|
|
123
|
+
project: { id: { $eq: project.id } },
|
|
122
124
|
containedInPlace: { branchCode: { $eq: movieTheater.branchCode } }
|
|
123
125
|
});
|
|
124
126
|
const targetImportFrom = moment(`${moment(params.importFrom)
|
|
@@ -133,7 +135,8 @@ function importFromCOA(params) {
|
|
|
133
135
|
locationBranchCode: params.locationBranchCode,
|
|
134
136
|
movieTheater,
|
|
135
137
|
project: project,
|
|
136
|
-
saveScreeningEventSeries: params.saveScreeningEventSeries
|
|
138
|
+
saveScreeningEventSeries: params.saveScreeningEventSeries,
|
|
139
|
+
seller: { id: seller.id }
|
|
137
140
|
})(repos);
|
|
138
141
|
savedScreeningEventSeriesCount = savedEventsCount;
|
|
139
142
|
try {
|
|
@@ -145,7 +148,8 @@ function importFromCOA(params) {
|
|
|
145
148
|
screeningEventSerieses: screeningEventSerieses,
|
|
146
149
|
project: project,
|
|
147
150
|
targetImportFrom: targetImportFrom.toDate(),
|
|
148
|
-
targetImportThrough: targetImportThrough.toDate()
|
|
151
|
+
targetImportThrough: targetImportThrough.toDate(),
|
|
152
|
+
seller: { id: seller.id }
|
|
149
153
|
})(repos);
|
|
150
154
|
savedScreeningEventsCount = screeningEvents.length;
|
|
151
155
|
// COAから削除されたイベントをキャンセル済ステータスへ変更
|
|
@@ -234,7 +238,8 @@ function saveScreeningEventSeries(params) {
|
|
|
234
238
|
eizouKubuns: eizouKubuns,
|
|
235
239
|
joueihousikiKubuns: joueihousikiKubuns,
|
|
236
240
|
jimakufukikaeKubuns: jimakufukikaeKubuns,
|
|
237
|
-
availablePaymentMethodTypes
|
|
241
|
+
availablePaymentMethodTypes,
|
|
242
|
+
seller: params.seller
|
|
238
243
|
});
|
|
239
244
|
});
|
|
240
245
|
let savedEventsCount = 0;
|
|
@@ -362,7 +367,8 @@ function createScreeningEvents(params) {
|
|
|
362
367
|
screenRoom: screenRoom,
|
|
363
368
|
superEvent: screeningEventSeries,
|
|
364
369
|
serviceKubuns: serviceKubuns,
|
|
365
|
-
acousticKubuns: acousticKubuns
|
|
370
|
+
acousticKubuns: acousticKubuns,
|
|
371
|
+
seller: params.seller
|
|
366
372
|
});
|
|
367
373
|
screeningEvents.push(screeningEvent);
|
|
368
374
|
});
|
|
@@ -373,16 +379,6 @@ function cancelDeletedEvents(params) {
|
|
|
373
379
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
374
380
|
// distinctでidのみ取得(2023-01-25~)
|
|
375
381
|
// COAから削除されたイベントをキャンセル済ステータスへ変更
|
|
376
|
-
// const ids = await repos.event.search<factory.eventType.ScreeningEvent>({
|
|
377
|
-
// project: { id: { $eq: params.project.id } },
|
|
378
|
-
// typeOf: factory.eventType.ScreeningEvent,
|
|
379
|
-
// superEvent: {
|
|
380
|
-
// locationBranchCodes: [params.locationBranchCode]
|
|
381
|
-
// },
|
|
382
|
-
// startFrom: params.targetImportFrom,
|
|
383
|
-
// startThrough: params.targetImportThrough
|
|
384
|
-
// })
|
|
385
|
-
// .then((events) => events.map((e) => e.id));
|
|
386
382
|
const ids = yield repos.event.searchIds({
|
|
387
383
|
project: { id: { $eq: params.project.id } },
|
|
388
384
|
typeOf: factory.eventType.ScreeningEvent,
|
|
@@ -397,7 +393,10 @@ function cancelDeletedEvents(params) {
|
|
|
397
393
|
debug(`cancelling ${cancelledIds.length} events...`);
|
|
398
394
|
for (const cancelledId of cancelledIds) {
|
|
399
395
|
try {
|
|
400
|
-
yield repos.event.cancel({
|
|
396
|
+
yield repos.event.cancel({
|
|
397
|
+
id: cancelledId,
|
|
398
|
+
project: { id: params.project.id }
|
|
399
|
+
});
|
|
401
400
|
}
|
|
402
401
|
catch (error) {
|
|
403
402
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -493,7 +492,8 @@ function createScreeningEventFromCOA(params) {
|
|
|
493
492
|
attendeeCount: 0,
|
|
494
493
|
maximumAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity,
|
|
495
494
|
remainingAttendeeCapacity: params.screenRoom.maximumAttendeeCapacity,
|
|
496
|
-
additionalProperty
|
|
495
|
+
additionalProperty,
|
|
496
|
+
organizer: { id: params.seller.id }
|
|
497
497
|
};
|
|
498
498
|
}
|
|
499
499
|
function createScreeningEventAdditionalPropertyFromCOA(params) {
|
|
@@ -579,12 +579,8 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
579
579
|
kanaName: params.movieTheater.kanaName,
|
|
580
580
|
typeOf: params.movieTheater.typeOf
|
|
581
581
|
},
|
|
582
|
-
//
|
|
583
|
-
|
|
584
|
-
// typeOf: factory.organizationType.Corporation,
|
|
585
|
-
// identifier: params.movieTheater.id,
|
|
586
|
-
// name: params.movieTheater.name
|
|
587
|
-
// },
|
|
582
|
+
// 必須化(2023-07-12~)
|
|
583
|
+
organizer: { id: params.seller.id },
|
|
588
584
|
videoFormat: params.eizouKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEizou)[0],
|
|
589
585
|
soundFormat: [],
|
|
590
586
|
workPerformed: {
|