@chevre/domain 23.2.0-alpha.4 → 23.2.0-alpha.40

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.
Files changed (86) hide show
  1. package/example/src/chevre/event/importEventsFromCOAByTitle.ts +1 -1
  2. package/example/src/chevre/eventSeries/migrateEventSeriesOffers.ts +75 -0
  3. package/example/src/chevre/eventSeries/migrateEventSeriesVideoFormat.ts +80 -0
  4. package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -42
  5. package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +3 -3
  6. package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +4 -3
  7. package/example/src/chevre/place/adminEntranceGates.ts +69 -0
  8. package/example/src/chevre/place/checkEntranceGatesCount.ts +82 -0
  9. package/example/src/chevre/place/findRooms.ts +24 -0
  10. package/example/src/chevre/place/findSections.ts +28 -0
  11. package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
  12. package/example/src/chevre/place/seatsJson2csv.ts +63 -0
  13. package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +41 -0
  14. package/example/src/chevre/place/upsertRoomsByBranchCode.ts +40 -0
  15. package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +56 -0
  16. package/example/src/chevre/reIndex.ts +1 -1
  17. package/example/src/chevre/roles/addAdminEventSeriesReadPermissionIfNotExists.ts +49 -0
  18. package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
  19. package/example/src/chevre/roles/addAdminMovieTheaterReadPermissionIfNotExists.ts +34 -0
  20. package/example/src/chevre/roles/addAdminMovieTheaterWritePermissionIfNotExists.ts +34 -0
  21. package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
  22. package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
  23. package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
  24. package/lib/chevre/factory/event.js +5 -5
  25. package/lib/chevre/repo/aggregateOrder.js +0 -93
  26. package/lib/chevre/repo/aggregateReservation.d.ts +0 -1
  27. package/lib/chevre/repo/aggregateReservation.js +0 -2
  28. package/lib/chevre/repo/creativeWork.js +9 -5
  29. package/lib/chevre/repo/event.d.ts +2 -2
  30. package/lib/chevre/repo/event.js +20 -8
  31. package/lib/chevre/repo/eventOffer.d.ts +8 -0
  32. package/lib/chevre/repo/eventOffer.js +11 -0
  33. package/lib/chevre/repo/eventSeries.d.ts +10 -4
  34. package/lib/chevre/repo/eventSeries.js +56 -28
  35. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
  36. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +10 -9
  37. package/lib/chevre/repo/mongoose/schemas/eventSeries.js +10 -0
  38. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
  39. package/lib/chevre/repo/offerCatalog.d.ts +6 -1
  40. package/lib/chevre/repo/offerCatalog.js +26 -17
  41. package/lib/chevre/repo/offerCatalogItem.d.ts +6 -1
  42. package/lib/chevre/repo/offerCatalogItem.js +24 -15
  43. package/lib/chevre/repo/place/entranceGate.d.ts +57 -0
  44. package/lib/chevre/repo/place/entranceGate.js +172 -0
  45. package/lib/chevre/repo/place/movieTheater.d.ts +40 -3
  46. package/lib/chevre/repo/place/movieTheater.js +77 -6
  47. package/lib/chevre/repo/place/screeningRoom.d.ts +60 -31
  48. package/lib/chevre/repo/place/screeningRoom.js +227 -135
  49. package/lib/chevre/repo/place/seat.d.ts +47 -45
  50. package/lib/chevre/repo/place/seat.js +175 -45
  51. package/lib/chevre/repo/place/section.d.ts +60 -30
  52. package/lib/chevre/repo/place/section.js +337 -127
  53. package/lib/chevre/repo/task.d.ts +1 -1
  54. package/lib/chevre/repository.d.ts +8 -0
  55. package/lib/chevre/repository.js +16 -0
  56. package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +6 -3
  57. package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
  58. package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
  59. package/lib/chevre/service/event/saveScreeningEvents.d.ts +1 -1
  60. package/lib/chevre/service/event/saveScreeningEvents.js +6 -5
  61. package/lib/chevre/service/offer/event/authorize/factory.js +4 -1
  62. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +7 -4
  63. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +9 -6
  64. package/lib/chevre/service/offer/event/searchOffersByIds.js +7 -4
  65. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +4 -13
  66. package/lib/chevre/service/offer/onEventChanged.js +7 -5
  67. package/lib/chevre/service/offer.d.ts +5 -0
  68. package/lib/chevre/service/offer.js +34 -9
  69. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  70. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  71. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  72. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +1 -1
  73. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +5 -3
  74. package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +1 -1
  75. package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
  76. package/lib/chevre/service/task/onResourceDeleted.js +60 -0
  77. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +3 -7
  78. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +19 -7
  79. package/lib/chevre/service/task/onResourceUpdated.js +206 -42
  80. package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -1
  81. package/lib/chevre/service/taskHandler.js +1 -0
  82. package/package.json +4 -3
  83. package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
  84. package/example/src/chevre/offers/createSampleOffers.ts +0 -154
  85. package/lib/chevre/service/eventOld.d.ts +0 -60
  86. package/lib/chevre/service/eventOld.js +0 -864
