@chevre/domain 22.2.0-alpha.11 → 22.2.0-alpha.13
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/playAroundTicket.ts +3 -2
- package/example/src/chevre/{projectReservationFields.ts → projectFields.ts} +6 -9
- package/lib/chevre/repo/categoryCode.d.ts +10 -2
- package/lib/chevre/repo/categoryCode.js +41 -19
- package/lib/chevre/repo/ownershipInfo.d.ts +2 -2
- package/lib/chevre/repo/ownershipInfo.js +40 -11
- package/lib/chevre/repo/paymentService.d.ts +2 -2
- package/lib/chevre/repo/paymentService.js +63 -28
- package/lib/chevre/repo/ticket.d.ts +3 -2
- package/lib/chevre/repo/ticket.js +23 -10
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +2 -2
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +2 -2
- package/lib/chevre/service/code.js +2 -2
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +2 -2
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +3 -3
- package/lib/chevre/service/offer/product.js +2 -4
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ async function main() {
|
|
|
14
14
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
15
15
|
|
|
16
16
|
const ticketRepo = await chevre.repository.Ticket.createInstance(mongoose.connection);
|
|
17
|
-
const tickets = await ticketRepo.
|
|
17
|
+
const tickets = await ticketRepo.projectFields(
|
|
18
18
|
{
|
|
19
19
|
limit: 1,
|
|
20
20
|
page: 1,
|
|
@@ -23,7 +23,8 @@ async function main() {
|
|
|
23
23
|
id: { $eq: project.id }
|
|
24
24
|
},
|
|
25
25
|
ticketToken: { $eq: TICKET_TOKEN }
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
|
+
[]
|
|
27
28
|
);
|
|
28
29
|
console.log('tickets:', tickets);
|
|
29
30
|
console.log(tickets.length, 'tickets found');
|
|
@@ -8,22 +8,19 @@ const project = { id: String(process.env.PROJECT_ID) };
|
|
|
8
8
|
async function main() {
|
|
9
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const ticketRepo = await chevre.repository.Ticket.createInstance(mongoose.connection);
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const docs = await ticketRepo.projectFields(
|
|
14
14
|
{
|
|
15
|
-
limit:
|
|
15
|
+
limit: 10,
|
|
16
16
|
page: 1,
|
|
17
|
-
typeOf: chevre.factory.reservationType.EventReservation,
|
|
18
17
|
project: { id: { $eq: project.id } }
|
|
19
18
|
},
|
|
20
|
-
|
|
21
|
-
id: 1
|
|
22
|
-
}
|
|
19
|
+
[]
|
|
23
20
|
);
|
|
24
21
|
// tslint:disable-next-line:no-null-keyword
|
|
25
|
-
console.dir(
|
|
26
|
-
console.log(
|
|
22
|
+
console.dir(docs, { depth: null });
|
|
23
|
+
console.log(docs.length, 'docs found');
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
main()
|
|
@@ -45,7 +45,15 @@ export declare class CategoryCodeRepo {
|
|
|
45
45
|
/**
|
|
46
46
|
* 検索
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
projectFields(params: factory.categoryCode.ISearchConditions,
|
|
49
|
+
/**
|
|
50
|
+
* 空の場合無効
|
|
51
|
+
*/
|
|
52
|
+
inclusion: IKeyOfProjection[],
|
|
53
|
+
/**
|
|
54
|
+
* 空の場合無効
|
|
55
|
+
*/
|
|
56
|
+
exclusion: IKeyOfProjection[]): Promise<(factory.categoryCode.ICategoryCode & {
|
|
49
57
|
id: string;
|
|
50
58
|
})[]>;
|
|
51
59
|
save(params: {
|
|
@@ -53,7 +61,7 @@ export declare class CategoryCodeRepo {
|
|
|
53
61
|
attributes: factory.categoryCode.ICategoryCode & {
|
|
54
62
|
$unset?: IUnset;
|
|
55
63
|
};
|
|
56
|
-
}): Promise<
|
|
64
|
+
}): Promise<{
|
|
57
65
|
id: string;
|
|
58
66
|
}>;
|
|
59
67
|
saveManyByCodeValue(params: {
|
|
@@ -25,6 +25,9 @@ const mongoose_1 = require("mongoose");
|
|
|
25
25
|
const categoryCode_1 = require("./mongoose/schemas/categoryCode");
|
|
26
26
|
const factory = require("../factory");
|
|
27
27
|
const settings_1 = require("../settings");
|
|
28
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
29
|
+
'additionalProperty', 'codeValue', 'color', 'image', 'inCodeSet', 'name', 'paymentMethod', 'project', 'typeOf'
|
|
30
|
+
];
|
|
28
31
|
/**
|
|
29
32
|
* 区分リポジトリ
|
|
30
33
|
*/
|
|
@@ -208,27 +211,43 @@ class CategoryCodeRepo {
|
|
|
208
211
|
/**
|
|
209
212
|
* 検索
|
|
210
213
|
*/
|
|
211
|
-
|
|
214
|
+
projectFields(params,
|
|
215
|
+
/**
|
|
216
|
+
* 空の場合無効
|
|
217
|
+
*/
|
|
218
|
+
inclusion,
|
|
219
|
+
/**
|
|
220
|
+
* 空の場合無効
|
|
221
|
+
*/
|
|
222
|
+
exclusion) {
|
|
212
223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
213
224
|
const conditions = CategoryCodeRepo.CREATE_MONGO_CONDITIONS(params);
|
|
214
|
-
let
|
|
225
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
215
226
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
216
|
-
inclusion.
|
|
217
|
-
projection[field] = 1;
|
|
218
|
-
});
|
|
227
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
219
228
|
}
|
|
220
229
|
else {
|
|
221
|
-
projection = {
|
|
222
|
-
__v: 0,
|
|
223
|
-
createdAt: 0,
|
|
224
|
-
updatedAt: 0
|
|
225
|
-
};
|
|
226
230
|
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
227
|
-
|
|
228
|
-
projection[field] = 0;
|
|
229
|
-
});
|
|
231
|
+
positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
230
232
|
}
|
|
231
233
|
}
|
|
234
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
235
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
236
|
+
// inclusion.forEach((field) => {
|
|
237
|
+
// projection[field] = 1;
|
|
238
|
+
// });
|
|
239
|
+
// } else {
|
|
240
|
+
// projection = {
|
|
241
|
+
// __v: 0,
|
|
242
|
+
// createdAt: 0,
|
|
243
|
+
// updatedAt: 0
|
|
244
|
+
// };
|
|
245
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
246
|
+
// exclusion.forEach((field) => {
|
|
247
|
+
// projection[field] = 0;
|
|
248
|
+
// });
|
|
249
|
+
// }
|
|
250
|
+
// }
|
|
232
251
|
const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
233
252
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
234
253
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
@@ -241,27 +260,30 @@ class CategoryCodeRepo {
|
|
|
241
260
|
query.sort(params.sort);
|
|
242
261
|
}
|
|
243
262
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
244
|
-
.
|
|
245
|
-
.
|
|
263
|
+
.lean() // 2024-08-19~
|
|
264
|
+
.exec();
|
|
246
265
|
});
|
|
247
266
|
}
|
|
248
267
|
save(params) {
|
|
249
268
|
return __awaiter(this, void 0, void 0, function* () {
|
|
269
|
+
let savedId;
|
|
250
270
|
let doc;
|
|
251
271
|
if (typeof params.id !== 'string') {
|
|
252
272
|
const _a = params.attributes, { id, $unset } = _a, creatingDoc = __rest(_a, ["id", "$unset"]);
|
|
253
|
-
doc = yield this.categoryCodeModel.create(creatingDoc);
|
|
273
|
+
doc = (yield this.categoryCodeModel.create(creatingDoc));
|
|
274
|
+
savedId = doc.id;
|
|
254
275
|
}
|
|
255
276
|
else {
|
|
256
277
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
257
278
|
const _b = params.attributes, { id, codeValue, inCodeSet, project, typeOf, $unset } = _b, updateFields = __rest(_b, ["id", "codeValue", "inCodeSet", "project", "typeOf", "$unset"]);
|
|
258
|
-
doc = yield this.categoryCodeModel.findOneAndUpdate({ _id: { $eq: params.id } }, Object.assign({ $set: updateFields }, ($unset !== undefined) ? { $unset } : undefined), { upsert: false, new: true })
|
|
279
|
+
doc = yield this.categoryCodeModel.findOneAndUpdate({ _id: { $eq: params.id } }, Object.assign({ $set: updateFields }, ($unset !== undefined) ? { $unset } : undefined), { upsert: false, new: true, projection: { _id: 1 } })
|
|
259
280
|
.exec();
|
|
281
|
+
savedId = params.id;
|
|
260
282
|
}
|
|
261
283
|
if (doc === null) {
|
|
262
284
|
throw new factory.errors.NotFound(this.categoryCodeModel.modelName);
|
|
263
285
|
}
|
|
264
|
-
return
|
|
286
|
+
return { id: savedId };
|
|
265
287
|
});
|
|
266
288
|
}
|
|
267
289
|
saveManyByCodeValue(params) {
|
|
@@ -302,7 +324,7 @@ class CategoryCodeRepo {
|
|
|
302
324
|
*/
|
|
303
325
|
deleteById(params) {
|
|
304
326
|
return __awaiter(this, void 0, void 0, function* () {
|
|
305
|
-
yield this.categoryCodeModel.findOneAndRemove({ _id: params.id })
|
|
327
|
+
yield this.categoryCodeModel.findOneAndRemove({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
|
|
306
328
|
.exec();
|
|
307
329
|
});
|
|
308
330
|
}
|
|
@@ -46,7 +46,7 @@ export declare class OwnershipInfoRepo {
|
|
|
46
46
|
/**
|
|
47
47
|
* 所有権を検索する
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
projectFields(params: factory.ownershipInfo.ISearchConditions, inclusion?: (keyof IOwnershipInfoWithId)[]): Promise<IOwnershipInfoWithId[]>;
|
|
50
50
|
/**
|
|
51
51
|
* 識別子から所有期限を変更する
|
|
52
52
|
* 存在しない場合undefinedを返す
|
|
@@ -57,7 +57,7 @@ export declare class OwnershipInfoRepo {
|
|
|
57
57
|
};
|
|
58
58
|
identifier: string;
|
|
59
59
|
ownedThrough: Date;
|
|
60
|
-
}): Promise<IOwnershipInfoWithId | undefined>;
|
|
60
|
+
}): Promise<Pick<IOwnershipInfoWithId, 'id' | 'identifier'> | undefined>;
|
|
61
61
|
/**
|
|
62
62
|
* 所有者の所有権を全て削除する
|
|
63
63
|
*/
|
|
@@ -270,7 +270,6 @@ class OwnershipInfoRepo {
|
|
|
270
270
|
throw new factory.errors.NotFound(this.ownershipInfoModel.modelName);
|
|
271
271
|
}
|
|
272
272
|
return { id: doc.id };
|
|
273
|
-
// return <IOwnershipInfo>doc.toObject();
|
|
274
273
|
});
|
|
275
274
|
}
|
|
276
275
|
projectFieldsById(params, inclusion) {
|
|
@@ -300,17 +299,34 @@ class OwnershipInfoRepo {
|
|
|
300
299
|
throw new factory.errors.NotFound(this.ownershipInfoModel.modelName);
|
|
301
300
|
}
|
|
302
301
|
return doc;
|
|
303
|
-
// return doc.toObject();
|
|
304
302
|
});
|
|
305
303
|
}
|
|
306
304
|
/**
|
|
307
305
|
* 所有権を検索する
|
|
308
306
|
*/
|
|
309
|
-
|
|
307
|
+
projectFields(params, inclusion) {
|
|
310
308
|
var _a;
|
|
311
309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
312
310
|
const conditions = OwnershipInfoRepo.CREATE_MONGO_CONDITIONS(params);
|
|
313
|
-
|
|
311
|
+
let projection = {
|
|
312
|
+
_id: 0,
|
|
313
|
+
id: { $toString: '$_id' },
|
|
314
|
+
project: 1,
|
|
315
|
+
typeOf: 1,
|
|
316
|
+
identifier: 1,
|
|
317
|
+
ownedBy: 1,
|
|
318
|
+
acquiredFrom: 1,
|
|
319
|
+
ownedFrom: 1,
|
|
320
|
+
ownedThrough: 1,
|
|
321
|
+
typeOfGood: 1
|
|
322
|
+
};
|
|
323
|
+
const positiveProjectionFields = (Array.isArray(inclusion))
|
|
324
|
+
? inclusion.filter((key) => key !== 'id' && String(key) !== '_id')
|
|
325
|
+
: undefined;
|
|
326
|
+
if (Array.isArray(positiveProjectionFields)) {
|
|
327
|
+
projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
328
|
+
}
|
|
329
|
+
const query = this.ownershipInfoModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
314
330
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
315
331
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
316
332
|
query.limit(params.limit)
|
|
@@ -322,8 +338,8 @@ class OwnershipInfoRepo {
|
|
|
322
338
|
query.sort({ ownedFrom: params.sort.ownedFrom });
|
|
323
339
|
}
|
|
324
340
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
325
|
-
.
|
|
326
|
-
.
|
|
341
|
+
.lean() // lean(2024-08-19~)
|
|
342
|
+
.exec();
|
|
327
343
|
});
|
|
328
344
|
}
|
|
329
345
|
/**
|
|
@@ -335,8 +351,15 @@ class OwnershipInfoRepo {
|
|
|
335
351
|
return this.ownershipInfoModel.findOneAndUpdate({
|
|
336
352
|
'project.id': { $eq: params.project.id },
|
|
337
353
|
identifier: { $eq: String(params.identifier) }
|
|
338
|
-
}, { ownedThrough: params.ownedThrough }, {
|
|
339
|
-
|
|
354
|
+
}, { ownedThrough: params.ownedThrough }, {
|
|
355
|
+
new: true,
|
|
356
|
+
projection: {
|
|
357
|
+
_id: 0,
|
|
358
|
+
id: { $toString: '$_id' },
|
|
359
|
+
identifier: 1
|
|
360
|
+
}
|
|
361
|
+
})
|
|
362
|
+
.lean()
|
|
340
363
|
.exec()
|
|
341
364
|
.then((doc) => {
|
|
342
365
|
// 存在しない場合も正常にハンドルする
|
|
@@ -344,7 +367,7 @@ class OwnershipInfoRepo {
|
|
|
344
367
|
return;
|
|
345
368
|
}
|
|
346
369
|
else {
|
|
347
|
-
return doc
|
|
370
|
+
return doc;
|
|
348
371
|
}
|
|
349
372
|
});
|
|
350
373
|
});
|
|
@@ -431,7 +454,10 @@ class OwnershipInfoRepo {
|
|
|
431
454
|
};
|
|
432
455
|
}
|
|
433
456
|
if (newOwner !== undefined) {
|
|
434
|
-
const doc = yield this.ownershipInfoModel.findOneAndUpdate({ _id: { $eq: params.id } }, { $addToSet: { ownedBy: newOwner } }, {
|
|
457
|
+
const doc = yield this.ownershipInfoModel.findOneAndUpdate({ _id: { $eq: params.id } }, { $addToSet: { ownedBy: newOwner } }, {
|
|
458
|
+
new: true,
|
|
459
|
+
projection: { _id: 1 }
|
|
460
|
+
})
|
|
435
461
|
.exec();
|
|
436
462
|
if (doc === null) {
|
|
437
463
|
throw new factory.errors.NotFound(this.ownershipInfoModel.modelName);
|
|
@@ -447,7 +473,10 @@ class OwnershipInfoRepo {
|
|
|
447
473
|
if (typeof params.ownedBy.id !== 'string' || params.ownedBy.id.length === 0) {
|
|
448
474
|
throw new factory.errors.ArgumentNull('ownedBy.id');
|
|
449
475
|
}
|
|
450
|
-
const doc = yield this.ownershipInfoModel.findOneAndUpdate({ _id: { $eq: params.id } }, { $pull: { ownedBy: { id: params.ownedBy.id } } }, {
|
|
476
|
+
const doc = yield this.ownershipInfoModel.findOneAndUpdate({ _id: { $eq: params.id } }, { $pull: { ownedBy: { id: params.ownedBy.id } } }, {
|
|
477
|
+
new: true,
|
|
478
|
+
projection: { _id: 1 }
|
|
479
|
+
})
|
|
451
480
|
.exec();
|
|
452
481
|
if (doc === null) {
|
|
453
482
|
throw new factory.errors.NotFound(this.ownershipInfoModel.modelName);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import * as factory from '../factory';
|
|
3
3
|
type IUnsetKey = keyof Pick<factory.service.paymentService.IService, 'additionalProperty' | 'availableChannel' | 'serviceOutput' | 'serviceType'>;
|
|
4
|
-
type IKeyOfProjection4paymentService = keyof factory.service.paymentService.IService
|
|
4
|
+
type IKeyOfProjection4paymentService = keyof factory.service.paymentService.IService;
|
|
5
5
|
/**
|
|
6
6
|
* 決済サービス検索条件
|
|
7
7
|
*/
|
|
@@ -37,7 +37,7 @@ export declare class PaymentServiceRepo {
|
|
|
37
37
|
/**
|
|
38
38
|
* 決済サービスを検索する
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
projectFields(conditions: ISearchConditions4paymentService, inclusion: IKeyOfProjection4paymentService[], exclusion: IKeyOfProjection4paymentService[]): Promise<(factory.service.paymentService.IService & {
|
|
41
41
|
id: string;
|
|
42
42
|
})[]>;
|
|
43
43
|
deletePaymentServiceById(params: {
|
|
@@ -24,6 +24,17 @@ exports.PaymentServiceRepo = void 0;
|
|
|
24
24
|
const factory = require("../factory");
|
|
25
25
|
const settings_1 = require("../settings");
|
|
26
26
|
const paymentService_1 = require("./mongoose/schemas/paymentService");
|
|
27
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
28
|
+
'project',
|
|
29
|
+
'typeOf',
|
|
30
|
+
'additionalProperty',
|
|
31
|
+
'availableChannel',
|
|
32
|
+
'description',
|
|
33
|
+
'name',
|
|
34
|
+
'productID',
|
|
35
|
+
'serviceOutput',
|
|
36
|
+
'serviceType'
|
|
37
|
+
];
|
|
27
38
|
/**
|
|
28
39
|
* 決済サービスリポジトリ
|
|
29
40
|
*/
|
|
@@ -155,70 +166,94 @@ class PaymentServiceRepo {
|
|
|
155
166
|
* 決済サービスを保管する
|
|
156
167
|
*/
|
|
157
168
|
savePaymentService(params) {
|
|
169
|
+
var _a, _b;
|
|
158
170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
171
|
let doc;
|
|
172
|
+
let savedId;
|
|
160
173
|
if (typeof params.id === 'string') {
|
|
161
174
|
// 上書き禁止属性を除外
|
|
162
|
-
const
|
|
175
|
+
const _c = params.$set, { id, productID, project, typeOf, provider } = _c, setFields = __rest(_c, ["id", "productID", "project", "typeOf", "provider"]);
|
|
163
176
|
switch (typeOf) {
|
|
164
177
|
case factory.service.paymentService.PaymentServiceType.CreditCard:
|
|
165
178
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
166
179
|
doc = yield this.paymentServiceModel.findOneAndUpdate({
|
|
167
180
|
_id: { $eq: params.id },
|
|
168
181
|
typeOf: { $eq: typeOf }
|
|
169
|
-
}, { $set: setFields }, { upsert: false, new: true, projection: { _id: 1 } })
|
|
182
|
+
}, { $set: setFields }, { upsert: false, new: true, projection: { _id: 1, id: { $toString: '$_id' } } })
|
|
183
|
+
.lean()
|
|
170
184
|
.exec();
|
|
185
|
+
if (doc === null) {
|
|
186
|
+
throw new factory.errors.NotFound(this.paymentServiceModel.modelName);
|
|
187
|
+
}
|
|
171
188
|
break;
|
|
172
189
|
default:
|
|
173
190
|
throw new factory.errors.NotImplemented(`${typeOf} not implemented`);
|
|
174
191
|
}
|
|
192
|
+
savedId = params.id;
|
|
175
193
|
}
|
|
176
194
|
else {
|
|
177
|
-
const
|
|
195
|
+
const _d = params.$set, { id } = _d, createParams = __rest(_d, ["id"]);
|
|
178
196
|
if (params.createIfNotExist === true) {
|
|
179
197
|
doc = yield this.paymentServiceModel.findOneAndUpdate({
|
|
180
198
|
'project.id': { $eq: createParams.project.id },
|
|
181
199
|
typeOf: { $eq: createParams.typeOf }
|
|
182
|
-
}, { $setOnInsert: createParams }, { new: true, upsert: true, projection: { _id: 1 } })
|
|
200
|
+
}, { $setOnInsert: createParams }, { new: true, upsert: true, projection: { _id: 1, id: { $toString: '$_id' } } })
|
|
201
|
+
.lean()
|
|
183
202
|
.exec();
|
|
203
|
+
if (doc === null) {
|
|
204
|
+
throw new factory.errors.NotFound(this.paymentServiceModel.modelName);
|
|
205
|
+
}
|
|
206
|
+
savedId = doc.id;
|
|
184
207
|
}
|
|
185
208
|
else {
|
|
186
|
-
doc =
|
|
209
|
+
// doc = await this.paymentServiceModel.create(createParams);
|
|
210
|
+
const result = yield this.paymentServiceModel.insertMany(createParams, { rawResult: true });
|
|
211
|
+
const insertedId = (_b = (_a = result.insertedIds) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toHexString();
|
|
212
|
+
if (typeof insertedId !== 'string') {
|
|
213
|
+
throw new factory.errors.Internal(`paymentService not saved unexpectedly. result:${JSON.stringify(result)}`);
|
|
214
|
+
}
|
|
215
|
+
savedId = insertedId;
|
|
187
216
|
}
|
|
188
217
|
}
|
|
189
|
-
|
|
190
|
-
throw new factory.errors.NotFound(this.paymentServiceModel.modelName);
|
|
191
|
-
}
|
|
192
|
-
return doc.toObject();
|
|
218
|
+
return { id: savedId };
|
|
193
219
|
});
|
|
194
220
|
}
|
|
195
221
|
/**
|
|
196
222
|
* 決済サービスを検索する
|
|
197
223
|
*/
|
|
198
|
-
|
|
224
|
+
projectFields(conditions, inclusion, exclusion) {
|
|
199
225
|
var _a;
|
|
200
226
|
return __awaiter(this, void 0, void 0, function* () {
|
|
201
227
|
const andConditions = PaymentServiceRepo.CREATE_MONGO_CONDITIONS(conditions);
|
|
202
|
-
let
|
|
228
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
203
229
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
204
|
-
inclusion.
|
|
205
|
-
projection[field] = 1;
|
|
206
|
-
});
|
|
230
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
207
231
|
}
|
|
208
232
|
else {
|
|
209
|
-
projection = {
|
|
210
|
-
__v: 0,
|
|
211
|
-
createdAt: 0,
|
|
212
|
-
updatedAt: 0,
|
|
213
|
-
offers: 0,
|
|
214
|
-
provider: 0 // paymentServiceProviderRepoへの完全移行につき除外(2023-12-20~)
|
|
215
|
-
};
|
|
216
233
|
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
217
|
-
|
|
218
|
-
projection[field] = 0;
|
|
219
|
-
});
|
|
234
|
+
positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
220
235
|
}
|
|
221
236
|
}
|
|
237
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
238
|
+
// let projection: { [key: string]: number } = {};
|
|
239
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
240
|
+
// inclusion.forEach((field) => {
|
|
241
|
+
// projection[field] = 1;
|
|
242
|
+
// });
|
|
243
|
+
// } else {
|
|
244
|
+
// projection = {
|
|
245
|
+
// __v: 0,
|
|
246
|
+
// createdAt: 0,
|
|
247
|
+
// updatedAt: 0,
|
|
248
|
+
// offers: 0,
|
|
249
|
+
// provider: 0 // paymentServiceProviderRepoへの完全移行につき除外(2023-12-20~)
|
|
250
|
+
// };
|
|
251
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
252
|
+
// exclusion.forEach((field) => {
|
|
253
|
+
// projection[field] = 0;
|
|
254
|
+
// });
|
|
255
|
+
// }
|
|
256
|
+
// }
|
|
222
257
|
const query = this.paymentServiceModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
|
|
223
258
|
if (typeof conditions.limit === 'number' && conditions.limit > 0) {
|
|
224
259
|
const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
|
|
@@ -231,13 +266,13 @@ class PaymentServiceRepo {
|
|
|
231
266
|
query.sort({ productID: conditions.sort.productID });
|
|
232
267
|
}
|
|
233
268
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
234
|
-
.
|
|
235
|
-
.
|
|
269
|
+
.lean() // 2024-08-20~
|
|
270
|
+
.exec();
|
|
236
271
|
});
|
|
237
272
|
}
|
|
238
273
|
deletePaymentServiceById(params) {
|
|
239
274
|
return __awaiter(this, void 0, void 0, function* () {
|
|
240
|
-
yield this.paymentServiceModel.findOneAndDelete({ _id: params.id })
|
|
275
|
+
yield this.paymentServiceModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
|
|
241
276
|
.exec();
|
|
242
277
|
});
|
|
243
278
|
}
|
|
@@ -247,7 +282,7 @@ class PaymentServiceRepo {
|
|
|
247
282
|
findAvailableChannel(params) {
|
|
248
283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
249
284
|
let paymentService;
|
|
250
|
-
paymentService = (yield this.
|
|
285
|
+
paymentService = (yield this.projectFields({
|
|
251
286
|
limit: 1,
|
|
252
287
|
page: 1,
|
|
253
288
|
project: { id: { $eq: params.project.id } },
|
|
@@ -4,7 +4,7 @@ export interface ITicketIssuedBy {
|
|
|
4
4
|
id: string;
|
|
5
5
|
typeOf: factory.organizationType.Corporation | factory.organizationType.Project;
|
|
6
6
|
}
|
|
7
|
-
interface ITicket {
|
|
7
|
+
export interface ITicket {
|
|
8
8
|
/**
|
|
9
9
|
* チケットID(jti)
|
|
10
10
|
*/
|
|
@@ -42,6 +42,7 @@ interface ISearchConditions {
|
|
|
42
42
|
$eq?: string;
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
+
type IKeyOfProjection = keyof ITicket;
|
|
45
46
|
/**
|
|
46
47
|
* チケットリポジトリ
|
|
47
48
|
*/
|
|
@@ -53,6 +54,6 @@ export declare class TicketRepo {
|
|
|
53
54
|
* 承認コードからチケットを発行する
|
|
54
55
|
*/
|
|
55
56
|
issueByTicketToken(params: IIssueParams): Promise<Pick<ITicket, 'id'>>;
|
|
56
|
-
|
|
57
|
+
projectFields(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<ITicket[]>;
|
|
57
58
|
}
|
|
58
59
|
export {};
|
|
@@ -13,6 +13,13 @@ exports.TicketRepo = void 0;
|
|
|
13
13
|
const factory = require("../factory");
|
|
14
14
|
const settings_1 = require("../settings");
|
|
15
15
|
const ticket_1 = require("./mongoose/schemas/ticket");
|
|
16
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
17
|
+
'project',
|
|
18
|
+
'typeOf',
|
|
19
|
+
'ticketToken',
|
|
20
|
+
'dateIssued',
|
|
21
|
+
'issuedBy'
|
|
22
|
+
];
|
|
16
23
|
/**
|
|
17
24
|
* チケットリポジトリ
|
|
18
25
|
*/
|
|
@@ -41,6 +48,7 @@ class TicketRepo {
|
|
|
41
48
|
* 承認コードからチケットを発行する
|
|
42
49
|
*/
|
|
43
50
|
issueByTicketToken(params) {
|
|
51
|
+
var _a, _b;
|
|
44
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
53
|
const { ticketToken, project, issuedBy } = params;
|
|
46
54
|
const ticketIssuedBy = (typeof (issuedBy === null || issuedBy === void 0 ? void 0 : issuedBy.id) === 'string' && issuedBy.typeOf === factory.organizationType.Corporation)
|
|
@@ -53,19 +61,24 @@ class TicketRepo {
|
|
|
53
61
|
ticketToken,
|
|
54
62
|
typeOf: 'Ticket'
|
|
55
63
|
};
|
|
56
|
-
const
|
|
57
|
-
|
|
64
|
+
const result = yield this.ticketModel.insertMany(creatingTicket, { rawResult: true });
|
|
65
|
+
const insertedId = (_b = (_a = result.insertedIds) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toHexString();
|
|
66
|
+
if (typeof insertedId !== 'string') {
|
|
67
|
+
throw new factory.errors.Internal(`ticket not saved unexpectedly. result:${JSON.stringify(result)}`);
|
|
68
|
+
}
|
|
69
|
+
return { id: insertedId };
|
|
58
70
|
});
|
|
59
71
|
}
|
|
60
|
-
|
|
72
|
+
projectFields(params, inclusion) {
|
|
61
73
|
var _a;
|
|
62
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
75
|
const conditions = TicketRepo.CREATE_MONGO_CONDITIONS(params);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
76
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
77
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
78
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
79
|
+
}
|
|
80
|
+
const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
|
|
81
|
+
const query = this.ticketModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
69
82
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
70
83
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
71
84
|
query.limit(params.limit)
|
|
@@ -75,8 +88,8 @@ class TicketRepo {
|
|
|
75
88
|
query.sort({ dateIssued: params.sort.dateIssued });
|
|
76
89
|
}
|
|
77
90
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
78
|
-
.
|
|
79
|
-
.
|
|
91
|
+
.lean() // 2024-08-20~
|
|
92
|
+
.exec();
|
|
80
93
|
});
|
|
81
94
|
}
|
|
82
95
|
}
|
|
@@ -6,6 +6,6 @@ export declare function createStartParams(params: factory.assetTransaction.pay.I
|
|
|
6
6
|
transactionNumber: string;
|
|
7
7
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
8
8
|
amount: number;
|
|
9
|
-
paymentService?: factory.service.paymentService.IService | factory.product.IProduct
|
|
9
|
+
paymentService?: Pick<factory.service.paymentService.IService, 'availableChannel' | 'id' | 'serviceOutput' | 'serviceType'> | Pick<factory.product.IProduct, 'availableChannel' | 'id' | 'serviceOutput' | 'serviceType'>;
|
|
10
10
|
location?: factory.action.trade.pay.ILocation;
|
|
11
11
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Pay>;
|
|
@@ -280,13 +280,13 @@ function fixPaymentService(params) {
|
|
|
280
280
|
}
|
|
281
281
|
break;
|
|
282
282
|
default:
|
|
283
|
-
paymentService = (yield repos.paymentService.
|
|
283
|
+
paymentService = (yield repos.paymentService.projectFields({
|
|
284
284
|
limit: 1,
|
|
285
285
|
page: 1,
|
|
286
286
|
project: { id: { $eq: params.project.id } },
|
|
287
287
|
typeOf: { $eq: paymentServiceType },
|
|
288
288
|
id: { $eq: getPaymentServiceId(params) }
|
|
289
|
-
}, [], [])).shift();
|
|
289
|
+
}, ['availableChannel', 'serviceOutput', 'serviceType'], [])).shift();
|
|
290
290
|
if (paymentService === undefined) {
|
|
291
291
|
throw new factory.errors.NotFound('PaymentService');
|
|
292
292
|
}
|
|
@@ -6,5 +6,5 @@ export declare function createStartParams(params: factory.assetTransaction.refun
|
|
|
6
6
|
transactionNumber: string;
|
|
7
7
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
8
8
|
payAction: factory.action.trade.pay.IAction;
|
|
9
|
-
paymentService?: factory.product.IProduct | factory.service.paymentService.IService
|
|
9
|
+
paymentService?: factory.product.IProduct | Pick<factory.service.paymentService.IService, 'availableChannel' | 'id' | 'typeOf' | 'serviceOutput'>;
|
|
10
10
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Refund>;
|
|
@@ -98,13 +98,13 @@ function fixPaymentService(params) {
|
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
100
100
|
default:
|
|
101
|
-
paymentService = (yield repos.paymentService.
|
|
101
|
+
paymentService = (yield repos.paymentService.projectFields({
|
|
102
102
|
limit: 1,
|
|
103
103
|
page: 1,
|
|
104
104
|
project: { id: { $eq: params.payAction.project.id } },
|
|
105
105
|
typeOf: { $eq: params.paymentServiceType },
|
|
106
106
|
id: { $eq: paymentServiceId }
|
|
107
|
-
}, [], [])).shift();
|
|
107
|
+
}, ['availableChannel', 'serviceOutput', 'typeOf'], [])).shift();
|
|
108
108
|
if (paymentService === undefined) {
|
|
109
109
|
throw new factory.errors.NotFound('PaymentService');
|
|
110
110
|
}
|
|
@@ -309,12 +309,12 @@ function validateProgramMembershipUsed(params) {
|
|
|
309
309
|
if (typeof issuedThroughId !== 'string' || issuedThroughId === '') {
|
|
310
310
|
throw new factory.errors.ArgumentNull('acceptedOffer.itemOffered.serviceOutput.programMembershipUsed.issuedThrough.id');
|
|
311
311
|
}
|
|
312
|
-
permitIssuedThrough = (yield repos.paymentService.
|
|
312
|
+
permitIssuedThrough = (yield repos.paymentService.projectFields({
|
|
313
313
|
limit: 1,
|
|
314
314
|
page: 1,
|
|
315
315
|
id: { $eq: issuedThroughId },
|
|
316
316
|
typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard }
|
|
317
|
-
}, ['
|
|
317
|
+
}, ['typeOf', 'project', 'serviceType', 'serviceOutput'], [])).shift();
|
|
318
318
|
if (permitIssuedThrough === undefined) {
|
|
319
319
|
throw new factory.errors.NotFound(factory.service.paymentService.PaymentServiceType.CreditCard);
|
|
320
320
|
}
|
|
@@ -110,12 +110,12 @@ function payload2authorizeObject(params) {
|
|
|
110
110
|
// }
|
|
111
111
|
if (typeof payload.jti === 'string') {
|
|
112
112
|
// jtiに対応(2024-05-08~)
|
|
113
|
-
const ticket = (yield repos.ticket.
|
|
113
|
+
const ticket = (yield repos.ticket.projectFields({
|
|
114
114
|
limit: 1,
|
|
115
115
|
page: 1,
|
|
116
116
|
project: { id: { $eq: params.project.id } },
|
|
117
117
|
id: { $eq: payload.jti }
|
|
118
|
-
})).shift();
|
|
118
|
+
}, ['ticketToken'])).shift();
|
|
119
119
|
if (ticket === undefined) {
|
|
120
120
|
throw new factory.errors.NotFound('Ticket');
|
|
121
121
|
}
|
|
@@ -236,7 +236,7 @@ function saveScreeningEventSeries(params) {
|
|
|
236
236
|
kubunClass: '043'
|
|
237
237
|
});
|
|
238
238
|
debug('kubunNames found.');
|
|
239
|
-
const availablePaymentMethodTypes = yield repos.categoryCode.
|
|
239
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
|
|
240
240
|
project: { id: { $eq: params.project.id } },
|
|
241
241
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
242
242
|
}, ['additionalProperty', 'codeValue'], []);
|
|
@@ -60,12 +60,12 @@ function requestedProgramMembershipUsed2permit(params) {
|
|
|
60
60
|
else if ((programMembershipUsed === null || programMembershipUsed === void 0 ? void 0 : programMembershipUsed.typeOf) === 'Ticket') {
|
|
61
61
|
const { ticketToken } = programMembershipUsed;
|
|
62
62
|
if (typeof ticketToken === 'string') {
|
|
63
|
-
const ticket = (yield repos.ticket.
|
|
63
|
+
const ticket = (yield repos.ticket.projectFields({
|
|
64
64
|
limit: 1,
|
|
65
65
|
page: 1,
|
|
66
66
|
project: { id: { $eq: params.project.id } },
|
|
67
67
|
ticketToken: { $eq: ticketToken }
|
|
68
|
-
})).shift();
|
|
68
|
+
}, ['ticketToken'])).shift();
|
|
69
69
|
if (ticket === undefined) {
|
|
70
70
|
throw new factory.errors.NotFound('Ticket');
|
|
71
71
|
}
|
|
@@ -15,7 +15,7 @@ const factory_1 = require("./importFromCOA/factory");
|
|
|
15
15
|
function importFromCOA(params) {
|
|
16
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
// 通貨区分検索
|
|
18
|
-
const currencyTypes = yield repos.categoryCode.
|
|
18
|
+
const currencyTypes = yield repos.categoryCode.projectFields({
|
|
19
19
|
limit: 1,
|
|
20
20
|
page: 1,
|
|
21
21
|
project: { id: { $eq: params.project.id } },
|
|
@@ -23,7 +23,7 @@ function importFromCOA(params) {
|
|
|
23
23
|
}, [], []);
|
|
24
24
|
const defaultCurrencyType = currencyTypes.shift();
|
|
25
25
|
// メンバーシップ区分検索
|
|
26
|
-
const membershipTypes = yield repos.categoryCode.
|
|
26
|
+
const membershipTypes = yield repos.categoryCode.projectFields({
|
|
27
27
|
limit: 1,
|
|
28
28
|
page: 1,
|
|
29
29
|
project: { id: { $eq: params.project.id } },
|
|
@@ -53,15 +53,15 @@ function authorize(params) {
|
|
|
53
53
|
'superEvent', 'typeOf', 'identifier', 'name'
|
|
54
54
|
] // optimize(2024-07-18~)
|
|
55
55
|
);
|
|
56
|
-
const availablePaymentMethodTypes = yield repos.categoryCode.
|
|
56
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
|
|
57
57
|
project: { id: { $eq: transaction.project.id } },
|
|
58
58
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
59
59
|
}, [], []);
|
|
60
|
-
const seatingTypes = yield repos.categoryCode.
|
|
60
|
+
const seatingTypes = yield repos.categoryCode.projectFields({
|
|
61
61
|
project: { id: { $eq: transaction.project.id } },
|
|
62
62
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
63
63
|
}, [], []);
|
|
64
|
-
const videoFormatTypes = yield repos.categoryCode.
|
|
64
|
+
const videoFormatTypes = yield repos.categoryCode.projectFields({
|
|
65
65
|
project: { id: { $eq: transaction.project.id } },
|
|
66
66
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
67
67
|
}, [], []);
|
|
@@ -77,15 +77,15 @@ function changeOffers(params) {
|
|
|
77
77
|
'superEvent', 'typeOf', 'identifier', 'name'
|
|
78
78
|
] // optimize(2024-07-18~)
|
|
79
79
|
);
|
|
80
|
-
const availablePaymentMethodTypes = yield repos.categoryCode.
|
|
80
|
+
const availablePaymentMethodTypes = yield repos.categoryCode.projectFields({
|
|
81
81
|
project: { id: { $eq: transaction.project.id } },
|
|
82
82
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
83
83
|
}, [], []);
|
|
84
|
-
const seatingTypes = yield repos.categoryCode.
|
|
84
|
+
const seatingTypes = yield repos.categoryCode.projectFields({
|
|
85
85
|
project: { id: { $eq: transaction.project.id } },
|
|
86
86
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
87
87
|
}, [], []);
|
|
88
|
-
const videoFormatTypes = yield repos.categoryCode.
|
|
88
|
+
const videoFormatTypes = yield repos.categoryCode.projectFields({
|
|
89
89
|
project: { id: { $eq: transaction.project.id } },
|
|
90
90
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
91
91
|
}, [], []);
|
|
@@ -344,9 +344,7 @@ function checkIfRegistered(params) {
|
|
|
344
344
|
// メンバーシップについては、登録済かどうか確認する
|
|
345
345
|
if (params.product.typeOf === factory.product.ProductType.MembershipService) {
|
|
346
346
|
// プロダクトによって発行されたPermitを所有していれば、登録済
|
|
347
|
-
const searchOwnershipInfosResult = yield repos.ownershipInfo.
|
|
348
|
-
// iss: params.iss,
|
|
349
|
-
// project: { id: { $eq: params.project.id } },
|
|
347
|
+
const searchOwnershipInfosResult = yield repos.ownershipInfo.projectFields({
|
|
350
348
|
limit: 1,
|
|
351
349
|
page: 1,
|
|
352
350
|
ownedBy: { id: params.agent.id },
|
|
@@ -359,7 +357,7 @@ function checkIfRegistered(params) {
|
|
|
359
357
|
},
|
|
360
358
|
ownedFrom: params.now,
|
|
361
359
|
ownedThrough: params.now
|
|
362
|
-
});
|
|
360
|
+
}, []);
|
|
363
361
|
const ownershipInfos = searchOwnershipInfosResult;
|
|
364
362
|
if (ownershipInfos.length > 0) {
|
|
365
363
|
// Already registered
|
|
@@ -23,12 +23,12 @@ function verifyTicketTokenAsNeeded(params) {
|
|
|
23
23
|
// トークン化されたメンバーシップがリクエストされた場合、実メンバーシップ情報へ変換する
|
|
24
24
|
if (typeof ticketToken === 'string' && ticketToken !== '') {
|
|
25
25
|
let authorizedObject;
|
|
26
|
-
const ticket = (yield repos.ticket.
|
|
26
|
+
const ticket = (yield repos.ticket.projectFields({
|
|
27
27
|
limit: 1,
|
|
28
28
|
page: 1,
|
|
29
29
|
project: { id: { $eq: project.id } },
|
|
30
30
|
ticketToken: { $eq: ticketToken }
|
|
31
|
-
})).shift();
|
|
31
|
+
}, ['ticketToken'])).shift();
|
|
32
32
|
if (ticket === undefined) {
|
|
33
33
|
throw new factory.errors.NotFound('Ticket');
|
|
34
34
|
}
|
|
@@ -29,7 +29,7 @@ function syncCategoryCode(params) {
|
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
for (const categoryCodeId of params.ids) {
|
|
32
|
-
const syncingCategoryCode = (yield repos.categoryCode.
|
|
32
|
+
const syncingCategoryCode = (yield repos.categoryCode.projectFields({
|
|
33
33
|
limit: 1,
|
|
34
34
|
page: 1,
|
|
35
35
|
project: { id: { $eq: params.project.id } },
|
|
@@ -322,7 +322,7 @@ function createInformProductTasks(params) {
|
|
|
322
322
|
}
|
|
323
323
|
function createInformCategoryCodeTasks(params) {
|
|
324
324
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
325
|
-
const categoryCodes4inform = yield repos.categoryCode.
|
|
325
|
+
const categoryCodes4inform = yield repos.categoryCode.projectFields({
|
|
326
326
|
id: { $in: params.ids },
|
|
327
327
|
// ひとまずDistributorTypeのみ
|
|
328
328
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.DistributorType } }
|
package/package.json
CHANGED