@chevre/domain 20.1.0-alpha.44 → 20.1.0-alpha.45
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.
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
+
|
|
11
|
+
const reservationRepo = new chevre.repository.Reservation(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const result = await reservationRepo.deleteReservedTicketUnderName();
|
|
14
|
+
|
|
15
|
+
console.log('deleted', result);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
main()
|
|
19
|
+
.then()
|
|
20
|
+
.catch(console.error);
|
|
@@ -1087,5 +1087,17 @@ class MongoRepository {
|
|
|
1087
1087
|
.then((docs) => docs.map((doc) => doc._id.toString()));
|
|
1088
1088
|
});
|
|
1089
1089
|
}
|
|
1090
|
+
deleteReservedTicketUnderName() {
|
|
1091
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1092
|
+
const conditions = {
|
|
1093
|
+
'reservedTicket.underName': { $exists: true }
|
|
1094
|
+
};
|
|
1095
|
+
const update = {
|
|
1096
|
+
$unset: { 'reservedTicket.underName': 1 }
|
|
1097
|
+
};
|
|
1098
|
+
return this.reservationModel.updateMany(conditions, update)
|
|
1099
|
+
.exec();
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1090
1102
|
}
|
|
1091
1103
|
exports.MongoRepository = MongoRepository;
|
|
@@ -4,16 +4,16 @@ exports.NUM_TRY_INFORM_RESERVATION = exports.maskUnderName = void 0;
|
|
|
4
4
|
const reservedAgentIdentifireNames_1 = require("../../factory/reservedAgentIdentifireNames");
|
|
5
5
|
const MASKED_PROFILE = '****';
|
|
6
6
|
function maskUnderName(reservation) {
|
|
7
|
-
var _a;
|
|
8
|
-
const underName = (typeof ((_a = reservation.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
9
|
-
? Object.assign(Object.assign({}, reservation.underName), { email: MASKED_PROFILE, telephone: MASKED_PROFILE, name: MASKED_PROFILE, familyName: MASKED_PROFILE, givenName: MASKED_PROFILE }) : undefined;
|
|
7
|
+
var _a, _b, _c;
|
|
10
8
|
// 予約後を隠蔽(2022-12-24~)
|
|
11
|
-
const
|
|
12
|
-
? reservation.identifier.filter((p) => {
|
|
9
|
+
const underNameIdentifiers = (Array.isArray((_a = reservation.underName) === null || _a === void 0 ? void 0 : _a.identifier))
|
|
10
|
+
? (_b = reservation.underName) === null || _b === void 0 ? void 0 : _b.identifier.filter((p) => {
|
|
13
11
|
return !reservedAgentIdentifireNames_1.RESERVED_AGENT_IDENTIFIER_NAMES.includes(p.name);
|
|
14
12
|
})
|
|
15
13
|
: undefined;
|
|
16
|
-
|
|
14
|
+
const underName = (typeof ((_c = reservation.underName) === null || _c === void 0 ? void 0 : _c.typeOf) === 'string')
|
|
15
|
+
? Object.assign(Object.assign(Object.assign({}, reservation.underName), { email: MASKED_PROFILE, telephone: MASKED_PROFILE, name: MASKED_PROFILE, familyName: MASKED_PROFILE, givenName: MASKED_PROFILE }), (Array.isArray(underNameIdentifiers)) ? { identifier: underNameIdentifiers } : undefined) : undefined;
|
|
16
|
+
return Object.assign(Object.assign({}, reservation), (underName !== undefined) ? { underName } : undefined);
|
|
17
17
|
}
|
|
18
18
|
exports.maskUnderName = maskUnderName;
|
|
19
19
|
exports.NUM_TRY_INFORM_RESERVATION = 10;
|
package/package.json
CHANGED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
-
|
|
12
|
-
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const cursor = eventRepo.getCursor(
|
|
15
|
-
{
|
|
16
|
-
'project.id': { $eq: project.id },
|
|
17
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
18
|
-
// 'superEvent.location.branchCode': { $eq: '118', $exists: true },
|
|
19
|
-
endDate: {
|
|
20
|
-
$exists: true,
|
|
21
|
-
$lt: moment()
|
|
22
|
-
.add(-1, 'month')
|
|
23
|
-
.toDate()
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
// _id: 1,
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
console.log('events found');
|
|
31
|
-
|
|
32
|
-
let i = 0;
|
|
33
|
-
let updateCount = 0;
|
|
34
|
-
await cursor.eachAsync(async (doc) => {
|
|
35
|
-
i += 1;
|
|
36
|
-
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
37
|
-
|
|
38
|
-
console.log('deleting event...', event.project.id, event.id, event.startDate, i);
|
|
39
|
-
await eventRepo.deleteById({ id: event.id });
|
|
40
|
-
updateCount += 1;
|
|
41
|
-
console.log('deleted', event.project.id, event.id, event.startDate, i);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
console.log(i, 'events checked');
|
|
45
|
-
console.log(updateCount, 'events updated');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
main()
|
|
49
|
-
.then()
|
|
50
|
-
.catch(console.error);
|