@chevre/domain 20.1.0-alpha.8 → 20.1.0
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/deleteReservationTicketUnderNames.ts +20 -0
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +157 -0
- package/example/src/chevre/migrateCreativeWorkAdditionalProperties.ts +116 -0
- package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
- package/example/src/chevre/migrateEventProjectAttributes.ts +57 -0
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +162 -0
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +64 -0
- package/example/src/chevre/searchEvents.ts +36 -16
- package/example/src/chevre/transaction/callOrderMembershipServiceTask.ts +0 -4
- package/example/src/chevre/transaction/orderMembershipService.ts +0 -4
- package/lib/chevre/factory/reservedAgentIdentifireNames.d.ts +1 -0
- package/lib/chevre/factory/reservedAgentIdentifireNames.js +12 -0
- package/lib/chevre/repo/accountAction.d.ts +0 -18
- package/lib/chevre/repo/accountAction.js +402 -355
- package/lib/chevre/repo/accountTitle.d.ts +1 -0
- package/lib/chevre/repo/accountTitle.js +6 -1
- package/lib/chevre/repo/additionalProperty.d.ts +35 -0
- package/lib/chevre/repo/additionalProperty.js +205 -0
- package/lib/chevre/repo/categoryCode.d.ts +1 -0
- package/lib/chevre/repo/categoryCode.js +15 -1
- package/lib/chevre/repo/creativeWork.js +10 -1
- package/lib/chevre/repo/customer.d.ts +1 -0
- package/lib/chevre/repo/customer.js +5 -0
- package/lib/chevre/repo/event.d.ts +12 -4
- package/lib/chevre/repo/event.js +84 -48
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
- package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
- package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
- package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
- package/lib/chevre/repo/mongoose/model/event.js +6 -0
- package/lib/chevre/repo/mongoose/model/offer.js +7 -1
- package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
- package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
- package/lib/chevre/repo/mongoose/model/place.js +24 -0
- package/lib/chevre/repo/offer.js +10 -1
- package/lib/chevre/repo/offerCatalog.js +10 -10
- package/lib/chevre/repo/person.js +4 -1
- package/lib/chevre/repo/place.d.ts +1 -0
- package/lib/chevre/repo/place.js +54 -7
- package/lib/chevre/repo/reservation.d.ts +17 -2
- package/lib/chevre/repo/reservation.js +41 -1
- package/lib/chevre/repo/transaction.js +20 -5
- package/lib/chevre/repository.d.ts +6 -3
- package/lib/chevre/repository.js +10 -5
- package/lib/chevre/service/account.d.ts +0 -4
- package/lib/chevre/service/account.js +24 -22
- package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/deposit.js +3 -3
- package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/transfer.js +3 -3
- package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +86 -42
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +7 -18
- package/lib/chevre/service/assetTransaction/reserve/factory.js +81 -113
- package/lib/chevre/service/assetTransaction/reserve.js +41 -95
- package/lib/chevre/service/event.js +20 -6
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +65 -27
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +17 -12
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
- package/lib/chevre/service/offer/factory.js +7 -20
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +32 -22
- package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -5
- package/lib/chevre/service/reserve/cancelReservation.js +260 -107
- package/lib/chevre/service/reserve/confirmReservation.js +65 -33
- package/lib/chevre/service/reserve/factory.d.ts +14 -2
- package/lib/chevre/service/reserve/factory.js +13 -6
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +85 -30
- package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +15 -28
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +14 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
- package/lib/chevre/service/transaction/returnOrder.js +10 -1
- package/lib/chevre/service.d.ts +2 -0
- package/lib/chevre/service.js +2 -0
- package/package.json +4 -4
- package/example/src/chevre/accountBlanceTest.ts +0 -24
- package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
- package/example/src/chevre/createSeats.ts +0 -59
- package/example/src/chevre/deleteEvents.ts +0 -50
- package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
- package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
- package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
- package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
- package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
- package/example/src/chevre/publishConfirmationNumber.ts +0 -30
- package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
- package/example/src/chevre/publishTransactionNumber.ts +0 -28
- package/example/src/chevre/renameTransaction.ts +0 -22
- package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
|
-
|
|
13
|
+
const factory = require("../factory");
|
|
14
14
|
const accountTitle_1 = require("./mongoose/model/accountTitle");
|
|
15
15
|
/**
|
|
16
16
|
* 科目リポジトリ
|
|
@@ -27,5 +27,10 @@ class MongoRepository {
|
|
|
27
27
|
.exec();
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
getCursor(conditions, projection) {
|
|
31
|
+
return this.accountTitleModel.find(conditions, projection)
|
|
32
|
+
.sort({ codeValue: factory.sortType.Descending })
|
|
33
|
+
.cursor();
|
|
34
|
+
}
|
|
30
35
|
}
|
|
31
36
|
exports.MongoRepository = MongoRepository;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Connection } from 'mongoose';
|
|
2
|
+
import * as factory from '../factory';
|
|
3
|
+
/**
|
|
4
|
+
* 追加特性リポジトリ
|
|
5
|
+
*/
|
|
6
|
+
export declare class MongoRepository {
|
|
7
|
+
private readonly additionalPropertyModel;
|
|
8
|
+
constructor(connection: Connection);
|
|
9
|
+
static CREATE_MONGO_CONDITIONS(params: factory.additionalProperty.ISearchConditions): any[];
|
|
10
|
+
/**
|
|
11
|
+
* 検索
|
|
12
|
+
*/
|
|
13
|
+
search(params: factory.additionalProperty.ISearchConditions): Promise<factory.additionalProperty.IAdditionalProperty[]>;
|
|
14
|
+
findById(params: {
|
|
15
|
+
id: string;
|
|
16
|
+
}): Promise<factory.additionalProperty.IAdditionalProperty>;
|
|
17
|
+
save(params: {
|
|
18
|
+
id?: string;
|
|
19
|
+
attributes: factory.additionalProperty.IAdditionalProperty;
|
|
20
|
+
}): Promise<factory.additionalProperty.IAdditionalProperty>;
|
|
21
|
+
/**
|
|
22
|
+
* 削除する
|
|
23
|
+
*/
|
|
24
|
+
deleteById(params: {
|
|
25
|
+
id: string;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* プロジェクト指定で削除する
|
|
29
|
+
*/
|
|
30
|
+
deleteByProject(params: {
|
|
31
|
+
project: {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.MongoRepository = void 0;
|
|
24
|
+
const additionalProperty_1 = require("./mongoose/model/additionalProperty");
|
|
25
|
+
const factory = require("../factory");
|
|
26
|
+
/**
|
|
27
|
+
* 追加特性リポジトリ
|
|
28
|
+
*/
|
|
29
|
+
class MongoRepository {
|
|
30
|
+
constructor(connection) {
|
|
31
|
+
this.additionalPropertyModel = connection.model(additionalProperty_1.modelName);
|
|
32
|
+
}
|
|
33
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
34
|
+
static CREATE_MONGO_CONDITIONS(params) {
|
|
35
|
+
var _a, _b, _c, _d;
|
|
36
|
+
// MongoDB検索条件
|
|
37
|
+
const andConditions = [];
|
|
38
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
39
|
+
/* istanbul ignore else */
|
|
40
|
+
if (params.project !== undefined && params.project !== null) {
|
|
41
|
+
if (params.project.id !== undefined && params.project.id !== null) {
|
|
42
|
+
if (typeof params.project.id.$eq === 'string') {
|
|
43
|
+
andConditions.push({
|
|
44
|
+
'project.id': {
|
|
45
|
+
$eq: params.project.id.$eq
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
52
|
+
/* istanbul ignore else */
|
|
53
|
+
if (params.id !== undefined && params.id !== null) {
|
|
54
|
+
if (typeof params.id.$eq === 'string') {
|
|
55
|
+
andConditions.push({
|
|
56
|
+
_id: {
|
|
57
|
+
$eq: params.id.$eq
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
63
|
+
/* istanbul ignore else */
|
|
64
|
+
if (params.name !== undefined && params.name !== null) {
|
|
65
|
+
if (typeof params.name.$regex === 'string' && params.name.$regex.length > 0) {
|
|
66
|
+
andConditions.push({
|
|
67
|
+
$or: [
|
|
68
|
+
{
|
|
69
|
+
'name.ja': {
|
|
70
|
+
$exists: true,
|
|
71
|
+
$regex: new RegExp(params.name.$regex)
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
'name.en': {
|
|
76
|
+
$exists: true,
|
|
77
|
+
$regex: new RegExp(params.name.$regex)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const codeValueEq = (_a = params.codeValue) === null || _a === void 0 ? void 0 : _a.$eq;
|
|
85
|
+
if (typeof codeValueEq === 'string') {
|
|
86
|
+
andConditions.push({
|
|
87
|
+
codeValue: {
|
|
88
|
+
$exists: true,
|
|
89
|
+
$eq: codeValueEq
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const codeValueIn = (_b = params.codeValue) === null || _b === void 0 ? void 0 : _b.$in;
|
|
94
|
+
if (Array.isArray(codeValueIn)) {
|
|
95
|
+
andConditions.push({
|
|
96
|
+
codeValue: {
|
|
97
|
+
$exists: true,
|
|
98
|
+
$in: codeValueIn
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
103
|
+
/* istanbul ignore else */
|
|
104
|
+
if (params.inCodeSet !== undefined && params.inCodeSet !== null) {
|
|
105
|
+
if (params.inCodeSet.identifier !== undefined && params.inCodeSet.identifier !== null) {
|
|
106
|
+
if (typeof params.inCodeSet.identifier.$eq === 'string') {
|
|
107
|
+
andConditions.push({
|
|
108
|
+
'inCodeSet.identifier': {
|
|
109
|
+
$exists: true,
|
|
110
|
+
$eq: params.inCodeSet.identifier.$eq
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const inCodeSetIdentifierIn = (_d = (_c = params.inCodeSet) === null || _c === void 0 ? void 0 : _c.identifier) === null || _d === void 0 ? void 0 : _d.$in;
|
|
117
|
+
if (Array.isArray(inCodeSetIdentifierIn)) {
|
|
118
|
+
andConditions.push({
|
|
119
|
+
'inCodeSet.identifier': {
|
|
120
|
+
$exists: true,
|
|
121
|
+
$in: inCodeSetIdentifierIn
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return andConditions;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 検索
|
|
129
|
+
*/
|
|
130
|
+
search(params) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
133
|
+
const query = this.additionalPropertyModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
|
|
134
|
+
__v: 0,
|
|
135
|
+
createdAt: 0,
|
|
136
|
+
updatedAt: 0
|
|
137
|
+
});
|
|
138
|
+
if (typeof params.limit === 'number') {
|
|
139
|
+
const page = (typeof params.page === 'number') ? params.page : 1;
|
|
140
|
+
query.limit(params.limit)
|
|
141
|
+
.skip(params.limit * (page - 1));
|
|
142
|
+
}
|
|
143
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
144
|
+
/* istanbul ignore else */
|
|
145
|
+
if (params.sort !== undefined) {
|
|
146
|
+
query.sort(params.sort);
|
|
147
|
+
}
|
|
148
|
+
return query.setOptions({ maxTimeMS: 10000 })
|
|
149
|
+
.exec()
|
|
150
|
+
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
findById(params) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
const doc = yield this.additionalPropertyModel.findOne({ _id: params.id }, {
|
|
156
|
+
__v: 0,
|
|
157
|
+
createdAt: 0,
|
|
158
|
+
updatedAt: 0
|
|
159
|
+
})
|
|
160
|
+
.exec();
|
|
161
|
+
if (doc === null) {
|
|
162
|
+
throw new factory.errors.NotFound(this.additionalPropertyModel.modelName);
|
|
163
|
+
}
|
|
164
|
+
return doc.toObject();
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
save(params) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
let doc;
|
|
170
|
+
if (typeof params.id !== 'string') {
|
|
171
|
+
doc = yield this.additionalPropertyModel.create(params.attributes);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
const _a = params.attributes, { id, codeValue, inCodeSet, project, typeOf } = _a, updateFields = __rest(_a, ["id", "codeValue", "inCodeSet", "project", "typeOf"]);
|
|
175
|
+
doc = yield this.additionalPropertyModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
|
|
176
|
+
.exec();
|
|
177
|
+
}
|
|
178
|
+
if (doc === null) {
|
|
179
|
+
throw new factory.errors.NotFound(this.additionalPropertyModel.modelName);
|
|
180
|
+
}
|
|
181
|
+
return doc.toObject();
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* 削除する
|
|
186
|
+
*/
|
|
187
|
+
deleteById(params) {
|
|
188
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
+
yield this.additionalPropertyModel.findOneAndRemove({ _id: params.id })
|
|
190
|
+
.exec();
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* プロジェクト指定で削除する
|
|
195
|
+
*/
|
|
196
|
+
deleteByProject(params) {
|
|
197
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
yield this.additionalPropertyModel.deleteMany({
|
|
199
|
+
'project.id': { $eq: params.project.id }
|
|
200
|
+
})
|
|
201
|
+
.exec();
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.MongoRepository = MongoRepository;
|
|
@@ -32,7 +32,7 @@ class MongoRepository {
|
|
|
32
32
|
}
|
|
33
33
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
34
34
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
36
36
|
// MongoDB検索条件
|
|
37
37
|
const andConditions = [];
|
|
38
38
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -140,6 +140,15 @@ class MongoRepository {
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
+
const additionalPropertyElemMatch = (_j = params.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
|
|
144
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
145
|
+
andConditions.push({
|
|
146
|
+
additionalProperty: {
|
|
147
|
+
$exists: true,
|
|
148
|
+
$elemMatch: additionalPropertyElemMatch
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
143
152
|
return andConditions;
|
|
144
153
|
}
|
|
145
154
|
count(params) {
|
|
@@ -228,5 +237,10 @@ class MongoRepository {
|
|
|
228
237
|
.exec();
|
|
229
238
|
});
|
|
230
239
|
}
|
|
240
|
+
getCursor(conditions, projection) {
|
|
241
|
+
return this.categoryCodeModel.find(conditions, projection)
|
|
242
|
+
.sort({ codeValue: factory.sortType.Ascending })
|
|
243
|
+
.cursor();
|
|
244
|
+
}
|
|
231
245
|
}
|
|
232
246
|
exports.MongoRepository = MongoRepository;
|
|
@@ -33,7 +33,7 @@ class MongoRepository {
|
|
|
33
33
|
}
|
|
34
34
|
// tslint:disable-next-line:max-func-body-length
|
|
35
35
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
36
|
-
var _a, _b, _c, _d, _e;
|
|
36
|
+
var _a, _b, _c, _d, _e, _f;
|
|
37
37
|
// MongoDB検索条件
|
|
38
38
|
const andConditions = [
|
|
39
39
|
{
|
|
@@ -155,6 +155,15 @@ class MongoRepository {
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
+
const additionalPropertyElemMatch = (_f = params.additionalProperty) === null || _f === void 0 ? void 0 : _f.$elemMatch;
|
|
159
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
160
|
+
andConditions.push({
|
|
161
|
+
additionalProperty: {
|
|
162
|
+
$exists: true,
|
|
163
|
+
$elemMatch: additionalPropertyElemMatch
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
158
167
|
return andConditions;
|
|
159
168
|
}
|
|
160
169
|
/**
|
|
@@ -130,5 +130,10 @@ class MongoRepository {
|
|
|
130
130
|
.exec();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
+
getCursor(conditions, projection) {
|
|
134
|
+
return this.customerModel.find(conditions, projection)
|
|
135
|
+
.sort({ branchCode: factory.sortType.Ascending })
|
|
136
|
+
.cursor();
|
|
137
|
+
}
|
|
133
138
|
}
|
|
134
139
|
exports.MongoRepository = MongoRepository;
|
|
@@ -29,13 +29,14 @@ export interface IUpdateAggregateUseActionsParams {
|
|
|
29
29
|
noExistingAttributeName: 1;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
+
export declare type ISearchConditions<T extends factory.eventType> = factory.event.ISearchConditions<T>;
|
|
32
33
|
/**
|
|
33
34
|
* イベントリポジトリ
|
|
34
35
|
*/
|
|
35
36
|
export declare class MongoRepository {
|
|
36
37
|
private readonly eventModel;
|
|
37
38
|
constructor(connection: Connection);
|
|
38
|
-
static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions:
|
|
39
|
+
static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions: ISearchConditions<T>): any[];
|
|
39
40
|
/**
|
|
40
41
|
* 複数イベントを作成する
|
|
41
42
|
*/
|
|
@@ -71,14 +72,18 @@ export declare class MongoRepository {
|
|
|
71
72
|
attributes: factory.event.IAttributes<factory.eventType.ScreeningEvent>;
|
|
72
73
|
useOldEventId: boolean;
|
|
73
74
|
}): Promise<factory.event.IEvent<factory.eventType.ScreeningEvent>>;
|
|
74
|
-
count<T extends factory.eventType>(params:
|
|
75
|
+
count<T extends factory.eventType>(params: ISearchConditions<T>): Promise<number>;
|
|
75
76
|
/**
|
|
76
77
|
* イベントを検索する
|
|
77
78
|
*/
|
|
78
|
-
search<T extends factory.eventType>(params:
|
|
79
|
+
search<T extends factory.eventType>(params: ISearchConditions<T>, projection?: {
|
|
80
|
+
[key: string]: number;
|
|
81
|
+
}): Promise<factory.event.IEvent<T>[]>;
|
|
79
82
|
findById<T extends factory.eventType>(params: {
|
|
80
83
|
id: string;
|
|
81
|
-
}, projection?:
|
|
84
|
+
}, projection?: {
|
|
85
|
+
[key: string]: number;
|
|
86
|
+
}): Promise<factory.event.IEvent<T>>;
|
|
82
87
|
/**
|
|
83
88
|
* イベントをキャンセルする
|
|
84
89
|
*/
|
|
@@ -101,4 +106,7 @@ export declare class MongoRepository {
|
|
|
101
106
|
}, update: IUpdateAggregateReservationParams | IUpdateAggregateUseActionsParams): Promise<factory.event.IEvent<T>>;
|
|
102
107
|
bulkWrite(bulkWriteOps: any[]): Promise<import("mongodb").BulkWriteOpResultObject>;
|
|
103
108
|
getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
|
|
109
|
+
deleteUnnecessaryProjectAttributesById(params: {
|
|
110
|
+
id: string;
|
|
111
|
+
}): Promise<void>;
|
|
104
112
|
}
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.MongoRepository = void 0;
|
|
|
24
24
|
const uniqid = require("uniqid");
|
|
25
25
|
const factory = require("../factory");
|
|
26
26
|
const event_1 = require("./mongoose/model/event");
|
|
27
|
+
const USE_DEPRECATED_EVENT_SEARCH_CONDITIONS = process.env.USE_DEPRECATED_EVENT_SEARCH_CONDITIONS === '1';
|
|
27
28
|
/**
|
|
28
29
|
* イベントリポジトリ
|
|
29
30
|
*/
|
|
@@ -33,7 +34,7 @@ class MongoRepository {
|
|
|
33
34
|
}
|
|
34
35
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
35
36
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
37
38
|
const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
|
|
38
39
|
const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
39
40
|
if (typeof projectIdEq === 'string') {
|
|
@@ -118,6 +119,15 @@ class MongoRepository {
|
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
121
|
}
|
|
122
|
+
const additionalPropertyElemMatch = (_h = conditions.additionalProperty) === null || _h === void 0 ? void 0 : _h.$elemMatch;
|
|
123
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
124
|
+
andConditions.push({
|
|
125
|
+
additionalProperty: {
|
|
126
|
+
$exists: true,
|
|
127
|
+
$elemMatch: additionalPropertyElemMatch
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
121
131
|
let params;
|
|
122
132
|
switch (conditions.typeOf) {
|
|
123
133
|
case factory.eventType.ScreeningEvent:
|
|
@@ -144,7 +154,7 @@ class MongoRepository {
|
|
|
144
154
|
}
|
|
145
155
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
146
156
|
/* istanbul ignore else */
|
|
147
|
-
const superEventLocationIdEq = (
|
|
157
|
+
const superEventLocationIdEq = (_l = (_k = (_j = params.superEvent) === null || _j === void 0 ? void 0 : _j.location) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.$eq;
|
|
148
158
|
if (typeof superEventLocationIdEq === 'string') {
|
|
149
159
|
andConditions.push({
|
|
150
160
|
'superEvent.location.id': {
|
|
@@ -190,47 +200,49 @@ class MongoRepository {
|
|
|
190
200
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
191
201
|
/* istanbul ignore else */
|
|
192
202
|
if (params.offers !== undefined) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
203
|
+
if (USE_DEPRECATED_EVENT_SEARCH_CONDITIONS) {
|
|
204
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
205
|
+
/* istanbul ignore else */
|
|
206
|
+
if (params.offers.availableFrom instanceof Date) {
|
|
207
|
+
andConditions.push({
|
|
208
|
+
'offers.availabilityEnds': {
|
|
209
|
+
$exists: true,
|
|
210
|
+
$gte: params.offers.availableFrom
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
215
|
+
/* istanbul ignore else */
|
|
216
|
+
if (params.offers.availableThrough instanceof Date) {
|
|
217
|
+
andConditions.push({
|
|
218
|
+
'offers.availabilityStarts': {
|
|
219
|
+
$exists: true,
|
|
220
|
+
$lte: params.offers.availableThrough
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
225
|
+
/* istanbul ignore else */
|
|
226
|
+
if (params.offers.validFrom instanceof Date) {
|
|
227
|
+
andConditions.push({
|
|
228
|
+
'offers.validThrough': {
|
|
229
|
+
$exists: true,
|
|
230
|
+
$gte: params.offers.validFrom
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
235
|
+
/* istanbul ignore else */
|
|
236
|
+
if (params.offers.validThrough instanceof Date) {
|
|
237
|
+
andConditions.push({
|
|
238
|
+
'offers.validFrom': {
|
|
239
|
+
$exists: true,
|
|
240
|
+
$lte: params.offers.validThrough
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
232
244
|
}
|
|
233
|
-
const itemOfferedIdIn = (
|
|
245
|
+
const itemOfferedIdIn = (_o = (_m = params.offers.itemOffered) === null || _m === void 0 ? void 0 : _m.id) === null || _o === void 0 ? void 0 : _o.$in;
|
|
234
246
|
if (Array.isArray(itemOfferedIdIn)) {
|
|
235
247
|
andConditions.push({
|
|
236
248
|
'offers.itemOffered.id': {
|
|
@@ -280,6 +292,15 @@ class MongoRepository {
|
|
|
280
292
|
}
|
|
281
293
|
}
|
|
282
294
|
}
|
|
295
|
+
const sellerMakesOfferElemMatch = (_r = (_q = (_p = params.offers) === null || _p === void 0 ? void 0 : _p.seller) === null || _q === void 0 ? void 0 : _q.makesOffer) === null || _r === void 0 ? void 0 : _r.$elemMatch;
|
|
296
|
+
if (typeof ((_s = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _s === void 0 ? void 0 : _s.$eq) === 'string') {
|
|
297
|
+
andConditions.push({
|
|
298
|
+
'offers.seller.makesOffer': {
|
|
299
|
+
$exists: true,
|
|
300
|
+
$elemMatch: sellerMakesOfferElemMatch
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
283
304
|
break;
|
|
284
305
|
case factory.eventType.ScreeningEventSeries:
|
|
285
306
|
params = conditions;
|
|
@@ -309,7 +330,7 @@ class MongoRepository {
|
|
|
309
330
|
]
|
|
310
331
|
});
|
|
311
332
|
}
|
|
312
|
-
const locationIdEq = (
|
|
333
|
+
const locationIdEq = (_u = (_t = params.location) === null || _t === void 0 ? void 0 : _t.id) === null || _u === void 0 ? void 0 : _u.$eq;
|
|
313
334
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
314
335
|
/* istanbul ignore else */
|
|
315
336
|
if (typeof locationIdEq === 'string') {
|
|
@@ -331,7 +352,7 @@ class MongoRepository {
|
|
|
331
352
|
});
|
|
332
353
|
}
|
|
333
354
|
}
|
|
334
|
-
const workPerformedIdentifierIn = (
|
|
355
|
+
const workPerformedIdentifierIn = (_v = params.workPerformed) === null || _v === void 0 ? void 0 : _v.identifiers;
|
|
335
356
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
336
357
|
/* istanbul ignore else */
|
|
337
358
|
if (Array.isArray(workPerformedIdentifierIn)) {
|
|
@@ -342,7 +363,7 @@ class MongoRepository {
|
|
|
342
363
|
}
|
|
343
364
|
});
|
|
344
365
|
}
|
|
345
|
-
const videoFormatTypeOfEq = (
|
|
366
|
+
const videoFormatTypeOfEq = (_x = (_w = params.videoFormat) === null || _w === void 0 ? void 0 : _w.typeOf) === null || _x === void 0 ? void 0 : _x.$eq;
|
|
346
367
|
if (typeof videoFormatTypeOfEq === 'string') {
|
|
347
368
|
andConditions.push({
|
|
348
369
|
'videoFormat.typeOf': {
|
|
@@ -351,7 +372,7 @@ class MongoRepository {
|
|
|
351
372
|
}
|
|
352
373
|
});
|
|
353
374
|
}
|
|
354
|
-
const videoFormatTypeOfIn = (
|
|
375
|
+
const videoFormatTypeOfIn = (_z = (_y = params.videoFormat) === null || _y === void 0 ? void 0 : _y.typeOf) === null || _z === void 0 ? void 0 : _z.$in;
|
|
355
376
|
if (Array.isArray(videoFormatTypeOfIn)) {
|
|
356
377
|
andConditions.push({
|
|
357
378
|
'videoFormat.typeOf': {
|
|
@@ -360,7 +381,7 @@ class MongoRepository {
|
|
|
360
381
|
}
|
|
361
382
|
});
|
|
362
383
|
}
|
|
363
|
-
const soundFormatTypeOfEq = (
|
|
384
|
+
const soundFormatTypeOfEq = (_1 = (_0 = params.soundFormat) === null || _0 === void 0 ? void 0 : _0.typeOf) === null || _1 === void 0 ? void 0 : _1.$eq;
|
|
364
385
|
if (typeof soundFormatTypeOfEq === 'string') {
|
|
365
386
|
andConditions.push({
|
|
366
387
|
'soundFormat.typeOf': {
|
|
@@ -369,7 +390,7 @@ class MongoRepository {
|
|
|
369
390
|
}
|
|
370
391
|
});
|
|
371
392
|
}
|
|
372
|
-
const soundFormatTypeOfIn = (
|
|
393
|
+
const soundFormatTypeOfIn = (_3 = (_2 = params.soundFormat) === null || _2 === void 0 ? void 0 : _2.typeOf) === null || _3 === void 0 ? void 0 : _3.$in;
|
|
373
394
|
if (Array.isArray(soundFormatTypeOfIn)) {
|
|
374
395
|
andConditions.push({
|
|
375
396
|
'soundFormat.typeOf': {
|
|
@@ -628,5 +649,20 @@ class MongoRepository {
|
|
|
628
649
|
.sort({ startDate: factory.sortType.Descending })
|
|
629
650
|
.cursor();
|
|
630
651
|
}
|
|
652
|
+
deleteUnnecessaryProjectAttributesById(params) {
|
|
653
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
654
|
+
yield this.eventModel.updateOne({
|
|
655
|
+
_id: { $eq: params.id }
|
|
656
|
+
}, {
|
|
657
|
+
$unset: {
|
|
658
|
+
'location.project': 1,
|
|
659
|
+
'workPerformed.project': 1,
|
|
660
|
+
'superEvent.location.project': 1,
|
|
661
|
+
'superEvent.workPerformed.project': 1
|
|
662
|
+
}
|
|
663
|
+
})
|
|
664
|
+
.exec();
|
|
665
|
+
});
|
|
666
|
+
}
|
|
631
667
|
}
|
|
632
668
|
exports.MongoRepository = MongoRepository;
|
|
@@ -163,5 +163,10 @@ class MongoRepository {
|
|
|
163
163
|
.exec();
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
+
getCursor(conditions, projection) {
|
|
167
|
+
return this.merchantReturnPolicyModel.find(conditions, projection)
|
|
168
|
+
.sort({ identifier: factory.sortType.Descending })
|
|
169
|
+
.cursor();
|
|
170
|
+
}
|
|
166
171
|
}
|
|
167
172
|
exports.MongoRepository = MongoRepository;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as mongoose from 'mongoose';
|
|
2
|
+
declare const modelName = "AdditionalProperty";
|
|
3
|
+
/**
|
|
4
|
+
* 追加特性スキーマ
|
|
5
|
+
*/
|
|
6
|
+
declare const schema: mongoose.Schema<mongoose.Document<any, any, any>, mongoose.Model<mongoose.Document<any, any, any>, any, any>, undefined, {}>;
|
|
7
|
+
export { modelName, schema };
|