@chevre/domain 22.5.0 → 22.6.0-alpha.0
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/searchIdsByReservationNumber.ts +16 -0
- package/lib/chevre/repo/reservation.js +5 -12
- package/lib/chevre/service/reserve/checkInReservation.js +22 -9
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +2 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +8 -4
- package/package.json +2 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
+
const reservationRepo = await chevre.repository.Reservation.createInstance(mongoose.connection);
|
|
9
|
+
const ids = await reservationRepo.searchIdsByReservationNumber({ reservationNumber: { $in: ['283297254100608'] } });
|
|
10
|
+
console.log(ids);
|
|
11
|
+
console.log(ids.length, 'reservations found');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
main()
|
|
15
|
+
.then(console.log)
|
|
16
|
+
.catch(console.error);
|
|
@@ -1120,23 +1120,16 @@ class ReservationRepo {
|
|
|
1120
1120
|
reservationNumber: {
|
|
1121
1121
|
$in: params.reservationNumber.$in
|
|
1122
1122
|
}
|
|
1123
|
+
}, {
|
|
1124
|
+
_id: 0,
|
|
1125
|
+
id: { $toString: '$_id' }
|
|
1123
1126
|
})
|
|
1124
|
-
.
|
|
1127
|
+
.lean()
|
|
1125
1128
|
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
1126
1129
|
.exec()
|
|
1127
|
-
.then((docs) => docs.map((
|
|
1130
|
+
.then((docs) => docs.map(({ id }) => id));
|
|
1128
1131
|
});
|
|
1129
1132
|
}
|
|
1130
|
-
// public async deleteReservedTicketUnderName() {
|
|
1131
|
-
// const conditions = {
|
|
1132
|
-
// 'reservedTicket.underName': { $exists: true }
|
|
1133
|
-
// };
|
|
1134
|
-
// const update = {
|
|
1135
|
-
// $unset: { 'reservedTicket.underName': 1 }
|
|
1136
|
-
// };
|
|
1137
|
-
// return this.reservationModel.updateMany(conditions, update)
|
|
1138
|
-
// .exec();
|
|
1139
|
-
// }
|
|
1140
1133
|
getCursor(conditions, projection) {
|
|
1141
1134
|
return this.reservationModel.find(conditions, projection)
|
|
1142
1135
|
.sort({ bookingTime: factory.sortType.Descending })
|
|
@@ -49,15 +49,28 @@ function checkInReservation(params) {
|
|
|
49
49
|
reservationNumber: { $in: params.object.reservationNumbers }
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
if (Array.isArray(checkedInReservationIds)) {
|
|
53
|
+
yield (0, onReservationCheckedIn_1.onReservationCheckedIn)({
|
|
54
|
+
project: params.project,
|
|
55
|
+
object: {
|
|
56
|
+
ids: checkedInReservationIds,
|
|
57
|
+
reservationFor: params.object.reservationFor
|
|
58
|
+
},
|
|
59
|
+
now,
|
|
60
|
+
purpose: params.purpose
|
|
61
|
+
})(repos, settings);
|
|
62
|
+
}
|
|
63
|
+
else if (Array.isArray(params.object.reservationNumbers) && params.object.reservationNumbers.length > 0) {
|
|
64
|
+
yield (0, onReservationCheckedIn_1.onReservationCheckedIn)({
|
|
65
|
+
project: params.project,
|
|
66
|
+
object: {
|
|
67
|
+
reservationNumbers: params.object.reservationNumbers,
|
|
68
|
+
reservationFor: params.object.reservationFor
|
|
69
|
+
},
|
|
70
|
+
now,
|
|
71
|
+
purpose: params.purpose
|
|
72
|
+
})(repos, settings);
|
|
73
|
+
}
|
|
61
74
|
});
|
|
62
75
|
}
|
|
63
76
|
exports.checkInReservation = checkInReservation;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EventRepo } from '../../../repo/event';
|
|
2
|
+
import type { ReservationRepo } from '../../../repo/reservation';
|
|
2
3
|
import type { TaskRepo } from '../../../repo/task';
|
|
3
4
|
import { Settings } from '../../../settings';
|
|
4
5
|
export declare function onReservationCheckedIn(params: {
|
|
@@ -30,5 +31,6 @@ export declare function onReservationCheckedIn(params: {
|
|
|
30
31
|
};
|
|
31
32
|
}): (repos: {
|
|
32
33
|
event: EventRepo;
|
|
34
|
+
reservation: ReservationRepo;
|
|
33
35
|
task: TaskRepo;
|
|
34
36
|
}, settings: Settings) => Promise<void>;
|
|
@@ -31,10 +31,14 @@ function onReservationCheckedIn(params) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
if (Array.isArray(params.object.reservationNumbers) && params.object.reservationNumbers.length > 0) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
// ReservationPackageへ変更(2024-11-03~)
|
|
35
|
+
reservations4inform = yield Promise.all(params.object.reservationNumbers.map((reservationNumber, index) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const subReservationIds = yield repos.reservation.searchIdsByReservationNumber({
|
|
37
|
+
reservationNumber: { $in: [reservationNumber] }
|
|
38
|
+
});
|
|
39
|
+
return Object.assign({ typeOf: factory.reservationType.ReservationPackage, project,
|
|
40
|
+
reservationNumber, checkedIn: true, modifiedTime: params.now, subReservation: subReservationIds.map((id) => ({ id })) }, (index === 0 && typeof ticketToken === 'string') ? { reservedTicket: { ticketToken } } : undefined);
|
|
41
|
+
})));
|
|
38
42
|
}
|
|
39
43
|
if (reservations4inform.length > 0) {
|
|
40
44
|
const informTaskRunsAt = params.now;
|
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": "4.
|
|
14
|
+
"@chevre/factory": "4.389.0-alpha.0",
|
|
15
15
|
"@cinerino/sdk": "10.16.0-alpha.5",
|
|
16
16
|
"@motionpicture/coa-service": "9.5.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"postversion": "git push origin --tags",
|
|
109
109
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
110
110
|
},
|
|
111
|
-
"version": "22.
|
|
111
|
+
"version": "22.6.0-alpha.0"
|
|
112
112
|
}
|