@chevre/domain 22.2.0-alpha.2 → 22.2.0-alpha.20
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} +10 -8
- package/example/src/chevre/{projectReservationFieldsById.ts → projectOwnershipInfoFieldsById.ts} +4 -4
- package/example/src/chevre/searchSellersByAggregate.ts +3 -3
- package/example/src/chevre/unsetUnnecessaryFields.ts +4 -30
- package/lib/chevre/repo/authorization.d.ts +3 -1
- package/lib/chevre/repo/authorization.js +21 -10
- package/lib/chevre/repo/categoryCode.d.ts +14 -2
- package/lib/chevre/repo/categoryCode.js +41 -19
- package/lib/chevre/repo/mongoose/schemas/paymentService.js +12 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +5 -12
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/seller.js +21 -23
- package/lib/chevre/repo/ownershipInfo.d.ts +10 -6
- package/lib/chevre/repo/ownershipInfo.js +75 -19
- package/lib/chevre/repo/paymentService.d.ts +2 -2
- package/lib/chevre/repo/paymentService.js +108 -58
- package/lib/chevre/repo/paymentServiceProvider.d.ts +1 -10
- package/lib/chevre/repo/product.d.ts +2 -2
- package/lib/chevre/repo/product.js +67 -33
- package/lib/chevre/repo/seller.d.ts +10 -12
- package/lib/chevre/repo/seller.js +61 -27
- package/lib/chevre/repo/ticket.d.ts +3 -2
- package/lib/chevre/repo/ticket.js +23 -10
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +3 -3
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund/factory.js +1 -1
- package/lib/chevre/service/assetTransaction/refund.js +3 -3
- package/lib/chevre/service/assetTransaction/registerService.js +3 -5
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +26 -23
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/start.js +1 -3
- package/lib/chevre/service/code.js +2 -2
- package/lib/chevre/service/event.js +3 -3
- package/lib/chevre/service/moneyTransfer.js +1 -3
- package/lib/chevre/service/offer/event/authorize/factory.js +34 -6
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +22 -22
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/offer/event/importFromCOA/factory.d.ts +3 -1
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -12
- 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/searchProductOffers.js +1 -3
- package/lib/chevre/service/offer/product.d.ts +1 -1
- package/lib/chevre/service/offer/product.js +4 -6
- package/lib/chevre/service/order/sendOrder.js +9 -5
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +1 -6
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +26 -34
- package/lib/chevre/service/payment/any.d.ts +3 -3
- package/lib/chevre/service/payment/any.js +15 -7
- package/lib/chevre/service/payment/paymentCard.js +1 -3
- package/lib/chevre/service/report/ownershipInfo.d.ts +3 -1
- package/lib/chevre/service/task/authorizePayment.js +0 -2
- package/lib/chevre/service/task/onAuthorizationCreated.js +20 -16
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +2 -2
- package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +36 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/package.json +3 -3
- package/example/src/chevre/searchProducts.ts +0 -28
|
@@ -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');
|
|
@@ -5,25 +5,27 @@ import { chevre } from '../../../lib/index';
|
|
|
5
5
|
|
|
6
6
|
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
7
|
|
|
8
|
+
mongoose.Model.on('index', (...args) => {
|
|
9
|
+
console.error('******** index event emitted. ********\n', args);
|
|
10
|
+
});
|
|
11
|
+
|
|
8
12
|
async function main() {
|
|
9
13
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
14
|
|
|
11
|
-
const
|
|
15
|
+
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
12
16
|
|
|
13
|
-
const
|
|
17
|
+
const docs = await sellerRepo.projectFields(
|
|
14
18
|
{
|
|
15
19
|
limit: 1,
|
|
16
20
|
page: 1,
|
|
17
|
-
typeOf: chevre.factory.reservationType.EventReservation,
|
|
18
21
|
project: { id: { $eq: project.id } }
|
|
19
22
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
+
[],
|
|
24
|
+
['hasMerchantReturnPolicy', 'makesOffer', 'additionalProperty']
|
|
23
25
|
);
|
|
24
26
|
// tslint:disable-next-line:no-null-keyword
|
|
25
|
-
console.dir(
|
|
26
|
-
console.log(
|
|
27
|
+
console.dir(docs, { depth: null });
|
|
28
|
+
console.log(docs.length, 'docs found');
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
main()
|
package/example/src/chevre/{projectReservationFieldsById.ts → projectOwnershipInfoFieldsById.ts}
RENAMED
|
@@ -8,12 +8,12 @@ import { chevre } from '../../../lib/index';
|
|
|
8
8
|
async function main() {
|
|
9
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
const result = await
|
|
11
|
+
const ownershipInfoRepo = await chevre.repository.OwnershipInfo.createInstance(mongoose.connection);
|
|
12
|
+
const result = await ownershipInfoRepo.projectFieldsById(
|
|
13
13
|
{
|
|
14
|
-
id: '
|
|
15
|
-
inclusion: ['reservationStatus', 'reservationFor.id']
|
|
14
|
+
id: 'd9080760-1bdb-49cf-86eb-50f98fab0010'
|
|
16
15
|
}
|
|
16
|
+
// ['id', 'typeOfGood']
|
|
17
17
|
);
|
|
18
18
|
// tslint:disable-next-line:no-null-keyword
|
|
19
19
|
console.dir(result, { depth: null });
|
|
@@ -15,7 +15,7 @@ async function main() {
|
|
|
15
15
|
limit: 5,
|
|
16
16
|
page: 1,
|
|
17
17
|
sort: { branchCode: chevre.factory.sortType.Descending },
|
|
18
|
-
id: { $eq: '
|
|
18
|
+
id: { $eq: '59d20831e53ebc2b4e774466' }
|
|
19
19
|
// project: { id: { $eq: project.id } }
|
|
20
20
|
// paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
|
|
21
21
|
// hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
|
|
@@ -26,12 +26,12 @@ async function main() {
|
|
|
26
26
|
console.log('sellers found', sellersByAggregate, sellersByAggregate[0]?.hasMerchantReturnPolicy);
|
|
27
27
|
console.log(sellersByAggregate.length, 'sellers found');
|
|
28
28
|
|
|
29
|
-
const sellers = await sellerRepo.
|
|
29
|
+
const sellers = await sellerRepo.projectFields(
|
|
30
30
|
{
|
|
31
31
|
limit: 5,
|
|
32
32
|
page: 1,
|
|
33
33
|
sort: { branchCode: chevre.factory.sortType.Descending },
|
|
34
|
-
id: { $eq: '
|
|
34
|
+
id: { $eq: '59d20831e53ebc2b4e774466' }
|
|
35
35
|
// project: { id: { $eq: project.id } }
|
|
36
36
|
// paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
|
|
37
37
|
// hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
|
|
@@ -6,13 +6,11 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
async function main() {
|
|
7
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const reservationRepo = await chevre.repository.Reservation.createInstance(mongoose.connection);
|
|
12
|
-
const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
|
|
9
|
+
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
10
|
+
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
13
11
|
|
|
14
12
|
let updateResult: any;
|
|
15
|
-
updateResult = await
|
|
13
|
+
updateResult = await productRepo.unsetUnnecessaryFields({
|
|
16
14
|
filter: {
|
|
17
15
|
_id: { $exists: true }
|
|
18
16
|
},
|
|
@@ -24,31 +22,7 @@ async function main() {
|
|
|
24
22
|
});
|
|
25
23
|
console.log(updateResult);
|
|
26
24
|
|
|
27
|
-
updateResult = await
|
|
28
|
-
filter: {
|
|
29
|
-
_id: { $exists: true }
|
|
30
|
-
},
|
|
31
|
-
$unset: {
|
|
32
|
-
createdAt: 1,
|
|
33
|
-
updatedAt: 1,
|
|
34
|
-
__v: 1
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
console.log(updateResult);
|
|
38
|
-
|
|
39
|
-
updateResult = await projectRepo.unsetUnnecessaryFields({
|
|
40
|
-
filter: {
|
|
41
|
-
_id: { $exists: true }
|
|
42
|
-
},
|
|
43
|
-
$unset: {
|
|
44
|
-
createdAt: 1,
|
|
45
|
-
updatedAt: 1,
|
|
46
|
-
__v: 1
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
console.log(updateResult);
|
|
50
|
-
|
|
51
|
-
updateResult = await reservationRepo.unsetUnnecessaryFields({
|
|
25
|
+
updateResult = await sellerRepo.unsetUnnecessaryFields({
|
|
52
26
|
filter: {
|
|
53
27
|
_id: { $exists: true }
|
|
54
28
|
},
|
|
@@ -36,7 +36,9 @@ export declare class AuthorizationRepo {
|
|
|
36
36
|
};
|
|
37
37
|
id: string;
|
|
38
38
|
}): Promise<Pick<IFindValidOneResult, 'object'>>;
|
|
39
|
-
|
|
39
|
+
projectFields(params: factory.authorization.ISearchConditions): Promise<(factory.authorization.IAuthorization & {
|
|
40
|
+
id: string;
|
|
41
|
+
})[]>;
|
|
40
42
|
/**
|
|
41
43
|
* 有効期限を一定期間過ぎた承認を削除する
|
|
42
44
|
*/
|
|
@@ -114,14 +114,17 @@ class AuthorizationRepo {
|
|
|
114
114
|
code: { $eq: String(params.code) },
|
|
115
115
|
validFrom: { $lte: now },
|
|
116
116
|
validUntil: { $gte: now }
|
|
117
|
-
}, {
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
}, {
|
|
118
|
+
_id: 0,
|
|
119
|
+
id: { $toString: '$_id' },
|
|
120
|
+
object: 1, typeOf: 1, audience: 1, issuedBy: 1
|
|
121
|
+
})
|
|
122
|
+
.lean()
|
|
120
123
|
.exec();
|
|
121
124
|
if (doc === null) {
|
|
122
125
|
throw new factory.errors.NotFound(this.authorizationModel.modelName);
|
|
123
126
|
}
|
|
124
|
-
const { id, object, typeOf, audience, issuedBy } = doc
|
|
127
|
+
const { id, object, typeOf, audience, issuedBy } = doc;
|
|
125
128
|
return Object.assign(Object.assign({ id, object, typeOf }, (typeof (issuedBy === null || issuedBy === void 0 ? void 0 : issuedBy.id) === 'string') ? { issuedBy } : undefined), (typeof (audience === null || audience === void 0 ? void 0 : audience.id) === 'string') ? { audience } : undefined);
|
|
126
129
|
});
|
|
127
130
|
}
|
|
@@ -145,14 +148,22 @@ class AuthorizationRepo {
|
|
|
145
148
|
return doc;
|
|
146
149
|
});
|
|
147
150
|
}
|
|
148
|
-
|
|
151
|
+
projectFields(params) {
|
|
149
152
|
var _a;
|
|
150
153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
154
|
const conditions = AuthorizationRepo.CREATE_MONGO_CONDITIONS(params);
|
|
152
155
|
const query = this.authorizationModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
_id: 0,
|
|
157
|
+
id: { $toString: '$_id' },
|
|
158
|
+
project: 1,
|
|
159
|
+
typeOf: 1,
|
|
160
|
+
code: 1,
|
|
161
|
+
object: 1,
|
|
162
|
+
validFrom: 1,
|
|
163
|
+
validUntil: 1,
|
|
164
|
+
audience: 1,
|
|
165
|
+
author: 1,
|
|
166
|
+
issuedBy: 1
|
|
156
167
|
});
|
|
157
168
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
158
169
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
@@ -165,8 +176,8 @@ class AuthorizationRepo {
|
|
|
165
176
|
query.sort({ validFrom: params.sort.validFrom });
|
|
166
177
|
}
|
|
167
178
|
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
168
|
-
.
|
|
169
|
-
.
|
|
179
|
+
.lean()
|
|
180
|
+
.exec();
|
|
170
181
|
});
|
|
171
182
|
}
|
|
172
183
|
/**
|
|
@@ -45,13 +45,25 @@ 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 & {
|
|
57
|
+
id: string;
|
|
58
|
+
})[]>;
|
|
49
59
|
save(params: {
|
|
50
60
|
id?: string;
|
|
51
61
|
attributes: factory.categoryCode.ICategoryCode & {
|
|
52
62
|
$unset?: IUnset;
|
|
53
63
|
};
|
|
54
|
-
}): Promise<
|
|
64
|
+
}): Promise<{
|
|
65
|
+
id: string;
|
|
66
|
+
}>;
|
|
55
67
|
saveManyByCodeValue(params: {
|
|
56
68
|
attributes: factory.categoryCode.ICategoryCode;
|
|
57
69
|
upsert?: boolean;
|
|
@@ -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
|
}
|
|
@@ -69,11 +69,20 @@ const indexes = [
|
|
|
69
69
|
}
|
|
70
70
|
],
|
|
71
71
|
[
|
|
72
|
-
{ 'serviceOutput.amount.currency': 1, productID: 1 },
|
|
72
|
+
{ 'serviceOutput.paymentMethod.amount.currency': 1, productID: 1 },
|
|
73
73
|
{
|
|
74
|
-
name: '
|
|
74
|
+
name: 'searchByServiceOutputPaymentMethodAmountCurrency',
|
|
75
75
|
partialFilterExpression: {
|
|
76
|
-
'serviceOutput.amount.currency': { $exists: true }
|
|
76
|
+
'serviceOutput.paymentMethod.amount.currency': { $exists: true }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
{ 'serviceOutput.issuedThrough.serviceType.codeValue': 1, productID: 1 },
|
|
82
|
+
{
|
|
83
|
+
name: 'searchByServiceOutputIssuedThroughServiceType',
|
|
84
|
+
partialFilterExpression: {
|
|
85
|
+
'serviceOutput.issuedThrough.serviceType.codeValue': { $exists: true }
|
|
77
86
|
}
|
|
78
87
|
}
|
|
79
88
|
],
|
|
@@ -19,6 +19,9 @@ const schemaDefinition = {
|
|
|
19
19
|
// provider: [SchemaTypes.Mixed], // 廃止(2024-04-12~)
|
|
20
20
|
serviceOutput: mongoose_1.SchemaTypes.Mixed,
|
|
21
21
|
serviceType: mongoose_1.SchemaTypes.Mixed
|
|
22
|
+
// createdAt: SchemaTypes.Mixed,
|
|
23
|
+
// updatedAt: SchemaTypes.Mixed,
|
|
24
|
+
// __v: SchemaTypes.Mixed
|
|
22
25
|
};
|
|
23
26
|
const schemaOptions = {
|
|
24
27
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -29,10 +32,8 @@ const schemaOptions = {
|
|
|
29
32
|
writeConcern: writeConcern_1.writeConcern,
|
|
30
33
|
strict: true,
|
|
31
34
|
strictQuery: false,
|
|
32
|
-
timestamps:
|
|
33
|
-
|
|
34
|
-
updatedAt: 'updatedAt'
|
|
35
|
-
},
|
|
35
|
+
timestamps: false,
|
|
36
|
+
versionKey: false,
|
|
36
37
|
toJSON: {
|
|
37
38
|
getters: false,
|
|
38
39
|
virtuals: false,
|
|
@@ -47,14 +48,6 @@ const schemaOptions = {
|
|
|
47
48
|
}
|
|
48
49
|
};
|
|
49
50
|
const indexes = [
|
|
50
|
-
[
|
|
51
|
-
{ createdAt: 1 },
|
|
52
|
-
{ name: 'searchByCreatedAt' }
|
|
53
|
-
],
|
|
54
|
-
[
|
|
55
|
-
{ updatedAt: 1 },
|
|
56
|
-
{ name: 'searchByUpdatedAt' }
|
|
57
|
-
],
|
|
58
51
|
[
|
|
59
52
|
{ productID: 1 },
|
|
60
53
|
{ name: 'searchByProductID' }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
|
|
2
2
|
declare const modelName = "Seller";
|
|
3
|
-
declare function createSchema(): Schema;
|
|
4
3
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
4
|
+
declare function createSchema(): Schema;
|
|
5
5
|
export { modelName, indexes, createSchema };
|
|
@@ -22,6 +22,9 @@ const schemaDefinition = {
|
|
|
22
22
|
},
|
|
23
23
|
url: String,
|
|
24
24
|
telephone: String
|
|
25
|
+
// createdAt: SchemaTypes.Mixed,
|
|
26
|
+
// updatedAt: SchemaTypes.Mixed,
|
|
27
|
+
// __v: SchemaTypes.Mixed
|
|
25
28
|
};
|
|
26
29
|
const schemaOptions = {
|
|
27
30
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -32,10 +35,8 @@ const schemaOptions = {
|
|
|
32
35
|
writeConcern: writeConcern_1.writeConcern,
|
|
33
36
|
strict: true,
|
|
34
37
|
strictQuery: false,
|
|
35
|
-
timestamps:
|
|
36
|
-
|
|
37
|
-
updatedAt: 'updatedAt'
|
|
38
|
-
},
|
|
38
|
+
timestamps: false,
|
|
39
|
+
versionKey: false,
|
|
39
40
|
toJSON: {
|
|
40
41
|
getters: false,
|
|
41
42
|
virtuals: false,
|
|
@@ -49,26 +50,7 @@ const schemaOptions = {
|
|
|
49
50
|
versionKey: false
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
|
-
/**
|
|
53
|
-
* 販売者スキーマ
|
|
54
|
-
*/
|
|
55
|
-
let schema;
|
|
56
|
-
function createSchema() {
|
|
57
|
-
if (schema === undefined) {
|
|
58
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
59
|
-
}
|
|
60
|
-
return schema;
|
|
61
|
-
}
|
|
62
|
-
exports.createSchema = createSchema;
|
|
63
53
|
const indexes = [
|
|
64
|
-
[
|
|
65
|
-
{ createdAt: 1 },
|
|
66
|
-
{ name: 'searchByCreatedAt' }
|
|
67
|
-
],
|
|
68
|
-
[
|
|
69
|
-
{ updatedAt: 1 },
|
|
70
|
-
{ name: 'searchByUpdatedAt' }
|
|
71
|
-
],
|
|
72
54
|
[
|
|
73
55
|
{ branchCode: 1 },
|
|
74
56
|
{ name: 'searchByBranchCode' }
|
|
@@ -139,3 +121,19 @@ const indexes = [
|
|
|
139
121
|
]
|
|
140
122
|
];
|
|
141
123
|
exports.indexes = indexes;
|
|
124
|
+
/**
|
|
125
|
+
* 販売者スキーマ
|
|
126
|
+
*/
|
|
127
|
+
let schema;
|
|
128
|
+
function createSchema() {
|
|
129
|
+
if (schema === undefined) {
|
|
130
|
+
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
131
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
132
|
+
indexes.forEach((indexParams) => {
|
|
133
|
+
schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return schema;
|
|
138
|
+
}
|
|
139
|
+
exports.createSchema = createSchema;
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import type { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
-
export type
|
|
27
|
+
export type IOwnershipInfoWithId = factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood> & {
|
|
28
|
+
id: string;
|
|
29
|
+
};
|
|
28
30
|
/**
|
|
29
31
|
* 所有権リポジトリ
|
|
30
32
|
*/
|
|
@@ -35,14 +37,16 @@ export declare class OwnershipInfoRepo {
|
|
|
35
37
|
/**
|
|
36
38
|
* なければ作成する
|
|
37
39
|
*/
|
|
38
|
-
createIfNotExistByIdentifier(ownershipInfo:
|
|
39
|
-
findById(params: {
|
|
40
|
+
createIfNotExistByIdentifier(ownershipInfo: Omit<IOwnershipInfoWithId, 'id'>): Promise<{
|
|
40
41
|
id: string;
|
|
41
|
-
}
|
|
42
|
+
}>;
|
|
43
|
+
projectFieldsById(params: {
|
|
44
|
+
id: string;
|
|
45
|
+
}, inclusion?: (keyof IOwnershipInfoWithId)[]): Promise<IOwnershipInfoWithId>;
|
|
42
46
|
/**
|
|
43
47
|
* 所有権を検索する
|
|
44
48
|
*/
|
|
45
|
-
|
|
49
|
+
projectFields(params: factory.ownershipInfo.ISearchConditions, inclusion?: (keyof IOwnershipInfoWithId)[]): Promise<IOwnershipInfoWithId[]>;
|
|
46
50
|
/**
|
|
47
51
|
* 識別子から所有期限を変更する
|
|
48
52
|
* 存在しない場合undefinedを返す
|
|
@@ -53,7 +57,7 @@ export declare class OwnershipInfoRepo {
|
|
|
53
57
|
};
|
|
54
58
|
identifier: string;
|
|
55
59
|
ownedThrough: Date;
|
|
56
|
-
}): Promise<
|
|
60
|
+
}): Promise<Pick<IOwnershipInfoWithId, 'id' | 'identifier'> | undefined>;
|
|
57
61
|
/**
|
|
58
62
|
* 所有者の所有権を全て削除する
|
|
59
63
|
*/
|