@chevre/domain 23.0.0-alpha.3 → 23.0.0-alpha.30
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/assetTransaction/processReserve.ts +102 -40
- package/example/src/chevre/categoryCode/checkUniqueness.ts +69 -0
- package/example/src/chevre/event/checkEventAdditionalPropertyUniqueness.ts +108 -0
- package/example/src/chevre/event/migrateEventAdditionalProperty2identifier.ts +121 -0
- package/example/src/chevre/event/updateSellerMakesOffersByIdentifier.ts +106 -0
- package/example/src/chevre/note/findNotes.ts +34 -0
- package/example/src/chevre/note/upsertNotesByIdentifier.ts +10 -5
- package/example/src/chevre/offerCatalog/updateManyOfferCatalogsByIds.ts +49 -0
- package/example/src/chevre/paymentServices/findPaymentServices.ts +37 -0
- package/example/src/chevre/product/findHasOfferCatalog.ts +31 -0
- package/example/src/chevre/reIndex.ts +2 -3
- package/example/src/chevre/roles/addAdminNotePermissionIfNotExists.ts +48 -0
- package/example/src/chevre/roles/{addAdminProductOfferPermissionIfNotExists.ts → addAdminPaymentServiceReadPermissionIfNotExists.ts} +20 -19
- package/example/src/chevre/roles/addAdminProductHasOfferCatalogReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminSellerEventIfNotExists.ts +48 -0
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +1 -1
- package/example/src/chevre/roles/removePermissionIfExists.ts +1 -6
- package/example/src/chevre/unsetUnnecessaryFields.ts +5 -7
- package/example/src/objectId.ts +12 -0
- package/example/src/signPayload.ts +12 -7
- package/lib/chevre/errorHandler.d.ts +6 -2
- package/lib/chevre/errorHandler.js +18 -2
- package/lib/chevre/repo/categoryCode.d.ts +26 -14
- package/lib/chevre/repo/categoryCode.js +53 -42
- package/lib/chevre/repo/event.d.ts +25 -11
- package/lib/chevre/repo/event.js +60 -35
- package/lib/chevre/repo/eventSellerMakesOffer.d.ts +24 -39
- package/lib/chevre/repo/eventSellerMakesOffer.js +88 -43
- package/lib/chevre/repo/issuer.js +9 -5
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +48 -42
- package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.d.ts +10 -0
- package/lib/chevre/repo/mongoose/schemas/movieTicketTypes.js +107 -0
- package/lib/chevre/repo/mongoose/schemas/note.js +9 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +4 -4
- package/lib/chevre/repo/mongoose/schemas/product.js +2 -2
- package/lib/chevre/repo/movieTicketType.d.ts +57 -0
- package/lib/chevre/repo/movieTicketType.js +253 -0
- package/lib/chevre/repo/note.d.ts +2 -9
- package/lib/chevre/repo/note.js +52 -18
- package/lib/chevre/repo/noteAboutOrder.d.ts +4 -0
- package/lib/chevre/repo/noteAboutOrder.js +17 -0
- package/lib/chevre/repo/offerCatalog.d.ts +17 -2
- package/lib/chevre/repo/offerCatalog.js +5 -2
- package/lib/chevre/repo/product.js +15 -14
- package/lib/chevre/repo/productHasOfferCatalog.d.ts +43 -0
- package/lib/chevre/repo/productHasOfferCatalog.js +71 -0
- package/lib/chevre/repository.d.ts +10 -0
- package/lib/chevre/repository.js +28 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.d.ts +15 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateIssuedOfferIfExists.js +159 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest/validateMemberTierIfExists.js +184 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +4 -1
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +25 -138
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/offer/event/importFromCOA.js +1 -1
- 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/onEventChanged.js +26 -30
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +39 -0
- package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.js +86 -0
- package/lib/chevre/service/payment/any/{handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts → authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts} +4 -4
- package/lib/chevre/service/payment/any/{handlePrePublishedPaymentMethodIdOnAuthorizing.js → authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js} +1 -1
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.d.ts +25 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl/fixTransactionNumberOnPublishPaymentUrl.js +51 -0
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +2 -2
- package/lib/chevre/service/payment/any.js +91 -70
- package/lib/chevre/service/project.d.ts +3 -0
- package/lib/chevre/service/project.js +2 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +19 -105
- package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/package.json +4 -4
- package/example/src/chevre/aggregateEventSellerMakesOffer.ts +0 -32
- package/example/src/chevre/event/migrateEventIdentifier4ttts.ts +0 -96
- package/example/src/chevre/searchCategoryCodesByAggregate.ts +0 -31
- package/example/src/chevre/searchOfferCatalogItems.ts +0 -59
- package/example/src/chevre/searchPaymentServices.ts +0 -32
- package/example/src/chevre/unsetUnnecessaryFieldsInAction.ts +0 -50
- package/example/src/chevre/unsetUnnecessaryFieldsInTransaction.ts +0 -46
|
@@ -11,62 +11,107 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.EventSellerMakesOfferRepo = void 0;
|
|
13
13
|
const factory = require("../factory");
|
|
14
|
-
|
|
14
|
+
// import { MONGO_MAX_TIME_MS } from '../settings';
|
|
15
15
|
const event_1 = require("./mongoose/schemas/event");
|
|
16
|
+
// type IMatchStage = PipelineStage.Match;
|
|
17
|
+
// type IAggregateMakesOfferResult = Pick<
|
|
18
|
+
// factory.event.screeningEvent.ISellerMakesOffer,
|
|
19
|
+
// 'availabilityEnds' | 'availabilityStarts' | 'validFrom' | 'validThrough'
|
|
20
|
+
// > & {
|
|
21
|
+
// itemOffered: {
|
|
22
|
+
// serviceOutput: {
|
|
23
|
+
// reservationFor: {
|
|
24
|
+
// /**
|
|
25
|
+
// * イベントID
|
|
26
|
+
// */
|
|
27
|
+
// id: string;
|
|
28
|
+
// };
|
|
29
|
+
// };
|
|
30
|
+
// };
|
|
31
|
+
// };
|
|
16
32
|
/**
|
|
17
|
-
*
|
|
33
|
+
* イベントのアプリケーションオファーリポジトリ
|
|
18
34
|
*/
|
|
19
35
|
class EventSellerMakesOfferRepo {
|
|
20
36
|
constructor(connection) {
|
|
21
37
|
this.eventModel = connection.model(event_1.modelName, (0, event_1.createSchema)());
|
|
22
38
|
}
|
|
23
39
|
/**
|
|
24
|
-
*
|
|
40
|
+
* 単一イベントのmakesOfferを更新する
|
|
25
41
|
*/
|
|
26
|
-
|
|
42
|
+
updateOffersByEventId(params) {
|
|
27
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
const { offers, itemOffered, project } = params;
|
|
45
|
+
const updateQuery = {
|
|
46
|
+
$set: {
|
|
47
|
+
'offers.seller.makesOffer': offers
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const updateFilter = {
|
|
51
|
+
_id: { $eq: itemOffered.id },
|
|
52
|
+
'project.id': { $eq: project.id }
|
|
53
|
+
};
|
|
54
|
+
const queryOptions = { upsert: false, new: false, projection: { _id: 1 } };
|
|
55
|
+
const doc = yield this.eventModel.findOneAndUpdate(updateFilter, updateQuery, queryOptions)
|
|
56
|
+
.lean()
|
|
57
|
+
.exec();
|
|
58
|
+
if (doc === null) {
|
|
59
|
+
throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
40
60
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* イベントコードをキーにして複数編集
|
|
65
|
+
* 2025-10-27~
|
|
66
|
+
*/
|
|
67
|
+
updateSellerMakesOffersByEventIdentifier(params) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const bulkWriteOps = [];
|
|
70
|
+
const queryFilters = [];
|
|
71
|
+
if (Array.isArray(params)) {
|
|
72
|
+
params.forEach(({ $set }) => {
|
|
73
|
+
const { project, identifier, offers } = $set;
|
|
74
|
+
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
75
|
+
throw new factory.errors.ArgumentNull('identifier');
|
|
59
76
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
const sellerMakesOffer = offers.seller.makesOffer;
|
|
78
|
+
if (!Array.isArray(sellerMakesOffer)) {
|
|
79
|
+
throw new factory.errors.Argument('offers.seller.makesOffer', 'offers.seller.makesOffer must be an array');
|
|
80
|
+
}
|
|
81
|
+
// リソースのユニークネスを保証するfilter
|
|
82
|
+
const filter = {
|
|
83
|
+
'project.id': { $eq: project.id },
|
|
84
|
+
identifier: { $exists: true, $eq: identifier }
|
|
85
|
+
};
|
|
86
|
+
queryFilters.push({
|
|
87
|
+
'project.id': { $eq: project.id },
|
|
88
|
+
identifier: { $exists: true, $eq: identifier }
|
|
89
|
+
});
|
|
90
|
+
const setFields = {
|
|
91
|
+
'offers.seller.makesOffer': sellerMakesOffer
|
|
92
|
+
};
|
|
93
|
+
const updateQuery = {
|
|
94
|
+
$set: setFields
|
|
95
|
+
};
|
|
96
|
+
const updateOne = {
|
|
97
|
+
filter,
|
|
98
|
+
update: updateQuery,
|
|
99
|
+
upsert: false
|
|
100
|
+
};
|
|
101
|
+
bulkWriteOps.push({ updateOne });
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (bulkWriteOps.length > 0) {
|
|
105
|
+
const bulkWriteResult = yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
106
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
107
|
+
const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, {
|
|
108
|
+
_id: 0,
|
|
109
|
+
id: { $toString: '$_id' }
|
|
110
|
+
})
|
|
111
|
+
.lean()
|
|
112
|
+
.exec();
|
|
113
|
+
return { bulkWriteResult, modifiedEvents };
|
|
66
114
|
}
|
|
67
|
-
return aggregate
|
|
68
|
-
.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
69
|
-
.exec();
|
|
70
115
|
});
|
|
71
116
|
}
|
|
72
117
|
}
|
|
@@ -32,17 +32,21 @@ class IssuerRepo {
|
|
|
32
32
|
this.issuerModel = connection.model(issuer_1.modelName, (0, issuer_1.createSchema)());
|
|
33
33
|
}
|
|
34
34
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
35
|
-
var _a, _b, _c, _d;
|
|
35
|
+
var _a, _b, _c, _d, _e;
|
|
36
36
|
const andConditions = [];
|
|
37
37
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
38
38
|
if (typeof projectIdEq === 'string') {
|
|
39
39
|
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
if (typeof
|
|
43
|
-
andConditions.push({ identifier: { $eq:
|
|
41
|
+
const identifierEq = (_c = params.identifier) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
42
|
+
if (typeof identifierEq === 'string') {
|
|
43
|
+
andConditions.push({ identifier: { $eq: identifierEq } });
|
|
44
44
|
}
|
|
45
|
-
const
|
|
45
|
+
const identifierIn = (_d = params.identifier) === null || _d === void 0 ? void 0 : _d.$in;
|
|
46
|
+
if (Array.isArray(identifierIn)) {
|
|
47
|
+
andConditions.push({ identifier: { $in: identifierIn } });
|
|
48
|
+
}
|
|
49
|
+
const idEq = (_e = params.id) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
46
50
|
if (typeof idEq === 'string') {
|
|
47
51
|
andConditions.push({ _id: { $eq: idEq } });
|
|
48
52
|
}
|
|
@@ -4,26 +4,19 @@ exports.modelName = exports.indexes = void 0;
|
|
|
4
4
|
exports.createSchema = createSchema;
|
|
5
5
|
const mongoose_1 = require("mongoose");
|
|
6
6
|
const writeConcern_1 = require("../writeConcern");
|
|
7
|
-
const factory = require("../../../factory");
|
|
8
7
|
const settings_1 = require("../../../settings");
|
|
9
8
|
const modelName = 'CategoryCode';
|
|
10
9
|
exports.modelName = modelName;
|
|
11
10
|
const schemaDefinition = {
|
|
12
11
|
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
13
|
-
typeOf: {
|
|
14
|
-
type: String,
|
|
15
|
-
required: true
|
|
16
|
-
},
|
|
12
|
+
typeOf: { type: String, required: true },
|
|
17
13
|
additionalProperty: [mongoose_1.SchemaTypes.Mixed],
|
|
18
14
|
color: String,
|
|
19
15
|
image: String,
|
|
20
|
-
codeValue: {
|
|
21
|
-
type: String,
|
|
22
|
-
required: true
|
|
23
|
-
},
|
|
16
|
+
codeValue: { type: String, required: true },
|
|
24
17
|
inCodeSet: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
25
|
-
name: mongoose_1.SchemaTypes.Mixed
|
|
26
|
-
paymentMethod:
|
|
18
|
+
name: mongoose_1.SchemaTypes.Mixed
|
|
19
|
+
// paymentMethod: SchemaTypes.Mixed // discontinue(2025-11-08~)
|
|
27
20
|
};
|
|
28
21
|
const schemaOptions = {
|
|
29
22
|
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
@@ -76,15 +69,16 @@ const indexes = [
|
|
|
76
69
|
}
|
|
77
70
|
}
|
|
78
71
|
],
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
// discontinue(2025-11-08~)
|
|
73
|
+
// [
|
|
74
|
+
// { 'paymentMethod.typeOf': 1, codeValue: 1 },
|
|
75
|
+
// {
|
|
76
|
+
// name: 'searchByPaymentMethodTypeOf',
|
|
77
|
+
// partialFilterExpression: {
|
|
78
|
+
// 'paymentMethod.typeOf': { $exists: true }
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
81
|
+
// ],
|
|
88
82
|
[
|
|
89
83
|
{ 'project.id': 1, codeValue: 1 },
|
|
90
84
|
{
|
|
@@ -100,37 +94,49 @@ const indexes = [
|
|
|
100
94
|
}
|
|
101
95
|
}
|
|
102
96
|
],
|
|
103
|
-
//
|
|
97
|
+
// 決済カード区分をコレクション分離したので、reIndex unique index(2025-11-05~)
|
|
104
98
|
[
|
|
105
99
|
{
|
|
106
100
|
'project.id': 1,
|
|
107
|
-
'inCodeSet.identifier': 1,
|
|
101
|
+
'inCodeSet.identifier': 1, // ssktsでのみ区分分類をまたいで重複がある
|
|
108
102
|
codeValue: 1
|
|
109
103
|
},
|
|
110
104
|
{
|
|
111
105
|
unique: true,
|
|
112
|
-
name: '
|
|
113
|
-
partialFilterExpression: {
|
|
114
|
-
// tslint:disable-next-line:no-null-keyword
|
|
115
|
-
'paymentMethod.typeOf': null
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
|
-
[
|
|
120
|
-
{
|
|
121
|
-
'project.id': 1,
|
|
122
|
-
'paymentMethod.typeOf': 1,
|
|
123
|
-
codeValue: 1
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
unique: true,
|
|
127
|
-
name: 'uniqueByCodeValueAndPaymentMethod',
|
|
128
|
-
partialFilterExpression: {
|
|
129
|
-
'inCodeSet.identifier': { $eq: factory.categoryCode.CategorySetIdentifier.MovieTicketType },
|
|
130
|
-
'paymentMethod.typeOf': { $exists: true }
|
|
131
|
-
}
|
|
106
|
+
name: 'uniqueByCodeValue'
|
|
132
107
|
}
|
|
133
108
|
]
|
|
109
|
+
// add unique index(2024-11-14~)
|
|
110
|
+
// [
|
|
111
|
+
// {
|
|
112
|
+
// 'project.id': 1,
|
|
113
|
+
// 'inCodeSet.identifier': 1,
|
|
114
|
+
// codeValue: 1
|
|
115
|
+
// },
|
|
116
|
+
// {
|
|
117
|
+
// unique: true,
|
|
118
|
+
// name: 'uniqueByCodeValueAndInCodeSet',
|
|
119
|
+
// partialFilterExpression: {
|
|
120
|
+
// // tslint:disable-next-line:no-null-keyword
|
|
121
|
+
// 'paymentMethod.typeOf': null
|
|
122
|
+
// }
|
|
123
|
+
// }
|
|
124
|
+
// ],
|
|
125
|
+
// [
|
|
126
|
+
// {
|
|
127
|
+
// 'project.id': 1,
|
|
128
|
+
// 'paymentMethod.typeOf': 1,
|
|
129
|
+
// codeValue: 1
|
|
130
|
+
// },
|
|
131
|
+
// {
|
|
132
|
+
// unique: true,
|
|
133
|
+
// name: 'uniqueByCodeValueAndPaymentMethod',
|
|
134
|
+
// partialFilterExpression: {
|
|
135
|
+
// 'inCodeSet.identifier': { $eq: factory.movieTicketType.CategorySetIdentifier.MovieTicketType },
|
|
136
|
+
// 'paymentMethod.typeOf': { $exists: true }
|
|
137
|
+
// }
|
|
138
|
+
// }
|
|
139
|
+
// ]
|
|
134
140
|
];
|
|
135
141
|
exports.indexes = indexes;
|
|
136
142
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
|
+
import * as factory from '../../../factory';
|
|
3
|
+
type IDocType = factory.movieTicketType.IMovieTicketType;
|
|
4
|
+
type IModel = Model<IDocType>;
|
|
5
|
+
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
6
|
+
type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
|
|
7
|
+
declare const modelName = "MovieTicketType";
|
|
8
|
+
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
9
|
+
declare function createSchema(): ISchema;
|
|
10
|
+
export { createSchema, IModel, IDocType, indexes, modelName };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.modelName = exports.indexes = void 0;
|
|
4
|
+
exports.createSchema = createSchema;
|
|
5
|
+
const mongoose_1 = require("mongoose");
|
|
6
|
+
const writeConcern_1 = require("../writeConcern");
|
|
7
|
+
const settings_1 = require("../../../settings");
|
|
8
|
+
const modelName = 'MovieTicketType';
|
|
9
|
+
exports.modelName = modelName;
|
|
10
|
+
const schemaDefinition = {
|
|
11
|
+
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
|
+
typeOf: { type: String, required: true },
|
|
13
|
+
// additionalProperty: [SchemaTypes.Mixed],
|
|
14
|
+
color: String,
|
|
15
|
+
image: String,
|
|
16
|
+
codeValue: { type: String, required: true },
|
|
17
|
+
inCodeSet: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
18
|
+
name: mongoose_1.SchemaTypes.Mixed,
|
|
19
|
+
paymentMethod: { type: mongoose_1.SchemaTypes.Mixed, required: true }
|
|
20
|
+
};
|
|
21
|
+
const schemaOptions = {
|
|
22
|
+
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
23
|
+
autoCreate: false,
|
|
24
|
+
collection: 'movieTicketTypes',
|
|
25
|
+
id: true,
|
|
26
|
+
read: settings_1.MONGO_READ_PREFERENCE,
|
|
27
|
+
writeConcern: writeConcern_1.writeConcern,
|
|
28
|
+
strict: true,
|
|
29
|
+
strictQuery: false,
|
|
30
|
+
timestamps: false, // 2024-08-22~
|
|
31
|
+
versionKey: false, // 2024-08-22~
|
|
32
|
+
toJSON: {
|
|
33
|
+
getters: false,
|
|
34
|
+
virtuals: false,
|
|
35
|
+
minimize: false,
|
|
36
|
+
versionKey: false
|
|
37
|
+
},
|
|
38
|
+
toObject: {
|
|
39
|
+
getters: false,
|
|
40
|
+
virtuals: true,
|
|
41
|
+
minimize: false,
|
|
42
|
+
versionKey: false
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const indexes = [
|
|
46
|
+
[
|
|
47
|
+
{ codeValue: 1 },
|
|
48
|
+
{ name: 'codeValue' }
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
{ 'project.id': 1, codeValue: 1 },
|
|
52
|
+
{ name: 'projectId' }
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
{ 'paymentMethod.typeOf': 1, codeValue: 1 },
|
|
56
|
+
{ name: 'paymentMethodTypeOf' }
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
{ 'inCodeSet.identifier': 1, codeValue: 1 },
|
|
60
|
+
{ name: 'inCodeSetIdentifier' }
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
{
|
|
64
|
+
'project.id': 1,
|
|
65
|
+
'paymentMethod.typeOf': 1,
|
|
66
|
+
codeValue: 1
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
unique: true,
|
|
70
|
+
name: 'uniqueByCodeValueAndPaymentMethod'
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
{ 'name.ja': 1, codeValue: 1 },
|
|
75
|
+
{
|
|
76
|
+
name: 'nameJa',
|
|
77
|
+
partialFilterExpression: {
|
|
78
|
+
'name.ja': { $exists: true }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
{ 'name.en': 1, codeValue: 1 },
|
|
84
|
+
{
|
|
85
|
+
name: 'nameEn',
|
|
86
|
+
partialFilterExpression: {
|
|
87
|
+
'name.en': { $exists: true }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
];
|
|
92
|
+
exports.indexes = indexes;
|
|
93
|
+
/**
|
|
94
|
+
* 決済カード区分スキーマ
|
|
95
|
+
*/
|
|
96
|
+
let schema;
|
|
97
|
+
function createSchema() {
|
|
98
|
+
if (schema === undefined) {
|
|
99
|
+
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
100
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
101
|
+
indexes.forEach((indexParams) => {
|
|
102
|
+
schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return schema;
|
|
107
|
+
}
|
|
@@ -85,6 +85,15 @@ const indexes = [
|
|
|
85
85
|
[
|
|
86
86
|
{ identifier: 1, dateCreated: -1 },
|
|
87
87
|
{ name: 'identifier' }
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
{ 'hasDigitalDocumentPermission.grantee.audienceType': 1, dateCreated: -1 },
|
|
91
|
+
{
|
|
92
|
+
name: 'permissionGranteeAudienceType',
|
|
93
|
+
partialFilterExpression: {
|
|
94
|
+
'hasDigitalDocumentPermission.grantee.audienceType': { $exists: true }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
88
97
|
]
|
|
89
98
|
// discontinue(2025-05-08~)
|
|
90
99
|
// [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
offers?:
|
|
3
|
+
type IDocTypeAsProduct = Omit<factory.product.IProduct, 'id'>;
|
|
4
|
+
interface IDocTypeAsProductOffer {
|
|
5
|
+
offers?: never;
|
|
6
6
|
}
|
|
7
7
|
type IDocType = IDocTypeAsProduct & IDocTypeAsProductOffer;
|
|
8
8
|
type IModel = Model<IDocType>;
|
|
@@ -11,4 +11,4 @@ type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocT
|
|
|
11
11
|
declare const modelName = "Product";
|
|
12
12
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
13
13
|
declare function createSchema(): ISchema;
|
|
14
|
-
export { createSchema, IModel, indexes, modelName };
|
|
14
|
+
export { createSchema, IDocTypeAsProduct, IDocTypeAsProductOffer, IModel, indexes, modelName };
|
|
@@ -8,14 +8,14 @@ const settings_1 = require("../../../settings");
|
|
|
8
8
|
const modelName = 'Product';
|
|
9
9
|
exports.modelName = modelName;
|
|
10
10
|
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
11
|
+
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
12
|
typeOf: { type: String, required: true },
|
|
13
13
|
additionalProperty: [mongoose_1.SchemaTypes.Mixed],
|
|
14
14
|
availableChannel: mongoose_1.SchemaTypes.Mixed,
|
|
15
15
|
description: mongoose_1.SchemaTypes.Mixed,
|
|
16
16
|
hasOfferCatalog: mongoose_1.SchemaTypes.Mixed,
|
|
17
17
|
name: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
-
offers: [
|
|
18
|
+
// offers: [SchemaTypes.Mixed], // discontinue(2025-10-15~)
|
|
19
19
|
productID: { type: String, required: true },
|
|
20
20
|
// provider: [SchemaTypes.Mixed], // 廃止(2024-04-12~)
|
|
21
21
|
serviceOutput: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AnyExpression, Connection, FilterQuery } from 'mongoose';
|
|
2
|
+
import { IDocType } from './mongoose/schemas/movieTicketTypes';
|
|
3
|
+
import * as factory from '../factory';
|
|
4
|
+
type IUnset = {
|
|
5
|
+
[key in keyof Pick<IDocType, 'color' | 'image'>]?: 1;
|
|
6
|
+
};
|
|
7
|
+
type IKeyOfProjection = keyof IDocType;
|
|
8
|
+
/**
|
|
9
|
+
* 決済カード区分リポジトリ
|
|
10
|
+
*/
|
|
11
|
+
export declare class MovieTicketTypeRepo {
|
|
12
|
+
private readonly categoryCodeModel;
|
|
13
|
+
constructor(connection: Connection);
|
|
14
|
+
static CREATE_MONGO_CONDITIONS(params: factory.movieTicketType.ISearchConditions): FilterQuery<IDocType>[];
|
|
15
|
+
static CREATE_AGGREGATE_PROJECTION(inclusion: IKeyOfProjection[]): {
|
|
16
|
+
[field: string]: AnyExpression;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 決済カード区分検索
|
|
20
|
+
*/
|
|
21
|
+
projectMovieTicketTypeFields(params: Omit<factory.movieTicketType.ISearchConditions, 'inCodeSet'> & {
|
|
22
|
+
inCodeSet?: {
|
|
23
|
+
identifier?: {
|
|
24
|
+
$eq?: factory.movieTicketType.CategorySetIdentifier.MovieTicketType;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* 空の場合無効
|
|
30
|
+
*/
|
|
31
|
+
inclusion: IKeyOfProjection[]): Promise<(IDocType & {
|
|
32
|
+
id: string;
|
|
33
|
+
})[]>;
|
|
34
|
+
saveMovieTicketType(params: {
|
|
35
|
+
id?: string;
|
|
36
|
+
attributes: IDocType & {
|
|
37
|
+
$unset?: IUnset;
|
|
38
|
+
};
|
|
39
|
+
}): Promise<{
|
|
40
|
+
id: string;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* 削除する
|
|
44
|
+
*/
|
|
45
|
+
deleteMovieTicketTypeById(params: {
|
|
46
|
+
id: string;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* プロジェクト指定で削除する
|
|
50
|
+
*/
|
|
51
|
+
deleteMovieTicketTypesByProject(params: {
|
|
52
|
+
project: {
|
|
53
|
+
id: string;
|
|
54
|
+
};
|
|
55
|
+
}): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export {};
|