@chevre/domain 24.1.0-alpha.11 → 24.1.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/lib/chevre/repo/assetTransaction/reserve.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction/reserve.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -2
- package/lib/chevre/repo/mongoose/schemas/reservation.js +5 -8
- package/lib/chevre/repo/reservation.d.ts +19 -5
- package/lib/chevre/repo/reservation.js +1 -0
- package/lib/chevre/repo/role.d.ts +1 -15
- package/lib/chevre/repo/role.js +7 -14
- package/lib/chevre/service/assetTransaction/cancelReservation/start.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/cancelReservation/start.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +0 -12
- package/lib/chevre/service/reserve/findReservations.d.ts +2 -1
- package/lib/chevre/service/reserve/findReservations.js +6 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +1 -9
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Connection } from 'mongoose';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
3
|
type ISubReservationAsFindResult = Pick<factory.reservation.eventReservation.IReservation, 'underName' | 'id'> & {
|
|
4
|
+
numSeats?: number;
|
|
4
5
|
price?: factory.reservation.eventReservation.IPrice;
|
|
5
6
|
reservedTicket?: Pick<factory.reservation.eventReservation.IReservedTicket, 'ticketType'>;
|
|
6
7
|
reservationFor?: factory.assetTransaction.reserve.IReservationFor;
|
|
@@ -91,6 +91,7 @@ class ReserveTransactionRepo {
|
|
|
91
91
|
$project: {
|
|
92
92
|
_id: 0,
|
|
93
93
|
id: '$object.subReservation.id',
|
|
94
|
+
numSeats: '$object.subReservation.numSeats',
|
|
94
95
|
price: '$object.subReservation.price',
|
|
95
96
|
underName: '$object.underName',
|
|
96
97
|
reservationFor: '$object.reservationFor',
|
|
@@ -3,9 +3,10 @@ import { IVirtuals } from '../virtuals';
|
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
4
|
type IDocType = (Omit<factory.reservation.eventReservation.IReservation, 'id'>) & {
|
|
5
5
|
_id: string;
|
|
6
|
-
bookingAgent?: any;
|
|
7
6
|
previousReservationStatus?: factory.reservationStatusType;
|
|
8
|
-
|
|
7
|
+
price?: never;
|
|
8
|
+
priceCurrency?: never;
|
|
9
|
+
issuedThrough?: never;
|
|
9
10
|
};
|
|
10
11
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
11
12
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
@@ -22,18 +22,10 @@ const schemaDefinition = {
|
|
|
22
22
|
required: true
|
|
23
23
|
},
|
|
24
24
|
additionalTicketText: String,
|
|
25
|
-
bookingAgent: mongoose_1.SchemaTypes.Mixed,
|
|
26
25
|
bookingTime: Date,
|
|
27
26
|
broker: mongoose_1.SchemaTypes.Mixed,
|
|
28
|
-
// cancelReservationUrl: String,
|
|
29
|
-
// checkinUrl: String,
|
|
30
|
-
// confirmReservationUrl: String,
|
|
31
27
|
modifiedTime: Date,
|
|
32
|
-
// modifyReservationUrl: String,
|
|
33
|
-
numSeats: Number,
|
|
34
28
|
previousReservationStatus: String,
|
|
35
|
-
price: mongoose_1.SchemaTypes.Mixed,
|
|
36
|
-
priceCurrency: String,
|
|
37
29
|
programMembershipUsed: mongoose_1.SchemaTypes.Mixed,
|
|
38
30
|
reservationFor: mongoose_1.SchemaTypes.Mixed,
|
|
39
31
|
reservationNumber: {
|
|
@@ -50,6 +42,11 @@ const schemaDefinition = {
|
|
|
50
42
|
checkedIn: { type: Boolean, default: false },
|
|
51
43
|
attended: { type: Boolean, default: false },
|
|
52
44
|
additionalProperty: mongoose_1.SchemaTypes.Mixed,
|
|
45
|
+
// 以下廃止予定
|
|
46
|
+
// bookingAgent: SchemaTypes.Mixed,
|
|
47
|
+
numSeats: Number,
|
|
48
|
+
price: mongoose_1.SchemaTypes.Mixed,
|
|
49
|
+
priceCurrency: String,
|
|
53
50
|
issuedThrough: mongoose_1.SchemaTypes.Mixed
|
|
54
51
|
};
|
|
55
52
|
const schemaOptions = {
|
|
@@ -20,7 +20,7 @@ export type ICreatingReservation = Omit<factory.reservation.eventReservation.IRe
|
|
|
20
20
|
/**
|
|
21
21
|
* 廃止予定の予約属性
|
|
22
22
|
*/
|
|
23
|
-
export type IDeprecatedField = 'price' | 'underName';
|
|
23
|
+
export type IDeprecatedField = 'price' | 'underName' | 'priceCurrency' | 'issuedThrough' | 'numSeats';
|
|
24
24
|
export type IKeyOfProjection = Exclude<keyof factory.reservation.eventReservation.IReservation, IDeprecatedField> | 'reservedTicket.dateUsed' | 'reservationFor.id' | 'reservationFor.typeOf';
|
|
25
25
|
export type IAttendedReservation = Pick<factory.reservation.eventReservation.IReservation, 'id' | 'typeOf' | 'project' | 'modifiedTime'> & {
|
|
26
26
|
reservationFor: Pick<factory.reservation.eventReservation.IReservationForMinimized, 'id' | 'typeOf'>;
|
|
@@ -35,6 +35,18 @@ export type IReservationAsFindResult = Omit<factory.reservation.eventReservation
|
|
|
35
35
|
* 実データとしてはまだ存在しているが型から廃止(2026-03-26~)
|
|
36
36
|
*/
|
|
37
37
|
underName?: never;
|
|
38
|
+
/**
|
|
39
|
+
* discontinue(2026-05-10~)
|
|
40
|
+
*/
|
|
41
|
+
priceCurrency?: never;
|
|
42
|
+
/**
|
|
43
|
+
* discontinue(2026-05-10~)
|
|
44
|
+
*/
|
|
45
|
+
issuedThrough?: never;
|
|
46
|
+
/**
|
|
47
|
+
* discontinue(2026-05-11~)
|
|
48
|
+
*/
|
|
49
|
+
numSeats?: never;
|
|
38
50
|
};
|
|
39
51
|
/**
|
|
40
52
|
* 予約リポジトリ
|
|
@@ -142,18 +154,20 @@ export declare class ReservationRepo {
|
|
|
142
154
|
}): Promise<string[]>;
|
|
143
155
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id"> & {
|
|
144
156
|
_id: string;
|
|
145
|
-
bookingAgent?: any;
|
|
146
157
|
previousReservationStatus?: factory.reservationStatusType;
|
|
147
|
-
|
|
158
|
+
price?: never;
|
|
159
|
+
priceCurrency?: never;
|
|
160
|
+
issuedThrough?: never;
|
|
148
161
|
} & Required<{
|
|
149
162
|
_id: string;
|
|
150
163
|
}> & {
|
|
151
164
|
__v: number;
|
|
152
165
|
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id"> & {
|
|
153
166
|
_id: string;
|
|
154
|
-
bookingAgent?: any;
|
|
155
167
|
previousReservationStatus?: factory.reservationStatusType;
|
|
156
|
-
|
|
168
|
+
price?: never;
|
|
169
|
+
priceCurrency?: never;
|
|
170
|
+
issuedThrough?: never;
|
|
157
171
|
} & Required<{
|
|
158
172
|
_id: string;
|
|
159
173
|
}> & {
|
|
@@ -115,6 +115,7 @@ class ReservationRepo {
|
|
|
115
115
|
if (Array.isArray(params.subReservation)) {
|
|
116
116
|
params.subReservation.forEach((subReservation) => {
|
|
117
117
|
const { price: _discontinuePrice, reservedTicket, priceCurrency: _discontinuePriceCurrency, // discontinue priceCurrency
|
|
118
|
+
numSeats: _numSeats, // discontinue(2026-05-11~)
|
|
118
119
|
...subReservationWithoutPrice } = subReservation;
|
|
119
120
|
const { ticketType: _ticketType, ...reservedTicketWithoutTicketType } = reservedTicket;
|
|
120
121
|
// discontinue ticketType(2026-05-09~)
|
|
@@ -59,23 +59,9 @@ export declare class RoleRepo {
|
|
|
59
59
|
} & {
|
|
60
60
|
__v: number;
|
|
61
61
|
}) | null>;
|
|
62
|
-
addMember(params: Pick<IRole, 'member' | 'memberOf' | 'roleName'>): Promise<(import("mongoose").FlattenMaps<{
|
|
63
|
-
typeOf: import("@chevre/factory/lib/chevre/role").RoleType;
|
|
64
|
-
memberOf: {
|
|
65
|
-
typeOf: factory.organizationType.Corporation | factory.organizationType.Project;
|
|
66
|
-
};
|
|
67
|
-
member: {
|
|
68
|
-
typeOf: import("@chevre/factory/lib/chevre/role/organizationRole").IMemberType;
|
|
69
|
-
};
|
|
70
|
-
roleName: import("@chevre/factory/lib/chevre/role/organizationRole").RoleName;
|
|
71
|
-
permissions: string[];
|
|
72
|
-
}> & {
|
|
73
|
-
_id: import("mongoose").Types.ObjectId;
|
|
74
|
-
} & {
|
|
75
|
-
__v: number;
|
|
76
|
-
}) | null>;
|
|
77
62
|
create(params: Pick<IRole, 'member' | 'memberOf' | 'permissions' | 'roleName'>): Promise<{
|
|
78
63
|
id: string;
|
|
79
64
|
}>;
|
|
65
|
+
deleteByRoleName(params: Pick<IRole, 'roleName'>): Promise<import("mongodb").DeleteResult>;
|
|
80
66
|
}
|
|
81
67
|
export {};
|
package/lib/chevre/repo/role.js
CHANGED
|
@@ -139,20 +139,6 @@ class RoleRepo {
|
|
|
139
139
|
.lean()
|
|
140
140
|
.exec();
|
|
141
141
|
}
|
|
142
|
-
async addMember(params) {
|
|
143
|
-
const { roleName, member, memberOf } = params;
|
|
144
|
-
return this.roleModel.findOneAndUpdate({
|
|
145
|
-
roleName: { $eq: roleName },
|
|
146
|
-
'member.typeOf': { $ne: member.typeOf }
|
|
147
|
-
}, {
|
|
148
|
-
$set: { member, memberOf }
|
|
149
|
-
}, {
|
|
150
|
-
new: true,
|
|
151
|
-
projection: { _id: 1 }
|
|
152
|
-
})
|
|
153
|
-
.lean()
|
|
154
|
-
.exec();
|
|
155
|
-
}
|
|
156
142
|
async create(params) {
|
|
157
143
|
const { member, memberOf, permissions, roleName } = params;
|
|
158
144
|
const creatingRole = {
|
|
@@ -167,5 +153,12 @@ class RoleRepo {
|
|
|
167
153
|
const savedId = insertedId;
|
|
168
154
|
return { id: savedId };
|
|
169
155
|
}
|
|
156
|
+
async deleteByRoleName(params) {
|
|
157
|
+
const { roleName } = params;
|
|
158
|
+
return this.roleModel.deleteOne({
|
|
159
|
+
roleName: { $eq: roleName }
|
|
160
|
+
})
|
|
161
|
+
.exec();
|
|
162
|
+
}
|
|
170
163
|
}
|
|
171
164
|
exports.RoleRepo = RoleRepo;
|
|
@@ -18,7 +18,7 @@ export declare function validateStartParams(params: IStartParams): (repos: {
|
|
|
18
18
|
assetTransaction: AssetTransactionRepo;
|
|
19
19
|
}) => Promise<{
|
|
20
20
|
reserveTransaction: import("@chevre/factory/lib/chevre/assetTransaction/reserve").ITransaction | undefined;
|
|
21
|
-
reservations: (Pick<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id" | "typeOf" | "
|
|
21
|
+
reservations: (Pick<import("@chevre/factory/lib/chevre/reservation/event").IReservation, "id" | "typeOf" | "reservationNumber"> & {
|
|
22
22
|
reservationFor: Pick<factory.reservation.eventReservation.IReservationForMinimized, "id" | "typeOf">;
|
|
23
23
|
})[] | undefined;
|
|
24
24
|
}>;
|
|
@@ -43,7 +43,7 @@ function validateStartParams(params) {
|
|
|
43
43
|
const reservation = await repos.reservation.findReservationById({
|
|
44
44
|
id: params.object.reservation.id,
|
|
45
45
|
inclusion: [
|
|
46
|
-
'
|
|
46
|
+
'typeOf', 'reservationNumber', 'reservationFor.id', 'reservationFor.typeOf', 'provider', 'reservationStatus'
|
|
47
47
|
]
|
|
48
48
|
});
|
|
49
49
|
// 販売者検証(2023-08-01~)
|
|
@@ -328,27 +328,17 @@ function createReservation(params) {
|
|
|
328
328
|
const price4reservation = (0, price_1.createPrice)(params);
|
|
329
329
|
if (params.reservationFor.typeOf === factory_1.factory.eventType.ScreeningEvent) {
|
|
330
330
|
return {
|
|
331
|
-
// project: params.project, // 廃止(2024-04-08~)
|
|
332
331
|
typeOf: factory_1.factory.reservationType.EventReservation,
|
|
333
332
|
id: params.id,
|
|
334
333
|
// reservationPackage保管に移行(2023-06-06~)
|
|
335
334
|
// issuedThrough,
|
|
336
335
|
additionalProperty: params.additionalProperty,
|
|
337
|
-
// bookingTime: params.reserveDate, // 廃止(2024-04-08~)
|
|
338
|
-
// modifiedTime: params.reserveDate, // 廃止(2024-04-08~)
|
|
339
336
|
numSeats: 1,
|
|
340
337
|
price: price4reservation,
|
|
341
338
|
priceCurrency: factory_1.factory.priceCurrency.JPY,
|
|
342
|
-
// reservationNumber: params.reservationNumber, // 廃止(2024-04-08~)
|
|
343
339
|
// statusは不要なので削除(2023-07-19~)
|
|
344
340
|
// reservationStatus: factory.reservationStatusType.ReservationPending,
|
|
345
341
|
reservedTicket: params.reservedTicket,
|
|
346
|
-
// underName: { // 廃止(2024-04-08~)
|
|
347
|
-
// typeOf: params.agent.typeOf,
|
|
348
|
-
// name: params.agent.name
|
|
349
|
-
// },
|
|
350
|
-
// checkedIn: false, // 廃止(2024-04-08~)
|
|
351
|
-
// attended: false, // 廃止(2024-04-08~)
|
|
352
342
|
...(typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined,
|
|
353
343
|
...(Array.isArray(params.subReservation))
|
|
354
344
|
? {
|
|
@@ -362,8 +352,6 @@ function createReservation(params) {
|
|
|
362
352
|
})
|
|
363
353
|
}
|
|
364
354
|
: undefined,
|
|
365
|
-
// reservationPackage保管に移行(2023-06-06~)
|
|
366
|
-
// ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined,
|
|
367
355
|
...(typeof params.programMembershipUsed?.identifier === 'string')
|
|
368
356
|
? { programMembershipUsed: params.programMembershipUsed }
|
|
369
357
|
: undefined
|
|
@@ -5,13 +5,14 @@ import type { IDeprecatedField, IKeyOfProjection, ReservationRepo } from '../../
|
|
|
5
5
|
* 予約検索レスポンスとしての予約
|
|
6
6
|
* 予約ドキュメントに予約取引の情報を補完する
|
|
7
7
|
*/
|
|
8
|
-
type IReservationAsFindResult = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'priceCurrency' | 'underName' | 'reservedTicket' | 'reservationFor' | 'issuedThrough'> & {
|
|
8
|
+
type IReservationAsFindResult = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'priceCurrency' | 'underName' | 'reservedTicket' | 'reservationFor' | 'issuedThrough' | 'numSeats'> & {
|
|
9
9
|
price?: factory.reservation.eventReservation.IPrice;
|
|
10
10
|
priceCurrency?: factory.priceCurrency.JPY;
|
|
11
11
|
underName?: factory.assetTransaction.reserve.IUnderName;
|
|
12
12
|
reservedTicket?: factory.assetTransaction.reserve.IObjectSubReservation['reservedTicket'];
|
|
13
13
|
reservationFor?: factory.assetTransaction.reserve.IReservationFor;
|
|
14
14
|
issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
|
|
15
|
+
numSeats?: number;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
18
|
* 予約を検索する
|
|
@@ -25,6 +25,7 @@ function findReservations(params, options) {
|
|
|
25
25
|
const requireReservedTicket = Object.keys(inclusion).includes('reservedTicket');
|
|
26
26
|
const requireReservationFor = Object.keys(inclusion).includes('reservationFor');
|
|
27
27
|
const requireIssuedThrough = Object.keys(inclusion).includes('issuedThrough');
|
|
28
|
+
const requireNumSeats = Object.keys(inclusion).includes('numSeats');
|
|
28
29
|
const reservationIds = rawReservations.map(({ id }) => id);
|
|
29
30
|
const subReservations = await repos.assetTransaction.reserve.findSubReservationsById({
|
|
30
31
|
ids: reservationIds
|
|
@@ -38,6 +39,7 @@ function findReservations(params, options) {
|
|
|
38
39
|
const ticketTypeByTransaction = subReservationByTransaction?.reservedTicket?.ticketType;
|
|
39
40
|
const reservationForByTransaction = subReservationByTransaction?.reservationFor;
|
|
40
41
|
const issuedThroughByTransaction = subReservationByTransaction?.issuedThrough;
|
|
42
|
+
const numSeatsByTransaction = subReservationByTransaction?.numSeats;
|
|
41
43
|
// 予約ドキュメントを最適化し始めたため、もう等しくない(2026-04-06~)
|
|
42
44
|
// // 予約取引から参照した属性と全く等しいはず
|
|
43
45
|
// if (requirePrice) {
|
|
@@ -53,7 +55,7 @@ function findReservations(params, options) {
|
|
|
53
55
|
// console.error('reservationForMatched: false!!!', reservation.id);
|
|
54
56
|
// }
|
|
55
57
|
// }
|
|
56
|
-
const { reservationFor: _reservationFor, issuedThrough: _issuedThrough, priceCurrency: _priceCurrency, reservedTicket, ...rawReservation4result } = reservation;
|
|
58
|
+
const { reservationFor: _reservationFor, issuedThrough: _issuedThrough, priceCurrency: _priceCurrency, numSeats: _numSeats, reservedTicket, ...rawReservation4result } = reservation;
|
|
57
59
|
return {
|
|
58
60
|
...rawReservation4result, // 予約ドキュメントはそのまま返す
|
|
59
61
|
...(requirePrice && priceByTransaction !== undefined) ? { price: priceByTransaction } : undefined, // priceがあれば上書き
|
|
@@ -73,6 +75,9 @@ function findReservations(params, options) {
|
|
|
73
75
|
...(requireIssuedThrough && issuedThroughByTransaction !== undefined)
|
|
74
76
|
? { issuedThrough: issuedThroughByTransaction }
|
|
75
77
|
: undefined, // issuedThroughがあれば上書き(2026-05-09~)
|
|
78
|
+
...(requireNumSeats && numSeatsByTransaction !== undefined)
|
|
79
|
+
? { numSeats: numSeatsByTransaction }
|
|
80
|
+
: undefined, // issuedThroughがあれば上書き(2026-05-09~)
|
|
76
81
|
};
|
|
77
82
|
});
|
|
78
83
|
}
|
|
@@ -98,22 +98,14 @@ function onReservationConfirmed(confirmedReservations, reserveAction) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
const subReservations4inform = confirmedReservations.map((r) => {
|
|
101
|
-
const { additionalProperty, additionalTicketText,
|
|
102
|
-
// attended, checkedIn,
|
|
103
|
-
id, modifiedTime,
|
|
104
|
-
// numSeats,
|
|
105
|
-
price, programMembershipUsed, reservedTicket, subReservation, typeOf } = r;
|
|
101
|
+
const { additionalProperty, additionalTicketText, id, modifiedTime, price, programMembershipUsed, reservedTicket, subReservation, typeOf } = r;
|
|
106
102
|
return {
|
|
107
|
-
// bookingTime, // discontinue(2024-10-27~)
|
|
108
103
|
id,
|
|
109
104
|
typeOf,
|
|
110
105
|
reservedTicket,
|
|
111
106
|
...(Array.isArray(additionalProperty)) ? { additionalProperty } : undefined,
|
|
112
107
|
...(typeof additionalTicketText === 'string') ? { additionalTicketText } : undefined,
|
|
113
|
-
// ...(typeof attended === 'boolean') ? { attended } : undefined, // discontinue(2024-10-27~)
|
|
114
|
-
// ...(typeof checkedIn === 'boolean') ? { checkedIn } : undefined, // discontinue(2024-10-27~)
|
|
115
108
|
...(modifiedTime instanceof Date) ? { modifiedTime } : undefined,
|
|
116
|
-
// ...(typeof numSeats === 'number') ? { numSeats } : undefined, // discontinue(2024-10-27~)
|
|
117
109
|
...(price !== undefined) ? { price } : undefined,
|
|
118
110
|
...(programMembershipUsed !== undefined) ? { programMembershipUsed } : undefined,
|
|
119
111
|
...(Array.isArray(subReservation)) ? { subReservation } : undefined
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "8.1.0-alpha.
|
|
14
|
+
"@chevre/factory": "8.1.0-alpha.7",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "24.1.0-alpha.
|
|
94
|
+
"version": "24.1.0-alpha.13"
|
|
95
95
|
}
|