@chevre/domain 23.2.0-alpha.12 → 23.2.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/example/src/chevre/place/seatsJson2csv.ts +63 -0
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +1 -1
- package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +1 -1
- package/lib/chevre/service/offer/event/searchOffersByIds.js +1 -1
- package/lib/chevre/service/offer/onEventChanged.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
+
import { Parser } from '@json2csv/plainjs';
|
|
4
|
+
import * as mongoose from 'mongoose';
|
|
5
|
+
import { chevre } from '../../../../lib/index';
|
|
6
|
+
|
|
7
|
+
const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const seatRepo = await chevre.repository.place.Seat.createInstance(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
const seats = await seatRepo.searchSeats(
|
|
15
|
+
{
|
|
16
|
+
project: { id: { $eq: project.id } },
|
|
17
|
+
containedInPlace: {
|
|
18
|
+
// branchCode: { $eq: 'Default02' },
|
|
19
|
+
branchCode: { $eq: 'Default' },
|
|
20
|
+
containedInPlace: {
|
|
21
|
+
branchCode: { $eq: '10' },
|
|
22
|
+
containedInPlace: { branchCode: { $eq: '118' } }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
console.log(seats);
|
|
28
|
+
console.log(seats.length, 'seats found');
|
|
29
|
+
try {
|
|
30
|
+
const opts = {
|
|
31
|
+
// formatters: {
|
|
32
|
+
// // Define how strings are formatted
|
|
33
|
+
// string: (value) => {
|
|
34
|
+
// // if (value.includes(',') || value.includes('"') || value.includes('\n')) {
|
|
35
|
+
// // return `"${value.replace(/"/g, '""')}"`; // Standard CSV escaping
|
|
36
|
+
// // }
|
|
37
|
+
// // if (value === '') {
|
|
38
|
+
// // return `""`; // Standard CSV escaping
|
|
39
|
+
// // }
|
|
40
|
+
|
|
41
|
+
// return value; // No quotes if safe
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
};
|
|
45
|
+
const parser = new Parser(opts);
|
|
46
|
+
const csv = parser.parse(seats.map((seat) => {
|
|
47
|
+
// branchCode,seatingType,name.ja,name.en
|
|
48
|
+
return {
|
|
49
|
+
branchCode: seat.branchCode,
|
|
50
|
+
...(Array.isArray(seat.seatingType) && seat.seatingType.length > 0) ? { seatingType: seat.seatingType[0] } : undefined,
|
|
51
|
+
'name.ja': (typeof seat.name?.ja === 'string') ? seat.name.ja : '',
|
|
52
|
+
'name.en': (typeof seat.name?.en === 'string') ? seat.name.en : ''
|
|
53
|
+
};
|
|
54
|
+
}));
|
|
55
|
+
console.log(csv);
|
|
56
|
+
} catch (err) {
|
|
57
|
+
console.error(err);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
main()
|
|
62
|
+
.then(console.log)
|
|
63
|
+
.catch(console.error);
|
|
@@ -24,6 +24,7 @@ const schemaDefinition = {
|
|
|
24
24
|
headline: mongoose_1.SchemaTypes.Mixed,
|
|
25
25
|
location: mongoose_1.SchemaTypes.Mixed,
|
|
26
26
|
startDate: { type: Date, required: true }, // required(2025-10-08~)
|
|
27
|
+
subEvent: mongoose_1.SchemaTypes.Mixed, // support(2025-12-31~)
|
|
27
28
|
workPerformed: mongoose_1.SchemaTypes.Mixed,
|
|
28
29
|
videoFormat: mongoose_1.SchemaTypes.Mixed,
|
|
29
30
|
soundFormat: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -137,7 +137,7 @@ function searchEventTicketOffersByEvent(params) {
|
|
|
137
137
|
page: 1,
|
|
138
138
|
id: { $eq: event.superEvent.id }
|
|
139
139
|
// typeOf: factory.eventType.ScreeningEventSeries
|
|
140
|
-
}, ['soundFormat', 'videoFormat']);
|
|
140
|
+
}, ['soundFormat', 'videoFormat', 'subEvent']);
|
|
141
141
|
const superEvent = superEvents.shift();
|
|
142
142
|
if (superEvent === undefined) {
|
|
143
143
|
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
@@ -39,7 +39,7 @@ function searchOfferAppliesToMovieTicket(params) {
|
|
|
39
39
|
page: 1,
|
|
40
40
|
id: { $eq: event.superEvent.id }
|
|
41
41
|
// typeOf: factory.eventType.ScreeningEventSeries
|
|
42
|
-
}, ['soundFormat', 'videoFormat']);
|
|
42
|
+
}, ['soundFormat', 'videoFormat', 'subEvent']);
|
|
43
43
|
const superEvent = superEvents.shift();
|
|
44
44
|
if (superEvent === undefined) {
|
|
45
45
|
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
@@ -120,7 +120,7 @@ function searchEventTicketOffersByEvent(params) {
|
|
|
120
120
|
page: 1,
|
|
121
121
|
id: { $eq: event.superEvent.id }
|
|
122
122
|
// typeOf: factory.eventType.ScreeningEventSeries
|
|
123
|
-
}, ['soundFormat', 'videoFormat']);
|
|
123
|
+
}, ['soundFormat', 'videoFormat', 'subEvent']);
|
|
124
124
|
const superEvent = superEvents.shift();
|
|
125
125
|
if (superEvent === undefined) {
|
|
126
126
|
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
@@ -167,7 +167,7 @@ function createInformTasks(params, setting) {
|
|
|
167
167
|
}, [
|
|
168
168
|
'project', 'organizer', 'typeOf', 'name', 'location', 'videoFormat', 'soundFormat', 'workPerformed', 'kanaName', 'eventStatus',
|
|
169
169
|
'endDate', 'startDate', 'additionalProperty', 'subtitleLanguage', 'dubLanguage',
|
|
170
|
-
'alternativeHeadline', 'description', 'duration', 'headline'
|
|
170
|
+
'alternativeHeadline', 'description', 'duration', 'headline', 'subEvent'
|
|
171
171
|
] // inclusion(2024-07-30~)
|
|
172
172
|
);
|
|
173
173
|
// 最適化(2024-03-25~)
|
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": "5.4.0-alpha.
|
|
14
|
+
"@chevre/factory": "5.4.0-alpha.10",
|
|
15
15
|
"@cinerino/sdk": "12.12.1",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"description": "Chevre Domain Library for Node.js",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/js": "9.16.0",
|
|
36
|
+
"@json2csv/plainjs": "7.0.6",
|
|
36
37
|
"@sendgrid/helpers": "8.0.0",
|
|
37
38
|
"@types/debug": "0.0.30",
|
|
38
39
|
"@types/google-libphonenumber": "^7.4.19",
|
|
@@ -115,5 +116,5 @@
|
|
|
115
116
|
"postversion": "git push origin --tags",
|
|
116
117
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
118
|
},
|
|
118
|
-
"version": "23.2.0-alpha.
|
|
119
|
+
"version": "23.2.0-alpha.13"
|
|
119
120
|
}
|