@@ -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);
@@ -0,0 +1,41 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+ import { chevre } from '../../../../lib/index';
4
+
5
+ const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
6
+
7
+ async function main() {
8
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
9
+
10
+ const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
11
+
12
+ const result = await movieTheaterRepo.upsertMovieTheatersByBranchCode(
13
+ [
14
+ {
15
+ $set: {
16
+ branchCode: 'SAMPLE',
17
+ name: { ja: 'sampleNameJa', en: 'from samples' },
18
+ additionalProperty: [],
19
+ kanaName: '',
20
+ telephone: '',
21
+ offers: {
22
+ typeOf: chevre.factory.offerType.Offer,
23
+ eligibleQuantity: { maxValue: 6, unitCode: chevre.factory.unitCode.C62, typeOf: 'QuantitativeValue' },
24
+ availabilityEndsGraceTime: { value: 6, unitCode: chevre.factory.unitCode.Sec, typeOf: 'QuantitativeValue' },
25
+ availabilityStartsGraceTime: { value: 6, unitCode: chevre.factory.unitCode.Day, typeOf: 'QuantitativeValue' }
26
+ }
27
+
28
+ }
29
+ }
30
+ ],
31
+ {
32
+ project: { id: project.id },
33
+ sellerId: '59d20831e53ebc2b4e774466'
34
+ }
35
+ );
36
+ console.log(result);
37
+ }
38
+
39
+ main()
40
+ .then(console.log)
41
+ .catch(console.error);
@@ -0,0 +1,40 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+ import { chevre } from '../../../../lib/index';
4
+
5
+ const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
6
+
7
+ async function main() {
8
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
9
+
10
+ const roomRepo = await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection);
11
+
12
+ const result = await roomRepo.upsertRoomsByBranchCode(
13
+ [
14
+ {
15
+ $set: {
16
+ branchCode: 'SAMPLE',
17
+ name: { ja: 'sampleNameJa', en: 'from samples' },
18
+ additionalProperty: []
19
+ }
20
+ },
21
+ {
22
+ $set: {
23
+ branchCode: 'SAMPLE2',
24
+ name: { ja: 'from samples2', en: 'from samples' },
25
+ additionalProperty: []
26
+ }
27
+ }
28
+ ],
29
+ {
30
+ project: { id: project.id },
31
+ movieTheaterId: '5bfb841d5a78d7948369979a',
32
+ parentOrganization: { id: '59d20831e53ebc2b4e774466' }
33
+ }
34
+ );
35
+ console.log(result);
36
+ }
37
+
38
+ main()
39
+ .then(console.log)
40
+ .catch(console.error);
@@ -0,0 +1,56 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+ import { chevre } from '../../../../lib/index';
4
+
5
+ const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
6
+ const movieTheaterId = '5bfb841d5a78d7948369979a';
7
+ const sellerId = '59d20831e53ebc2b4e774466';
8
+ const roomCode = '10';
9
+
10
+ async function main() {
11
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
12
+
13
+ const sectionRepo = await chevre.repository.place.Section.createInstance(mongoose.connection);
14
+
15
+ let result = await sectionRepo.addSeatSectionsByBranchCodeIfNotExist(
16
+ [
17
+ {
18
+ $set: {
19
+ branchCode: 'SAMPLE',
20
+ name: { ja: 'sampleNameJa', en: 'from samples' },
21
+ additionalProperty: []
22
+ }
23
+ }
24
+ ],
25
+ {
26
+ project: { id: project.id },
27
+ movieTheaterId,
28
+ parentOrganization: { id: sellerId },
29
+ roomCode
30
+ }
31
+ );
32
+ console.log(result);
33
+
34
+ result = await sectionRepo.updateSeatSectionsByBranchCode(
35
+ [
36
+ {
37
+ $set: {
38
+ branchCode: 'SAMPLE',
39
+ name: { ja: 'sampleNameJaxxx', en: 'from samples' },
40
+ additionalProperty: []
41
+ }
42
+ }
43
+ ],
44
+ {
45
+ project: { id: project.id },
46
+ movieTheaterId,
47
+ parentOrganization: { id: sellerId },
48
+ roomCode
49
+ }
50
+ );
51
+ console.log(result);
52
+ }
53
+
54
+ main()
55
+ .then(console.log)
56
+ .catch(console.error);
@@ -11,7 +11,7 @@ mongoose.Model.on('index', (...args) => {
11
11
  async function main() {
12
12
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
13
 
14
- await chevre.repository.EventOffer.createInstance(mongoose.connection);
14
+ await chevre.repository.EventSeries.createInstance(mongoose.connection);
15
15
  console.log('success!');
16
16
  }
17
17
 
@@ -0,0 +1,49 @@
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
+
9
+ const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
10
+
11
+ const roleNames = [
12
+ // chevre.factory.role.organizationRole.RoleName.InventoryManager,
13
+ // chevre.factory.role.organizationRole.RoleName.SellersOwner,
14
+ // chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
15
+ chevre.factory.role.organizationRole.RoleName.TicketClerk
16
+ ];
17
+ const permissions = [
18
+ 'admin.sellers.eventSeries.read'
19
+ ];
20
+ for (const roleName of roleNames) {
21
+ for (const permission of permissions) {
22
+ const result = await roleRepo.addPermissionIfNotExists({
23
+ roleName: { $eq: roleName },
24
+ permission
25
+ });
26
+ console.log('permission added.', result, roleName);
27
+ }
28
+ }
29
+
30
+ // roleNames = [
31
+ // chevre.factory.role.organizationRole.RoleName.TicketClerk
32
+ // ];
33
+ // permissions = [
34
+ // 'admin.sellers.productOffers.read'
35
+ // ];
36
+ // for (const roleName of roleNames) {
37
+ // for (const permission of permissions) {
38
+ // const result = await roleRepo.addPermissionIfNotExists({
39
+ // roleName: { $eq: roleName },
40
+ // permission
41
+ // });
42
+ // console.log('permission added.', result, roleName);
43
+ // }
44
+ // }
45
+ }
46
+
47
+ main()
48
+ .then()
49
+ .catch(console.error);
@@ -0,0 +1,49 @@
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
+
9
+ const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
10
+
11
+ const roleNames = [
12
+ // chevre.factory.role.organizationRole.RoleName.InventoryManager,
13
+ chevre.factory.role.organizationRole.RoleName.SellersOwner,
14
+ chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
15
+ chevre.factory.role.organizationRole.RoleName.TicketClerk
16
+ ];
17
+ const permissions = [
18
+ 'admin.creativeWorks.read'
19
+ ];
20
+ for (const roleName of roleNames) {
21
+ for (const permission of permissions) {
22
+ const result = await roleRepo.addPermissionIfNotExists({
23
+ roleName: { $eq: roleName },
24
+ permission
25
+ });
26
+ console.log('permission added.', result, roleName);
27
+ }
28
+ }
29
+
30
+ // roleNames = [
31
+ // chevre.factory.role.organizationRole.RoleName.TicketClerk
32
+ // ];
33
+ // permissions = [
34
+ // 'admin.sellers.productOffers.read'
35
+ // ];
36
+ // for (const roleName of roleNames) {
37
+ // for (const permission of permissions) {
38
+ // const result = await roleRepo.addPermissionIfNotExists({
39
+ // roleName: { $eq: roleName },
40
+ // permission
41
+ // });
42
+ // console.log('permission added.', result, roleName);
43
+ // }
44
+ // }
45
+ }
46
+
47
+ main()
48
+ .then()
49
+ .catch(console.error);
@@ -0,0 +1,34 @@
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
+
9
+ const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
10
+
11
+ const roleNames = [
12
+ // chevre.factory.role.organizationRole.RoleName.InventoryManager,
13
+ // chevre.factory.role.organizationRole.RoleName.SellersOwner,
14
+ // chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
15
+ chevre.factory.role.organizationRole.RoleName.TicketClerk
16
+ ];
17
+ const permissions = [
18
+ 'admin.sellers.entranceGates.read',
19
+ 'admin.sellers.movieTheaters.read'
20
+ ];
21
+ for (const roleName of roleNames) {
22
+ for (const permission of permissions) {
23
+ const result = await roleRepo.addPermissionIfNotExists({
24
+ roleName: { $eq: roleName },
25
+ permission
26
+ });
27
+ console.log('permission added.', result, roleName);
28
+ }
29
+ }
30
+ }
31
+
32
+ main()
33
+ .then()
34
+ .catch(console.error);
@@ -0,0 +1,34 @@
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
+
9
+ const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
10
+
11
+ const roleNames = [
12
+ chevre.factory.role.organizationRole.RoleName.InventoryManager,
13
+ chevre.factory.role.organizationRole.RoleName.SellersOwner,
14
+ chevre.factory.role.organizationRole.RoleName.SellersInventoryManager
15
+ // chevre.factory.role.organizationRole.RoleName.TicketClerk
16
+ ];
17
+ const permissions = [
18
+ 'admin.sellers.entranceGates.*',
19
+ 'admin.sellers.movieTheaters.*'
20
+ ];
21
+ for (const roleName of roleNames) {
22
+ for (const permission of permissions) {
23
+ const result = await roleRepo.addPermissionIfNotExists({
24
+ roleName: { $eq: roleName },
25
+ permission
26
+ });
27
+ console.log('permission added.', result, roleName);
28
+ }
29
+ }
30
+ }
31
+
32
+ main()
33
+ .then()
34
+ .catch(console.error);
@@ -0,0 +1,34 @@
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
+
9
+ const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
10
+
11
+ const roleNames = [
12
+ // chevre.factory.role.organizationRole.RoleName.InventoryManager,
13
+ // chevre.factory.role.organizationRole.RoleName.SellersOwner,
14
+ // chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
15
+ chevre.factory.role.organizationRole.RoleName.TicketClerk
16
+ ];
17
+ const permissions = [
18
+ 'admin.sellers.rooms.read',
19
+ 'admin.sellers.seatSections.read'
20
+ ];
21
+ for (const roleName of roleNames) {
22
+ for (const permission of permissions) {
23
+ const result = await roleRepo.addPermissionIfNotExists({
24
+ roleName: { $eq: roleName },
25
+ permission
26
+ });
27
+ console.log('permission added.', result, roleName);
28
+ }
29
+ }
30
+ }
31
+
32
+ main()
33
+ .then()
34
+ .catch(console.error);
@@ -0,0 +1,34 @@
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
+
9
+ const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
10
+
11
+ const roleNames = [
12
+ chevre.factory.role.organizationRole.RoleName.InventoryManager,
13
+ chevre.factory.role.organizationRole.RoleName.SellersOwner,
14
+ chevre.factory.role.organizationRole.RoleName.SellersInventoryManager
15
+ // chevre.factory.role.organizationRole.RoleName.TicketClerk
16
+ ];
17
+ const permissions = [
18
+ 'admin.sellers.rooms.*',
19
+ 'admin.sellers.seatSections.*'
20
+ ];
21
+ for (const roleName of roleNames) {
22
+ for (const permission of permissions) {
23
+ const result = await roleRepo.addPermissionIfNotExists({
24
+ roleName: { $eq: roleName },
25
+ permission
26
+ });
27
+ console.log('permission added.', result, roleName);
28
+ }
29
+ }
30
+ }
31
+
32
+ main()
33
+ .then()
34
+ .catch(console.error);
@@ -9,16 +9,20 @@ import { chevre } from '../../../lib/index';
9
9
  async function main() {
10
10
  await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
11
 
12
- const noteRepo = await chevre.repository.NoteAboutOrder.createInstance(mongoose.connection);
12
+ const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
13
13
 
14
14
  let updateResult: any;
15
15
 
16
- updateResult = await noteRepo.unsetUnnecessaryFields({
16
+ updateResult = await movieTheaterRepo.unsetUnnecessaryFields({
17
17
  filter: {
18
- 'about.identifier': { $exists: true }
18
+ $or: [
19
+ { 'offers.availabilityStartsGraceTimeOnPOS': { $exists: true } },
20
+ { 'offers.availabilityEndsGraceTimeOnPOS': { $exists: true } }
21
+ ]
19
22
  },
20
23
  $unset: {
21
- 'about.identifier': 1
24
+ 'offers.availabilityStartsGraceTimeOnPOS': 1,
25
+ 'offers.availabilityEndsGraceTimeOnPOS': 1
22
26
  }
23
27
  });
24
28
  console.log(updateResult);
@@ -23,10 +23,7 @@ function minimizeSuperEvent(params) {
23
23
  // ? { kanaName: params.superEventFromDB.location.kanaName }
24
24
  // : undefined
25
25
  );
26
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.eventType.ScreeningEventSeries,
27
- // 不要なので廃止(2023-06-09~)
28
- // project: { typeOf: chevre.factory.organizationType.Project, id: params.project.id },
29
- id: params.superEventFromDB.id, videoFormat: params.superEventFromDB.videoFormat, soundFormat: params.superEventFromDB.soundFormat, workPerformed,
26
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.eventType.ScreeningEventSeries, id: params.superEventFromDB.id, soundFormat: params.superEventFromDB.soundFormat, workPerformed,
30
27
  location, kanaName: params.superEventFromDB.kanaName, name: Object.assign(Object.assign({}, (typeof params.superEventFromDB.name.en === 'string') ? { en: params.superEventFromDB.name.en } : undefined), (typeof params.superEventFromDB.name.ja === 'string') ? { ja: params.superEventFromDB.name.ja } : undefined) }, (Array.isArray(params.superEventFromDB.additionalProperty))
31
28
  ? { additionalProperty: params.superEventFromDB.additionalProperty }
32
29
  : undefined), (params.superEventFromDB.startDate instanceof Date)
@@ -41,5 +38,8 @@ function minimizeSuperEvent(params) {
41
38
  ? { dubLanguage: params.superEventFromDB.dubLanguage }
42
39
  : undefined), (params.superEventFromDB.subtitleLanguage !== undefined)
43
40
  ? { subtitleLanguage: params.superEventFromDB.subtitleLanguage }
44
- : undefined);
41
+ : undefined), {
42
+ // 現時点で型廃止済だがデータとしては互換性維持(2026-01-15~)
43
+ videoFormat: params.superEventFromDB.videoFormat
44
+ });
45
45
  }
