@chevre/domain 26.0.0-alpha.26 → 26.0.0-alpha.28
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/lib/chevre/repo/action.d.ts +1 -1
- package/lib/chevre/repo/action.js +0 -260
- package/lib/chevre/repo/adminTransaction.d.ts +131 -0
- package/lib/chevre/repo/adminTransaction.js +237 -0
- package/lib/chevre/repo/aggregateTransaction.d.ts +39 -0
- package/lib/chevre/repo/aggregateTransaction.js +166 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +8 -9
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +85 -76
- package/lib/chevre/repo/mongoose/schemas/event.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/eventOffer.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/pendingReservation.js +11 -4
- package/lib/chevre/repo/mongoose/schemas/{ownershipInfo.d.ts → updateAction.d.ts} +5 -3
- package/lib/chevre/repo/mongoose/schemas/updateAction.js +65 -0
- package/lib/chevre/repo/transaction.d.ts +1 -187
- package/lib/chevre/repo/transaction.js +2 -383
- package/lib/chevre/repo/updateAction.d.ts +52 -0
- package/lib/chevre/repo/updateAction.js +429 -0
- package/lib/chevre/repository.d.ts +15 -5
- package/lib/chevre/repository.js +35 -13
- package/lib/chevre/service/aggregation/system.d.ts +2 -2
- package/lib/chevre/service/aggregation/system.js +2 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +2 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.js +3 -3
- package/lib/chevre/service/event.d.ts +2 -2
- package/lib/chevre/service/event.js +3 -3
- package/lib/chevre/service/task/deleteTransaction.js +2 -4
- package/lib/chevre/service/task/importEventsFromCOA.js +2 -2
- package/lib/chevre/service/task/syncResourcesFromCOA.js +11 -11
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -2
- package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
- package/package.json +2 -2
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -82
- package/lib/chevre/repo/ownershipInfo.d.ts +0 -20
- package/lib/chevre/repo/ownershipInfo.js +0 -130
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Connection } from 'mongoose';
|
|
2
|
+
import { factory } from '../factory';
|
|
3
|
+
interface IAggregationByStatus {
|
|
4
|
+
transactionCount: number;
|
|
5
|
+
avgDuration: number;
|
|
6
|
+
maxDuration: number;
|
|
7
|
+
minDuration: number;
|
|
8
|
+
percentilesDuration: {
|
|
9
|
+
name: string;
|
|
10
|
+
value: number;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
interface IStatus {
|
|
14
|
+
status: factory.transactionStatusType;
|
|
15
|
+
aggregation: IAggregationByStatus;
|
|
16
|
+
}
|
|
17
|
+
export interface IAggregatePlaceOrder {
|
|
18
|
+
statuses: IStatus[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 取引集計リポジトリ
|
|
22
|
+
*/
|
|
23
|
+
export declare class AggregateTransactionRepo {
|
|
24
|
+
private readonly transactionModel;
|
|
25
|
+
constructor(connection: Connection);
|
|
26
|
+
aggregatePlaceOrder(params: {
|
|
27
|
+
project?: {
|
|
28
|
+
id?: {
|
|
29
|
+
$ne?: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
startFrom: Date;
|
|
33
|
+
startThrough: Date;
|
|
34
|
+
typeOf: factory.transactionType;
|
|
35
|
+
clientId?: string;
|
|
36
|
+
}): Promise<IAggregatePlaceOrder>;
|
|
37
|
+
private agggregateByStatus;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregateTransactionRepo = void 0;
|
|
4
|
+
const factory_1 = require("../factory");
|
|
5
|
+
const transaction_1 = require("./mongoose/schemas/transaction");
|
|
6
|
+
/**
|
|
7
|
+
* 取引集計リポジトリ
|
|
8
|
+
*/
|
|
9
|
+
class AggregateTransactionRepo {
|
|
10
|
+
transactionModel;
|
|
11
|
+
constructor(connection) {
|
|
12
|
+
this.transactionModel = connection.model(transaction_1.modelName, (0, transaction_1.createSchema)());
|
|
13
|
+
}
|
|
14
|
+
async aggregatePlaceOrder(params) {
|
|
15
|
+
const statuses = await Promise.all([
|
|
16
|
+
factory_1.factory.transactionStatusType.Confirmed,
|
|
17
|
+
factory_1.factory.transactionStatusType.Canceled,
|
|
18
|
+
factory_1.factory.transactionStatusType.Expired
|
|
19
|
+
].map(async (transactionStatus) => {
|
|
20
|
+
const matchConditions = {
|
|
21
|
+
startDate: {
|
|
22
|
+
$gte: params.startFrom,
|
|
23
|
+
$lte: params.startThrough
|
|
24
|
+
},
|
|
25
|
+
typeOf: { $eq: params.typeOf },
|
|
26
|
+
status: { $eq: transactionStatus },
|
|
27
|
+
...(typeof params.project?.id?.$ne === 'string')
|
|
28
|
+
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
29
|
+
: undefined,
|
|
30
|
+
...(typeof params.clientId === 'string')
|
|
31
|
+
// customerIdentifierAll.push();
|
|
32
|
+
? {
|
|
33
|
+
'agent.identifier': {
|
|
34
|
+
$exists: true,
|
|
35
|
+
$all: [{ name: 'clientId', value: params.clientId }]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
: undefined
|
|
39
|
+
};
|
|
40
|
+
return this.agggregateByStatus({ matchConditions, status: transactionStatus });
|
|
41
|
+
}));
|
|
42
|
+
return { statuses };
|
|
43
|
+
}
|
|
44
|
+
async agggregateByStatus(params) {
|
|
45
|
+
const matchConditions = params.matchConditions;
|
|
46
|
+
const transactionStatus = params.status;
|
|
47
|
+
const aggregations = await this.transactionModel.aggregate([
|
|
48
|
+
{
|
|
49
|
+
$match: matchConditions
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
$project: {
|
|
53
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
54
|
+
status: '$status',
|
|
55
|
+
startDate: '$startDate',
|
|
56
|
+
endDate: '$endDate',
|
|
57
|
+
typeOf: '$typeOf'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
$group: {
|
|
62
|
+
_id: '$typeOf',
|
|
63
|
+
transactionCount: { $sum: 1 },
|
|
64
|
+
maxDuration: { $max: '$duration' },
|
|
65
|
+
minDuration: { $min: '$duration' },
|
|
66
|
+
avgDuration: { $avg: '$duration' }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
$project: {
|
|
71
|
+
_id: 0,
|
|
72
|
+
transactionCount: '$transactionCount',
|
|
73
|
+
avgDuration: '$avgDuration',
|
|
74
|
+
maxDuration: '$maxDuration',
|
|
75
|
+
minDuration: '$minDuration'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
])
|
|
79
|
+
.exec();
|
|
80
|
+
const percents = [50, 95, 99];
|
|
81
|
+
if (aggregations.length === 0) {
|
|
82
|
+
return {
|
|
83
|
+
status: transactionStatus,
|
|
84
|
+
aggregation: {
|
|
85
|
+
transactionCount: 0,
|
|
86
|
+
avgDuration: 0,
|
|
87
|
+
maxDuration: 0,
|
|
88
|
+
minDuration: 0,
|
|
89
|
+
percentilesDuration: percents.map((percent) => {
|
|
90
|
+
return {
|
|
91
|
+
name: String(percent),
|
|
92
|
+
value: 0
|
|
93
|
+
};
|
|
94
|
+
})
|
|
95
|
+
// totalPrice: 0,
|
|
96
|
+
// maxPrice: 0,
|
|
97
|
+
// minPrice: 0,
|
|
98
|
+
// avgPrice: 0
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const ranks4percentile = percents.map((percentile) => {
|
|
103
|
+
return {
|
|
104
|
+
percentile,
|
|
105
|
+
rank: Math.floor(aggregations[0].transactionCount * percentile / 100)
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
const aggregations2 = await this.transactionModel.aggregate([
|
|
109
|
+
{
|
|
110
|
+
$match: matchConditions
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
$project: {
|
|
114
|
+
duration: { $subtract: ['$endDate', '$startDate'] },
|
|
115
|
+
status: '$status',
|
|
116
|
+
startDate: '$startDate',
|
|
117
|
+
endDate: '$endDate',
|
|
118
|
+
typeOf: '$typeOf'
|
|
119
|
+
// result: '$result',
|
|
120
|
+
// price: {
|
|
121
|
+
// $cond: {
|
|
122
|
+
// if: { $isNumber: '$result.order.price' },
|
|
123
|
+
// then: '$result.order.price',
|
|
124
|
+
// else: 0
|
|
125
|
+
// }
|
|
126
|
+
// }
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{ $sort: { duration: 1 } },
|
|
130
|
+
{
|
|
131
|
+
$group: {
|
|
132
|
+
_id: '$typeOf',
|
|
133
|
+
durations: { $push: '$duration' }
|
|
134
|
+
// totalPrice: { $sum: '$price' },
|
|
135
|
+
// maxPrice: { $max: '$price' },
|
|
136
|
+
// minPrice: { $min: '$price' },
|
|
137
|
+
// avgPrice: { $avg: '$price' }
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
$project: {
|
|
142
|
+
_id: 0,
|
|
143
|
+
percentilesDuration: ranks4percentile.map((rank) => {
|
|
144
|
+
return {
|
|
145
|
+
name: String(rank.percentile),
|
|
146
|
+
value: { $arrayElemAt: ['$durations', rank.rank] }
|
|
147
|
+
};
|
|
148
|
+
})
|
|
149
|
+
// totalPrice: '$totalPrice',
|
|
150
|
+
// maxPrice: '$maxPrice',
|
|
151
|
+
// minPrice: '$minPrice',
|
|
152
|
+
// avgPrice: '$avgPrice'
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
])
|
|
156
|
+
.exec();
|
|
157
|
+
return {
|
|
158
|
+
status: transactionStatus,
|
|
159
|
+
aggregation: {
|
|
160
|
+
...aggregations[0],
|
|
161
|
+
...aggregations2[0]
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.AggregateTransactionRepo = AggregateTransactionRepo;
|
|
@@ -38,18 +38,17 @@ const schemaOptions = {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
const indexes = [
|
|
41
|
-
// [ // discontinue(2024-08-07~)
|
|
42
|
-
// { createdAt: 1 },
|
|
43
|
-
// { name: 'searchByCreatedAt' }
|
|
44
|
-
// ],
|
|
45
|
-
// [
|
|
46
|
-
// { updatedAt: 1 },
|
|
47
|
-
// { name: 'searchByUpdatedAt' }
|
|
48
|
-
// ],
|
|
49
41
|
[
|
|
50
42
|
{ 'reservationFor.startDate': 1 },
|
|
51
|
-
{
|
|
43
|
+
{
|
|
44
|
+
name: 'ttlByReservationForStartDate', // support ttl index(2026-08-11~)
|
|
45
|
+
expireAfterSeconds: 16416000 // 190 days
|
|
46
|
+
}
|
|
52
47
|
],
|
|
48
|
+
// [
|
|
49
|
+
// { 'reservationFor.startDate': 1 },
|
|
50
|
+
// { name: 'searchByReservationForStartDate' }
|
|
51
|
+
// ],
|
|
53
52
|
[
|
|
54
53
|
{ 'project.id': 1, 'reservationFor.startDate': 1 },
|
|
55
54
|
{ name: 'searchByProjectId' }
|
|
@@ -71,10 +71,11 @@ const indexes = [
|
|
|
71
71
|
name: 'uniqueTransactionNumber'
|
|
72
72
|
}
|
|
73
73
|
],
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
// discontinue(2026-08-12~)
|
|
75
|
+
// [
|
|
76
|
+
// { transactionNumber: 1, startDate: -1 },
|
|
77
|
+
// { name: 'searchByTransactionNumber' }
|
|
78
|
+
// ],
|
|
78
79
|
[
|
|
79
80
|
{ 'project.id': 1, startDate: -1 },
|
|
80
81
|
{
|
|
@@ -124,15 +125,16 @@ const indexes = [
|
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
],
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
128
|
+
// discontinue(2026-08-12~)
|
|
129
|
+
// [
|
|
130
|
+
// { 'object.provider.id': 1, startDate: -1 },
|
|
131
|
+
// {
|
|
132
|
+
// name: 'searchByObjectProviderId',
|
|
133
|
+
// partialFilterExpression: {
|
|
134
|
+
// 'object.provider.id': { $exists: true }
|
|
135
|
+
// }
|
|
136
|
+
// }
|
|
137
|
+
// ],
|
|
136
138
|
[
|
|
137
139
|
{ 'object.subReservation.id': 1, startDate: -1 },
|
|
138
140
|
{
|
|
@@ -142,24 +144,26 @@ const indexes = [
|
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
],
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
147
|
+
// discontinue(2026-08-12~)
|
|
148
|
+
// [
|
|
149
|
+
// { 'object.subReservation.reservationNumber': 1, startDate: -1 },
|
|
150
|
+
// {
|
|
151
|
+
// name: 'searchByObjectSubReservationsReservationNumber',
|
|
152
|
+
// partialFilterExpression: {
|
|
153
|
+
// 'object.subReservation.reservationNumber': { $exists: true }
|
|
154
|
+
// }
|
|
155
|
+
// }
|
|
156
|
+
// ],
|
|
157
|
+
// discontinue(2026-08-12~)
|
|
158
|
+
// [
|
|
159
|
+
// { 'object.subReservation.reservationFor.id': 1, startDate: -1 },
|
|
160
|
+
// {
|
|
161
|
+
// name: 'searchByObjectSubReservationsReservationForId',
|
|
162
|
+
// partialFilterExpression: {
|
|
163
|
+
// 'object.subReservation.reservationFor.id': { $exists: true }
|
|
164
|
+
// }
|
|
165
|
+
// }
|
|
166
|
+
// ],
|
|
163
167
|
[
|
|
164
168
|
{ 'object.subReservation.reservedTicket.ticketedSeat.seatNumber': 1, startDate: -1 },
|
|
165
169
|
{
|
|
@@ -178,15 +182,16 @@ const indexes = [
|
|
|
178
182
|
}
|
|
179
183
|
}
|
|
180
184
|
],
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
185
|
+
// discontinue(2026-08-12~)
|
|
186
|
+
// [
|
|
187
|
+
// { 'object.underName.id': 1, startDate: -1 },
|
|
188
|
+
// {
|
|
189
|
+
// name: 'searchByObjectUnderNameId',
|
|
190
|
+
// partialFilterExpression: {
|
|
191
|
+
// 'object.underName.id': { $exists: true }
|
|
192
|
+
// }
|
|
193
|
+
// }
|
|
194
|
+
// ],
|
|
190
195
|
[
|
|
191
196
|
{ 'object.reservationNumber': 1, startDate: -1 },
|
|
192
197
|
{
|
|
@@ -217,42 +222,46 @@ const indexes = [
|
|
|
217
222
|
partialFilterExpression: { 'object.reservations.reservationFor.id': { $exists: true } }
|
|
218
223
|
}
|
|
219
224
|
],
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
225
|
+
// discontinue(2026-08-12~)
|
|
226
|
+
// [
|
|
227
|
+
// { 'object.fromLocation.identifier': 1, startDate: -1 },
|
|
228
|
+
// {
|
|
229
|
+
// name: 'searchByObjectFromLocationIdentifier',
|
|
230
|
+
// partialFilterExpression: {
|
|
231
|
+
// 'object.fromLocation.identifier': { $exists: true }
|
|
232
|
+
// }
|
|
233
|
+
// }
|
|
234
|
+
// ],
|
|
235
|
+
// discontinue(2026-08-12~)
|
|
236
|
+
// [
|
|
237
|
+
// { 'object.toLocation.identifier': 1, startDate: -1 },
|
|
238
|
+
// {
|
|
239
|
+
// name: 'searchByObjectToLocationIdentifier',
|
|
240
|
+
// partialFilterExpression: {
|
|
241
|
+
// 'object.toLocation.identifier': { $exists: true }
|
|
242
|
+
// }
|
|
243
|
+
// }
|
|
244
|
+
// ],
|
|
245
|
+
// discontinue(2026-08-12~)
|
|
246
|
+
// [
|
|
247
|
+
// { 'object.pendingTransaction.identifier': 1, startDate: -1 },
|
|
248
|
+
// {
|
|
249
|
+
// name: 'searchByObjectPendingTransactionIdentifier',
|
|
250
|
+
// partialFilterExpression: {
|
|
251
|
+
// 'object.pendingTransaction.identifier': { $exists: true }
|
|
252
|
+
// }
|
|
253
|
+
// }
|
|
254
|
+
// ],
|
|
255
|
+
// discontinue(2026-08-12~)
|
|
256
|
+
// [
|
|
257
|
+
// { 'object.itemOffered.serviceOutput.identifier': 1, startDate: -1 },
|
|
258
|
+
// {
|
|
259
|
+
// name: 'searchByObjectItemOfferedServiceOutputIdentifier',
|
|
260
|
+
// partialFilterExpression: {
|
|
261
|
+
// 'object.itemOffered.serviceOutput.identifier': { $exists: true }
|
|
262
|
+
// }
|
|
263
|
+
// }
|
|
264
|
+
// ],
|
|
256
265
|
[
|
|
257
266
|
{ 'object.typeOf': 1, startDate: -1 },
|
|
258
267
|
{
|
|
@@ -44,6 +44,13 @@ const schemaOptions = {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
const indexes = [
|
|
47
|
+
[
|
|
48
|
+
{ validThrough: 1 },
|
|
49
|
+
{
|
|
50
|
+
name: 'ttlByValidThrough', // support ttl index(2026-08-11~)
|
|
51
|
+
expireAfterSeconds: 0 // 0 days
|
|
52
|
+
}
|
|
53
|
+
],
|
|
47
54
|
[
|
|
48
55
|
{ validFrom: 1 },
|
|
49
56
|
{ name: 'validFrom' }
|
|
@@ -45,6 +45,13 @@ const schemaOptions = {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
const indexes = [
|
|
48
|
+
[
|
|
49
|
+
{ expires: 1 },
|
|
50
|
+
{
|
|
51
|
+
name: 'ttlByExpires', // support ttl index(2026-08-11~)
|
|
52
|
+
expireAfterSeconds: 0 // 0 days
|
|
53
|
+
}
|
|
54
|
+
],
|
|
48
55
|
[
|
|
49
56
|
{ bookingTime: -1 },
|
|
50
57
|
{ name: 'bookingTime' }
|
|
@@ -113,10 +120,10 @@ const indexes = [
|
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
122
|
],
|
|
116
|
-
[
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
]
|
|
123
|
+
// [
|
|
124
|
+
// { expires: 1 },
|
|
125
|
+
// { name: 'deleteExpiredMany' }
|
|
126
|
+
// ]
|
|
120
127
|
];
|
|
121
128
|
exports.indexes = indexes;
|
|
122
129
|
/**
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = Omit<factory.
|
|
5
|
-
|
|
4
|
+
type IDocType = Omit<factory.action.update.add.IAction, 'id' | 'potentialActions' | 'purpose'> & {
|
|
5
|
+
replacer?: never;
|
|
6
|
+
} | Omit<factory.action.update.replace.IAction, 'id' | 'potentialActions' | 'purpose'> | Omit<factory.action.update.update.IAction, 'id' | 'potentialActions' | 'purpose'> & {
|
|
7
|
+
replacer?: never;
|
|
6
8
|
};
|
|
7
9
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
8
10
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
9
11
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
10
|
-
declare const modelName = "
|
|
12
|
+
declare const modelName = "UpdateAction";
|
|
11
13
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
12
14
|
declare function createSchema(): ISchema;
|
|
13
15
|
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -0,0 +1,65 @@
|
|
|
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 = 'UpdateAction';
|
|
9
|
+
exports.modelName = modelName;
|
|
10
|
+
const schemaDefinition = {
|
|
11
|
+
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
+
actionStatus: String,
|
|
13
|
+
typeOf: String,
|
|
14
|
+
agent: mongoose_1.SchemaTypes.Mixed,
|
|
15
|
+
result: mongoose_1.SchemaTypes.Mixed,
|
|
16
|
+
error: mongoose_1.SchemaTypes.Mixed,
|
|
17
|
+
object: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
+
startDate: Date,
|
|
19
|
+
endDate: Date,
|
|
20
|
+
instrument: mongoose_1.SchemaTypes.Mixed,
|
|
21
|
+
replacer: mongoose_1.SchemaTypes.Mixed,
|
|
22
|
+
targetCollection: mongoose_1.SchemaTypes.Mixed,
|
|
23
|
+
sameAs: mongoose_1.SchemaTypes.Mixed,
|
|
24
|
+
};
|
|
25
|
+
const schemaOptions = {
|
|
26
|
+
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
27
|
+
autoCreate: false,
|
|
28
|
+
collection: 'updateActions',
|
|
29
|
+
id: true,
|
|
30
|
+
read: 'primary',
|
|
31
|
+
writeConcern: writeConcern_1.writeConcern,
|
|
32
|
+
strict: true,
|
|
33
|
+
strictQuery: false,
|
|
34
|
+
timestamps: false,
|
|
35
|
+
versionKey: false,
|
|
36
|
+
toJSON: {
|
|
37
|
+
getters: false,
|
|
38
|
+
virtuals: false,
|
|
39
|
+
minimize: false,
|
|
40
|
+
versionKey: false
|
|
41
|
+
},
|
|
42
|
+
toObject: {
|
|
43
|
+
getters: false,
|
|
44
|
+
virtuals: true,
|
|
45
|
+
minimize: false,
|
|
46
|
+
versionKey: false
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const indexes = [];
|
|
50
|
+
exports.indexes = indexes;
|
|
51
|
+
/**
|
|
52
|
+
* 編集アクションスキーマ
|
|
53
|
+
*/
|
|
54
|
+
let schema;
|
|
55
|
+
function createSchema() {
|
|
56
|
+
if (schema === undefined) {
|
|
57
|
+
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
58
|
+
}
|
|
59
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
60
|
+
indexes.forEach((indexParams) => {
|
|
61
|
+
schema?.index(...indexParams);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return schema;
|
|
65
|
+
}
|