@@ -20,99 +20,6 @@ class AggregateOrderRepo {
20
20
  constructor(connection) {
21
21
  this.aggregateOrderModel = connection.model(aggregateOrder_1.modelName, (0, aggregateOrder_1.createSchema)());
22
22
  }
23
- // public static CREATE_MONGO_CONDITIONS(
24
- // conditions: ISearchConditions
25
- // ): IMatchStage[] {
26
- // const matchStages: IMatchStage[] = [];
27
- // const projectIdEq = conditions.project?.id?.$eq;
28
- // if (typeof projectIdEq === 'string') {
29
- // matchStages.push({
30
- // $match: { 'project.id': { $eq: projectIdEq } }
31
- // });
32
- // }
33
- // const typeOfEq = conditions.reservationFor?.typeOf;
34
- // if (typeof typeOfEq === 'string') {
35
- // matchStages.push({
36
- // $match: { 'reservationFor.typeOf': { $eq: typeOfEq } }
37
- // });
38
- // }
39
- // const idEq = conditions.reservationFor?.id?.$eq;
40
- // if (typeof idEq === 'string') {
41
- // matchStages.push({
42
- // $match: { 'reservationFor.id': { $eq: idEq } }
43
- // });
44
- // }
45
- // const idIn = conditions.reservationFor?.id?.$in;
46
- // if (Array.isArray(idIn)) {
47
- // matchStages.push({
48
- // $match: { 'reservationFor.id': { $in: idIn } }
49
- // });
50
- // }
51
- // const reservationForStartDateGte = conditions.reservationFor?.startFrom;
52
- // if (reservationForStartDateGte instanceof Date) {
53
- // matchStages.push({
54
- // $match: { 'reservationFor.startDate': { $gte: reservationForStartDateGte } }
55
- // });
56
- // }
57
- // const reservationForStartDateLte = conditions.reservationFor?.startThrough;
58
- // if (reservationForStartDateLte instanceof Date) {
59
- // matchStages.push({
60
- // $match: { 'reservationFor.startDate': { $lte: reservationForStartDateLte } }
61
- // });
62
- // }
63
- // return matchStages;
64
- // }
65
- // /**
66
- // * 予約集計を検索する
67
- // */
68
- // public async searchWithReservationForId(
69
- // params: ISearchConditions,
70
- // inclusion: ('aggregateOffer')[]
71
- // ): Promise<ISearchWithReservationForIdResult[]> {
72
- // const matchStages = AggregateReservationRepo.CREATE_MONGO_CONDITIONS(params);
73
- // let projectStage: { [field in IKeyOfProjection]?: AnyExpression } = {
74
- // _id: 0,
75
- // id: '$reservationFor.id'
76
- // };
77
- // if (Array.isArray(inclusion) && inclusion.length > 0) {
78
- // inclusion.forEach((field) => {
79
- // projectStage[field] = { $ifNull: [`$${field}`, '$false'] };
80
- // // projectStage[field] = 1;
81
- // });
82
- // } else {
83
- // projectStage = {
84
- // _id: 0,
85
- // id: '$reservationFor.id',
86
- // // aggregateEntranceGate: 1, // discontinue(2024-12-23~)
87
- // aggregateOffer: 1
88
- // };
89
- // }
90
- // const sortByStartDate = params.sort?.['reservationFor.startDate'];
91
- // const aggregate = this.aggregateReservationModel.aggregate<ISearchWithReservationForIdResult>([
92
- // ...matchStages,
93
- // ...(typeof sortByStartDate === 'number')
94
- // ? [{ $sort: { 'reservationFor.startDate': sortByStartDate } }]
95
- // : [],
96
- // // 現時点でreservationFor.idへのunique indexがないので、重複ドキュメント対応として、$group
97
- // {
98
- // $group: {
99
- // _id: '$reservationFor.id',
100
- // reservationFor: { $first: '$reservationFor' },
101
- // aggregateEntranceGate: { $first: '$aggregateEntranceGate' },
102
- // aggregateOffer: { $first: '$aggregateOffer' }
103
- // }
104
- // },
105
- // { $project: projectStage }
106
- // ]);
107
- // if (typeof params.limit === 'number' && params.limit > 0) {
108
- // const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
109
- // aggregate.limit(params.limit * page)
110
- // .skip(params.limit * (page - 1));
111
- // }
112
- // return aggregate
113
- // .option({ maxTimeMS: MONGO_MAX_TIME_MS })
114
- // .exec();
115
- // }
116
23
  save(filter, update) {
117
24
  return __awaiter(this, void 0, void 0, function* () {
118
25
  const { $set } = update;
@@ -5,7 +5,6 @@ type IMatchStage = PipelineStage.Match;
5
5
  export interface IUpdateAggregateReservationParams {
6
6
  $set: {
7
7
  aggregateOffer?: factory.event.screeningEvent.IAggregateOffer;
8
- aggregateEntranceGate?: factory.event.screeningEvent.IAggregateEntranceGate;
9
8
  };
10
9
  }
11
10
  type ISearchWithReservationForIdResult = Pick<IAggregateReservation, 'aggregateOffer'> & {
@@ -82,7 +82,6 @@ class AggregateReservationRepo {
82
82
  projectStage = {
83
83
  _id: 0,
84
84
  id: '$reservationFor.id',
85
- // aggregateEntranceGate: 1, // discontinue(2024-12-23~)
86
85
  aggregateOffer: 1
87
86
  };
88
87
  }
@@ -97,7 +96,6 @@ class AggregateReservationRepo {
97
96
  $group: {
98
97
  _id: '$reservationFor.id',
99
98
  reservationFor: { $first: '$reservationFor' },
100
- aggregateEntranceGate: { $first: '$aggregateEntranceGate' },
101
99
  aggregateOffer: { $first: '$aggregateOffer' }
102
100
  }
103
101
  },