@chevre/domain 28.0.0-alpha.7 → 28.0.0-alpha.9

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,89 @@
1
+ import type { Connection, FilterQuery, mongo } from 'mongoose';
2
+ import { factory } from '../factory';
3
+ type IUnset = {
4
+ [key in keyof factory.eventSeries.IEvent]?: 1;
5
+ };
6
+ /**
7
+ * 施設コンテンツ管理リポジトリ
8
+ */
9
+ export declare class AdminEventSeriesRepo {
10
+ private readonly eventSeriesModel;
11
+ constructor(connection: Connection);
12
+ /**
13
+ * 施設+コンテンツ+バージョンをキーにして冪等置換
14
+ */
15
+ upsertByVersion(params: {
16
+ $set: factory.eventSeries.IAttributes;
17
+ $unset?: IUnset;
18
+ }[], options: {
19
+ /**
20
+ * falseの場合setOnInsertのみ
21
+ * trueの場合setOnInsert+setのみ
22
+ */
23
+ upsert: boolean;
24
+ }): Promise<{
25
+ bulkWriteResult?: mongo.BulkWriteResult;
26
+ modifiedEvents: {
27
+ id: string;
28
+ }[];
29
+ }>;
30
+ /**
31
+ * sskts施設コンテンツ保管
32
+ */
33
+ upsertManyEventSeriesById4sskts(params: {
34
+ id: string;
35
+ attributes: factory.eventSeries.IAttributes;
36
+ }[]): Promise<void>;
37
+ deleteEventSeriesById(params: {
38
+ project: {
39
+ id: string;
40
+ };
41
+ id: string;
42
+ }): Promise<void>;
43
+ /**
44
+ * 既存施設コンテンツの最大バージョンを集計する
45
+ */
46
+ aggregateMaxVersion(params: {
47
+ project: {
48
+ id: {
49
+ $eq: string;
50
+ };
51
+ };
52
+ workPerformed: {
53
+ identifier: {
54
+ $eq: string;
55
+ };
56
+ };
57
+ location: {
58
+ branchCode: {
59
+ $in: string[];
60
+ };
61
+ };
62
+ }): Promise<{
63
+ maxVersion: string;
64
+ }>;
65
+ getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, factory.eventSeries.IAttributes & {
66
+ _id: string;
67
+ }, import("./mongoose/virtuals").IVirtuals, {}> & factory.eventSeries.IAttributes & {
68
+ _id: string;
69
+ } & Required<{
70
+ _id: string;
71
+ }> & {
72
+ __v: number;
73
+ }, import("mongoose").QueryOptions<factory.eventSeries.IAttributes & {
74
+ _id: string;
75
+ }>, (import("mongoose").Document<unknown, Record<string, never>, factory.eventSeries.IAttributes & {
76
+ _id: string;
77
+ }, import("./mongoose/virtuals").IVirtuals, {}> & factory.eventSeries.IAttributes & {
78
+ _id: string;
79
+ } & Required<{
80
+ _id: string;
81
+ }> & {
82
+ __v: number;
83
+ }) | null>;
84
+ unsetUnnecessaryFields(params: {
85
+ filter: FilterQuery<factory.eventSeries.IEvent>;
86
+ $unset: IUnset;
87
+ }): Promise<import("mongoose").UpdateWriteOpResult>;
88
+ }
89
+ export {};
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminEventSeriesRepo = void 0;
4
+ const factory_1 = require("../factory");
5
+ const eventSeries_1 = require("./mongoose/schemas/eventSeries");
6
+ /**
7
+ * 施設コンテンツ管理リポジトリ
8
+ */
9
+ class AdminEventSeriesRepo {
10
+ eventSeriesModel;
11
+ constructor(connection) {
12
+ this.eventSeriesModel = connection.model(eventSeries_1.modelName, (0, eventSeries_1.createSchema)());
13
+ }
14
+ /**
15
+ * 施設+コンテンツ+バージョンをキーにして冪等置換
16
+ */
17
+ async upsertByVersion(params, options) {
18
+ const { upsert } = options;
19
+ const { default: uniqid } = await import('uniqid');
20
+ const bulkWriteOps = [];
21
+ const queryFilters = [];
22
+ if (Array.isArray(params)) {
23
+ params.forEach(({ $set, $unset }) => {
24
+ const version = $set.workPerformed.version;
25
+ if (typeof version !== 'string' || version.length === 0) {
26
+ throw new factory_1.factory.errors.ArgumentNull('workPerformed.version');
27
+ }
28
+ // リソースのユニークネスを保証するfilter
29
+ const filter = {
30
+ 'project.id': { $eq: $set.project.id },
31
+ 'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
32
+ 'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
33
+ 'workPerformed.version': { $exists: true, $eq: version }
34
+ };
35
+ queryFilters.push({
36
+ 'project.id': { $eq: $set.project.id },
37
+ 'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
38
+ 'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
39
+ 'workPerformed.version': { $exists: true, $eq: version }
40
+ });
41
+ const { identifier, project, typeOf, ...setFields } = $set; // eslint-disable-line @typescript-eslint/no-unused-vars
42
+ const setOnInsert = {
43
+ project,
44
+ typeOf,
45
+ _id: uniqid()
46
+ };
47
+ let updateOne;
48
+ if (upsert === true) {
49
+ updateOne = {
50
+ filter,
51
+ update: {
52
+ $setOnInsert: setOnInsert,
53
+ $set: setFields,
54
+ ...($unset !== undefined) ? { $unset } : undefined
55
+ },
56
+ upsert: true
57
+ };
58
+ }
59
+ else {
60
+ updateOne = {
61
+ filter,
62
+ update: {
63
+ $setOnInsert: {
64
+ ...setOnInsert,
65
+ ...setFields
66
+ }
67
+ },
68
+ upsert: true
69
+ };
70
+ }
71
+ bulkWriteOps.push({ updateOne });
72
+ });
73
+ }
74
+ if (bulkWriteOps.length > 0) {
75
+ const bulkWriteResult = await this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
76
+ // upsert:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-27~)
77
+ if (!upsert) {
78
+ // BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
79
+ return {
80
+ bulkWriteResult,
81
+ modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
82
+ .map((id) => ({ id: String(id) }))
83
+ };
84
+ }
85
+ else {
86
+ // modifiedの場合upsertedIdsに含まれないので、idを検索する
87
+ const modifiedEvents = await this.eventSeriesModel.find({ $or: queryFilters }, { _id: 1 })
88
+ .exec();
89
+ return { bulkWriteResult, modifiedEvents };
90
+ }
91
+ }
92
+ return { modifiedEvents: [] };
93
+ }
94
+ /**
95
+ * sskts施設コンテンツ保管
96
+ */
97
+ async upsertManyEventSeriesById4sskts(params) {
98
+ const bulkWriteOps = [];
99
+ if (Array.isArray(params)) {
100
+ params.forEach((p) => {
101
+ // 上書き禁止属性を除外(2022-08-24~)
102
+ const { identifier, project, typeOf, ...updateFields } = p.attributes; // eslint-disable-line @typescript-eslint/no-unused-vars
103
+ bulkWriteOps.push({
104
+ updateOne: {
105
+ filter: { _id: { $eq: p.id } },
106
+ update: {
107
+ $setOnInsert: {
108
+ typeOf: factory_1.factory.eventType.ScreeningEventSeries,
109
+ project: p.attributes.project,
110
+ ...(typeof p.attributes.identifier === 'string')
111
+ ? { identifier: p.attributes.identifier } : undefined
112
+ },
113
+ $set: updateFields
114
+ // $unsetに対応(2022-08-31~)
115
+ // ...(p.$unset !== undefined) ? { $unset: p.$unset } : undefined
116
+ },
117
+ upsert: true
118
+ }
119
+ });
120
+ });
121
+ }
122
+ if (bulkWriteOps.length > 0) {
123
+ await this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
124
+ }
125
+ }
126
+ async deleteEventSeriesById(params) {
127
+ await this.eventSeriesModel.findOneAndDelete({
128
+ _id: { $eq: params.id },
129
+ 'project.id': { $eq: params.project.id }
130
+ }, { projection: { _id: 1 } })
131
+ .exec();
132
+ }
133
+ /**
134
+ * 既存施設コンテンツの最大バージョンを集計する
135
+ */
136
+ async aggregateMaxVersion(params) {
137
+ const aggregations = await this.eventSeriesModel.aggregate([
138
+ {
139
+ $match: {
140
+ 'project.id': { $eq: params.project.id.$eq },
141
+ 'workPerformed.identifier': { $exists: true, $eq: params.workPerformed.identifier.$eq },
142
+ 'workPerformed.version': { $exists: true },
143
+ 'location.branchCode': { $exists: true, $in: params.location.branchCode.$in }
144
+ }
145
+ },
146
+ {
147
+ $project: {
148
+ // workPerformed: '$workPerformed',
149
+ version: { $toLong: '$workPerformed.version' } // support YYYYMMDDHHmmss
150
+ }
151
+ },
152
+ {
153
+ $group: {
154
+ _id: null,
155
+ maxVersion: { $max: '$version' }
156
+ }
157
+ }
158
+ ])
159
+ .exec();
160
+ const firstMaxVersion = aggregations.at(0)?.maxVersion;
161
+ const maxVersion = (typeof firstMaxVersion === 'number') ? String(firstMaxVersion) : '0';
162
+ return { maxVersion };
163
+ }
164
+ getCursor(conditions, projection) {
165
+ return this.eventSeriesModel.find(conditions, projection)
166
+ .sort({ startDate: factory_1.factory.sortType.Descending })
167
+ .cursor();
168
+ }
169
+ async unsetUnnecessaryFields(params) {
170
+ return this.eventSeriesModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
171
+ .exec();
172
+ }
173
+ }
174
+ exports.AdminEventSeriesRepo = AdminEventSeriesRepo;
@@ -1,10 +1,7 @@
1
- import type { Connection, FilterQuery, mongo } from 'mongoose';
1
+ import type { Connection, FilterQuery } from 'mongoose';
2
2
  import { factory } from '../factory';
3
3
  type ISearchConditions = factory.eventSeries.ISearchConditions;
4
4
  type IKeyOfProjection = Exclude<keyof factory.eventSeries.IEvent, 'id' | 'videoFormat'>;
5
- type IUnset = {
6
- [key in keyof factory.eventSeries.IEvent]?: 1;
7
- };
8
5
  /**
9
6
  * 施設コンテンツリポジトリ
10
7
  */
@@ -12,41 +9,10 @@ export declare class EventSeriesRepo {
12
9
  private readonly eventSeriesModel;
13
10
  constructor(connection: Connection);
14
11
  static CREATE_MONGO_CONDITIONS(conditions: ISearchConditions): FilterQuery<factory.eventSeries.IEvent>[];
15
- /**
16
- * 施設+コンテンツ+バージョンをキーにして冪等置換
17
- */
18
- upsertByVersion(params: {
19
- $set: factory.eventSeries.IAttributes;
20
- $unset?: IUnset;
21
- }[], options: {
22
- /**
23
- * falseの場合setOnInsertのみ
24
- * trueの場合setOnInsert+setのみ
25
- */
26
- upsert: boolean;
27
- }): Promise<{
28
- bulkWriteResult?: mongo.BulkWriteResult;
29
- modifiedEvents: {
30
- id: string;
31
- }[];
32
- }>;
33
- /**
34
- * sskts施設コンテンツ保管
35
- */
36
- upsertManyEventSeriesById4sskts(params: {
37
- id: string;
38
- attributes: factory.eventSeries.IAttributes;
39
- }[]): Promise<void>;
40
12
  /**
41
13
  * イベントを検索する(inclusion projection)
42
14
  */
43
15
  projectEventSeriesFields(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<factory.eventSeries.IEvent[]>;
44
- deleteEventSeriesById(params: {
45
- project: {
46
- id: string;
47
- };
48
- id: string;
49
- }): Promise<void>;
50
16
  deleteManyByOrganizerId(params: {
51
17
  project: {
52
18
  id: string;
@@ -54,7 +20,7 @@ export declare class EventSeriesRepo {
54
20
  organizer: {
55
21
  id: string;
56
22
  };
57
- }): Promise<mongo.DeleteResult>;
23
+ }): Promise<import("mongodb").DeleteResult>;
58
24
  deleteManyByLocationId(params: {
59
25
  project: {
60
26
  id: string;
@@ -62,51 +28,6 @@ export declare class EventSeriesRepo {
62
28
  location: {
63
29
  id: string;
64
30
  };
65
- }): Promise<mongo.DeleteResult>;
66
- /**
67
- * 既存施設コンテンツの最大バージョンを集計する
68
- */
69
- aggregateMaxVersion(params: {
70
- project: {
71
- id: {
72
- $eq: string;
73
- };
74
- };
75
- workPerformed: {
76
- identifier: {
77
- $eq: string;
78
- };
79
- };
80
- location: {
81
- branchCode: {
82
- $in: string[];
83
- };
84
- };
85
- }): Promise<{
86
- maxVersion: string;
87
- }>;
88
- getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, factory.eventSeries.IAttributes & {
89
- _id: string;
90
- }, import("./mongoose/virtuals").IVirtuals, {}> & factory.eventSeries.IAttributes & {
91
- _id: string;
92
- } & Required<{
93
- _id: string;
94
- }> & {
95
- __v: number;
96
- }, import("mongoose").QueryOptions<factory.eventSeries.IAttributes & {
97
- _id: string;
98
- }>, (import("mongoose").Document<unknown, Record<string, never>, factory.eventSeries.IAttributes & {
99
- _id: string;
100
- }, import("./mongoose/virtuals").IVirtuals, {}> & factory.eventSeries.IAttributes & {
101
- _id: string;
102
- } & Required<{
103
- _id: string;
104
- }> & {
105
- __v: number;
106
- }) | null>;
107
- unsetUnnecessaryFields(params: {
108
- filter: FilterQuery<factory.eventSeries.IEvent>;
109
- $unset: IUnset;
110
- }): Promise<import("mongoose").UpdateWriteOpResult>;
31
+ }): Promise<import("mongodb").DeleteResult>;
111
32
  }
112
33
  export {};
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EventSeriesRepo = void 0;
4
4
  const factory_1 = require("../factory");
5
5
  const eventSeries_1 = require("./mongoose/schemas/eventSeries");
6
- // import { isMongoError, MongoErrorCode } from '../errorHandler';
7
6
  const settings_1 = require("../settings");
8
7
  /**
9
8
  * 施設コンテンツリポジトリ
@@ -14,10 +13,7 @@ class EventSeriesRepo {
14
13
  this.eventSeriesModel = connection.model(eventSeries_1.modelName, (0, eventSeries_1.createSchema)());
15
14
  }
16
15
  static CREATE_MONGO_CONDITIONS(conditions) {
17
- const andConditions = [
18
- // typeOfは必ずScreeningEventSeriesなので不要(2026-02-14~)
19
- // { typeOf: { $eq: factory.eventType.ScreeningEventSeries } } // fix(2024-09-08~)
20
- ];
16
+ const andConditions = [];
21
17
  const projectIdEq = conditions.project?.id?.$eq;
22
18
  if (typeof projectIdEq === 'string') {
23
19
  andConditions.push({ 'project.id': { $eq: projectIdEq } });
@@ -34,12 +30,6 @@ class EventSeriesRepo {
34
30
  if (Array.isArray(idIn)) {
35
31
  andConditions.push({ _id: { $in: idIn } });
36
32
  }
37
- // /* istanbul ignore else */
38
- // if (Array.isArray(conditions.eventStatuses)) {
39
- // andConditions.push({
40
- // eventStatus: { $in: conditions.eventStatuses }
41
- // });
42
- // }
43
33
  /* istanbul ignore else */
44
34
  if (conditions.inSessionFrom !== undefined) {
45
35
  andConditions.push({
@@ -158,143 +148,8 @@ class EventSeriesRepo {
158
148
  if (Array.isArray(videoFormatTypeOfIn)) {
159
149
  andConditions.push({ 'subEvent.videoFormat': { $exists: true, $in: videoFormatTypeOfIn } });
160
150
  }
161
- // const soundFormatTypeOfEq = conditions.soundFormat?.typeOf?.$eq;
162
- // if (typeof soundFormatTypeOfEq === 'string') {
163
- // andConditions.push({
164
- // 'soundFormat.typeOf': {
165
- // $exists: true,
166
- // $eq: soundFormatTypeOfEq
167
- // }
168
- // });
169
- // }
170
- // const soundFormatTypeOfIn = conditions.soundFormat?.typeOf?.$in;
171
- // if (Array.isArray(soundFormatTypeOfIn)) {
172
- // andConditions.push({
173
- // 'soundFormat.typeOf': {
174
- // $exists: true,
175
- // $in: soundFormatTypeOfIn
176
- // }
177
- // });
178
- // }
179
151
  return andConditions;
180
152
  }
181
- /**
182
- * 施設+コンテンツ+バージョンをキーにして冪等置換
183
- */
184
- async upsertByVersion(params, options) {
185
- const { upsert } = options;
186
- const { default: uniqid } = await import('uniqid');
187
- const bulkWriteOps = [];
188
- const queryFilters = [];
189
- if (Array.isArray(params)) {
190
- params.forEach(({ $set, $unset }) => {
191
- const version = $set.workPerformed.version;
192
- if (typeof version !== 'string' || version.length === 0) {
193
- throw new factory_1.factory.errors.ArgumentNull('workPerformed.version');
194
- }
195
- // リソースのユニークネスを保証するfilter
196
- const filter = {
197
- typeOf: $set.typeOf,
198
- 'project.id': { $eq: $set.project.id },
199
- 'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
200
- 'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
201
- 'workPerformed.version': { $exists: true, $eq: version }
202
- };
203
- queryFilters.push({
204
- typeOf: $set.typeOf,
205
- 'project.id': { $eq: $set.project.id },
206
- 'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
207
- 'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
208
- 'workPerformed.version': { $exists: true, $eq: version }
209
- });
210
- const { identifier, project, typeOf, ...setFields } = $set; // eslint-disable-line @typescript-eslint/no-unused-vars
211
- const setOnInsert = {
212
- project,
213
- typeOf,
214
- _id: uniqid()
215
- };
216
- let updateOne;
217
- if (upsert === true) {
218
- updateOne = {
219
- filter,
220
- update: {
221
- $setOnInsert: setOnInsert,
222
- $set: setFields,
223
- ...($unset !== undefined) ? { $unset } : undefined
224
- },
225
- upsert: true
226
- };
227
- }
228
- else {
229
- updateOne = {
230
- filter,
231
- update: {
232
- $setOnInsert: {
233
- ...setOnInsert,
234
- ...setFields
235
- }
236
- },
237
- upsert: true
238
- };
239
- }
240
- bulkWriteOps.push({ updateOne });
241
- });
242
- }
243
- if (bulkWriteOps.length > 0) {
244
- const bulkWriteResult = await this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
245
- // upsert:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-27~)
246
- if (!upsert) {
247
- // BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
248
- return {
249
- bulkWriteResult,
250
- modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
251
- .map((id) => ({ id: String(id) }))
252
- };
253
- }
254
- else {
255
- // modifiedの場合upsertedIdsに含まれないので、idを検索する
256
- const modifiedEvents = await this.eventSeriesModel.find({ $or: queryFilters }, { _id: 1 })
257
- .exec();
258
- return { bulkWriteResult, modifiedEvents };
259
- }
260
- }
261
- return { modifiedEvents: [] };
262
- }
263
- /**
264
- * sskts施設コンテンツ保管
265
- */
266
- async upsertManyEventSeriesById4sskts(params) {
267
- const bulkWriteOps = [];
268
- if (Array.isArray(params)) {
269
- params.forEach((p) => {
270
- // 上書き禁止属性を除外(2022-08-24~)
271
- const { identifier, project, typeOf, ...updateFields } = p.attributes; // eslint-disable-line @typescript-eslint/no-unused-vars
272
- bulkWriteOps.push({
273
- updateOne: {
274
- filter: {
275
- _id: { $eq: p.id },
276
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
277
- },
278
- update: {
279
- $setOnInsert: {
280
- typeOf: factory_1.factory.eventType.ScreeningEventSeries,
281
- project: p.attributes.project,
282
- ...(typeof p.attributes.identifier === 'string')
283
- ? { identifier: p.attributes.identifier } : undefined
284
- },
285
- $set: updateFields
286
- // $unsetに対応(2022-08-31~)
287
- // ...(p.$unset !== undefined) ? { $unset: p.$unset } : undefined
288
- },
289
- upsert: true
290
- }
291
- });
292
- });
293
- }
294
- if (bulkWriteOps.length > 0) {
295
- await this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
296
- }
297
- }
298
153
  /**
299
154
  * イベントを検索する(inclusion projection)
300
155
  */
@@ -337,72 +192,19 @@ class EventSeriesRepo {
337
192
  .lean() // lean(2024-08-01~)
338
193
  .exec();
339
194
  }
340
- async deleteEventSeriesById(params) {
341
- await this.eventSeriesModel.findOneAndDelete({
342
- _id: { $eq: params.id },
343
- 'project.id': { $eq: params.project.id },
344
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
345
- }, { projection: { _id: 1 } })
346
- .exec();
347
- }
348
195
  async deleteManyByOrganizerId(params) {
349
196
  return this.eventSeriesModel.deleteMany({
350
197
  'project.id': { $eq: params.project.id },
351
- 'organizer.id': { $exists: true, $eq: params.organizer.id },
352
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
198
+ 'organizer.id': { $exists: true, $eq: params.organizer.id }
353
199
  })
354
200
  .exec();
355
201
  }
356
202
  async deleteManyByLocationId(params) {
357
203
  return this.eventSeriesModel.deleteMany({
358
204
  'project.id': { $eq: params.project.id },
359
- 'location.id': { $exists: true, $eq: params.location.id },
360
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries }
205
+ 'location.id': { $exists: true, $eq: params.location.id }
361
206
  })
362
207
  .exec();
363
208
  }
364
- /**
365
- * 既存施設コンテンツの最大バージョンを集計する
366
- */
367
- async aggregateMaxVersion(params) {
368
- const aggregations = await this.eventSeriesModel.aggregate([
369
- {
370
- $match: {
371
- typeOf: { $eq: factory_1.factory.eventType.ScreeningEventSeries },
372
- 'project.id': { $eq: params.project.id.$eq },
373
- 'workPerformed.identifier': { $exists: true, $eq: params.workPerformed.identifier.$eq },
374
- 'workPerformed.version': { $exists: true },
375
- 'location.branchCode': { $exists: true, $in: params.location.branchCode.$in }
376
- }
377
- },
378
- {
379
- $project: {
380
- workPerformed: '$workPerformed',
381
- // version: { $toInt: '$workPerformed.version' }
382
- version: { $toLong: '$workPerformed.version' } // support YYYYMMDDHHmmss
383
- }
384
- },
385
- {
386
- $group: {
387
- _id: '$typeOf',
388
- maxVersion: { $max: '$version' }
389
- }
390
- }
391
- ])
392
- .exec();
393
- const maxVersion = (aggregations.length > 0)
394
- ? String(aggregations.shift()?.maxVersion)
395
- : '0';
396
- return { maxVersion };
397
- }
398
- getCursor(conditions, projection) {
399
- return this.eventSeriesModel.find(conditions, projection)
400
- .sort({ startDate: factory_1.factory.sortType.Descending })
401
- .cursor();
402
- }
403
- async unsetUnnecessaryFields(params) {
404
- return this.eventSeriesModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
405
- .exec();
406
- }
407
209
  }
408
210
  exports.EventSeriesRepo = EventSeriesRepo;
@@ -100,6 +100,11 @@ export declare class ScreeningRoomRepo {
100
100
  };
101
101
  limit: number;
102
102
  page: number;
103
+ }, options: {
104
+ /**
105
+ * 将来的にcontainedInPlace最小化のためオプション採用(2026-09-17~)
106
+ */
107
+ minimizeContainedInPlace: boolean;
103
108
  }): Promise<Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'containedInPlace' | 'maximumAttendeeCapacity' | 'name' | 'openSeatingAllowed' | 'typeOf' | 'seatCount' | 'sectionCount'>[]>;
104
109
  findRooms(params: Omit<factory.place.screeningRoom.ISearchConditions, '$projection'>): Promise<Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed' | 'maximumAttendeeCapacity'>[]>;
105
110
  /**
@@ -384,7 +384,8 @@ class ScreeningRoomRepo {
384
384
  * sectionCount,seatCountのprojectが可能
385
385
  * sortはbranchCode: factory.sortType.Ascendingで固定
386
386
  */
387
- async projectRoomFields(params) {
387
+ async projectRoomFields(params, options) {
388
+ const { minimizeContainedInPlace } = options;
388
389
  const aggregate = this.placeModel.aggregate([
389
390
  ...ScreeningRoomRepo.CREATE_ROOM_MONGO_CONDITIONS(params),
390
391
  {
@@ -394,12 +395,16 @@ class ScreeningRoomRepo {
394
395
  branchCode: '$branchCode',
395
396
  name: '$name',
396
397
  address: '$address',
397
- containedInPlace: {
398
- id: '$containedInPlace.id',
399
- typeOf: '$containedInPlace.typeOf',
400
- branchCode: '$containedInPlace.branchCode',
401
- name: '$containedInPlace.name'
402
- },
398
+ containedInPlace: (minimizeContainedInPlace)
399
+ ? {
400
+ branchCode: '$containedInPlace.branchCode',
401
+ }
402
+ : {
403
+ id: '$containedInPlace.id',
404
+ typeOf: '$containedInPlace.typeOf',
405
+ branchCode: '$containedInPlace.branchCode',
406
+ name: '$containedInPlace.name'
407
+ },
403
408
  openSeatingAllowed: '$openSeatingAllowed',
404
409
  additionalProperty: '$additionalProperty',
405
410
  maximumAttendeeCapacity: '$maximumAttendeeCapacity',
@@ -28,6 +28,7 @@ import type { AdminAssetTransactionRepo } from './repo/adminAssetTransaction';
28
28
  import type { AdminCheckMovieTicketActionRepo } from './repo/adminCheckMovieTicketAction';
29
29
  import type { AdminAsyncActionRepo } from './repo/adminAsyncAction';
30
30
  import type { AdminEventRepo } from './repo/adminEvent';
31
+ import type { AdminEventSeriesRepo } from './repo/adminEventSeries';
31
32
  import type { AdminPendingReservationRepo } from './repo/adminPendingReservation';
32
33
  import type { AdminScheduledTaskRepo } from './repo/adminScheduledTask';
33
34
  import type { AdminTaskRepo } from './repo/adminTask';
@@ -226,6 +227,10 @@ export type AdminEvent = AdminEventRepo;
226
227
  export declare namespace AdminEvent {
227
228
  function createInstance(...params: ConstructorParameters<typeof AdminEventRepo>): Promise<AdminEventRepo>;
228
229
  }
230
+ export type AdminEventSeries = AdminEventSeriesRepo;
231
+ export declare namespace AdminEventSeries {
232
+ function createInstance(...params: ConstructorParameters<typeof AdminEventSeriesRepo>): Promise<AdminEventSeriesRepo>;
233
+ }
229
234
  export type AdminPendingReservation = AdminPendingReservationRepo;
230
235
  export declare namespace AdminPendingReservation {
231
236
  function createInstance(...params: ConstructorParameters<typeof AdminPendingReservationRepo>): Promise<AdminPendingReservationRepo>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateEvent = exports.AggregateAssetTransaction = exports.AggregateTransaction = exports.AggregateTask = exports.AggregateScheduledTask = exports.AggregateUseAction = exports.AggregateCheckMovieTicketAction = exports.AggregateAction = exports.AdminTransaction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminPendingReservation = exports.AdminEvent = exports.AdminAsyncAction = exports.AdminAssetTransaction = exports.AdminCheckMovieTicketAction = exports.AdminAction = exports.AdminAcceptedOffer = exports.AdminAccountingReport = exports.AdditionalProperty = exports.action = exports.AccountTitle = exports.AccountingReport = exports.AcceptedOffer = void 0;
4
- exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = void 0;
3
+ exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateEvent = exports.AggregateAssetTransaction = exports.AggregateTransaction = exports.AggregateTask = exports.AggregateScheduledTask = exports.AggregateUseAction = exports.AggregateCheckMovieTicketAction = exports.AggregateAction = exports.AdminTransaction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminPendingReservation = exports.AdminEventSeries = exports.AdminEvent = exports.AdminAsyncAction = exports.AdminAssetTransaction = exports.AdminCheckMovieTicketAction = exports.AdminAction = exports.AdminAcceptedOffer = exports.AdminAccountingReport = exports.AdditionalProperty = exports.action = exports.AccountTitle = exports.AccountingReport = exports.AcceptedOffer = void 0;
4
+ exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = void 0;
5
5
  var AcceptedOffer;
6
6
  (function (AcceptedOffer) {
7
7
  let repo;
@@ -291,6 +291,17 @@ var AdminEvent;
291
291
  }
292
292
  AdminEvent.createInstance = createInstance;
293
293
  })(AdminEvent || (exports.AdminEvent = AdminEvent = {}));
294
+ var AdminEventSeries;
295
+ (function (AdminEventSeries) {
296
+ let repo;
297
+ async function createInstance(...params) {
298
+ if (repo === undefined) {
299
+ repo = (await import('./repo/adminEventSeries.js')).AdminEventSeriesRepo;
300
+ }
301
+ return new repo(...params);
302
+ }
303
+ AdminEventSeries.createInstance = createInstance;
304
+ })(AdminEventSeries || (exports.AdminEventSeries = AdminEventSeries = {}));
294
305
  var AdminPendingReservation;
295
306
  (function (AdminPendingReservation) {
296
307
  let repo;
@@ -1,7 +1,7 @@
1
1
  import type { COA } from '@motionpicture/coa-service';
2
2
  import type { CategoryCodeRepo } from '../../repo/categoryCode';
3
3
  import type { CreativeWorkRepo } from '../../repo/creativeWork';
4
- import type { EventSeriesRepo } from '../../repo/eventSeries';
4
+ import type { AdminEventSeriesRepo } from '../../repo/adminEventSeries';
5
5
  import { factory } from '../../factory';
6
6
  type IMovieTheater = Pick<factory.place.movieTheater.IPlace, 'id' | 'typeOf' | 'branchCode' | 'name' | 'kanaName'>;
7
7
  /**
@@ -46,7 +46,7 @@ declare function saveScreeningEventSeries(params: {
46
46
  }): (repos: {
47
47
  categoryCode: CategoryCodeRepo;
48
48
  creativeWork: CreativeWorkRepo;
49
- eventSeries: EventSeriesRepo;
49
+ adminEventSeries: AdminEventSeriesRepo;
50
50
  masterService: COA.service.Master;
51
51
  }) => Promise<{
52
52
  screeningEventSerieses: factory.eventSeries.IEvent[];
@@ -121,7 +121,7 @@ function saveScreeningEventSeries(params, options) {
121
121
  });
122
122
  }
123
123
  debug('saving', saveParams.length, 'ScreeningEventSeries...');
124
- await repos.eventSeries.upsertManyEventSeriesById4sskts(saveParams);
124
+ await repos.adminEventSeries.upsertManyEventSeriesById4sskts(saveParams);
125
125
  debug('saved', saveParams.length, 'ScreeningEventSeries');
126
126
  savedEventsCount = saveParams.length;
127
127
  // コンテンツ永続化(2023-10-23~)
@@ -2,6 +2,7 @@ import type { COA } from '@motionpicture/coa-service';
2
2
  import type { CategoryCodeRepo } from '../../repo/categoryCode';
3
3
  import type { CreativeWorkRepo } from '../../repo/creativeWork';
4
4
  import type { AdminEventRepo } from '../../repo/adminEvent';
5
+ import type { AdminEventSeriesRepo } from '../../repo/adminEventSeries';
5
6
  import type { EventSeriesRepo } from '../../repo/eventSeries';
6
7
  import { factory } from '../../factory';
7
8
  type IMovieTheater = Pick<factory.place.movieTheater.IPlace, 'id' | 'typeOf' | 'branchCode' | 'name' | 'kanaName'>;
@@ -29,6 +30,7 @@ declare function saveScreeningEvents(params: {
29
30
  categoryCode: CategoryCodeRepo;
30
31
  creativeWork: CreativeWorkRepo;
31
32
  adminEvent: AdminEventRepo;
33
+ adminEventSeries: AdminEventSeriesRepo;
32
34
  eventSeries: EventSeriesRepo;
33
35
  masterService: COA.service.Master;
34
36
  }) => Promise<factory.event.screeningEvent.IEvent[]>;
@@ -6,6 +6,7 @@ import type { UpdateActionRepo } from '../repo/action/update';
6
6
  import type { CategoryCodeRepo } from '../repo/categoryCode';
7
7
  import type { CreativeWorkRepo } from '../repo/creativeWork';
8
8
  import type { AdminEventRepo } from '../repo/adminEvent';
9
+ import type { AdminEventSeriesRepo } from '../repo/adminEventSeries';
9
10
  import type { EventRepo } from '../repo/event';
10
11
  import type { EventSeriesRepo } from '../repo/eventSeries';
11
12
  import type { MovieTheaterRepo } from '../repo/place/movieTheater';
@@ -24,6 +25,7 @@ declare function importFromCOA(params: IImportFromCOAParams): (repos: {
24
25
  categoryCode: CategoryCodeRepo;
25
26
  creativeWork: CreativeWorkRepo;
26
27
  adminEvent: AdminEventRepo;
28
+ adminEventSeries: AdminEventSeriesRepo;
27
29
  event: EventRepo;
28
30
  eventSeries: EventSeriesRepo;
29
31
  movieTheater: MovieTheaterRepo;
@@ -39,6 +39,7 @@ const update_1 = require("../../repo/action/update");
39
39
  const categoryCode_1 = require("../../repo/categoryCode");
40
40
  const creativeWork_1 = require("../../repo/creativeWork");
41
41
  const adminEvent_1 = require("../../repo/adminEvent");
42
+ const adminEventSeries_1 = require("../../repo/adminEventSeries");
42
43
  const event_1 = require("../../repo/event");
43
44
  const eventSeries_1 = require("../../repo/eventSeries");
44
45
  const movieTheater_1 = require("../../repo/place/movieTheater");
@@ -78,6 +79,7 @@ function call(params) {
78
79
  categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
79
80
  creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
80
81
  adminEvent: new adminEvent_1.AdminEventRepo(connection),
82
+ adminEventSeries: new adminEventSeries_1.AdminEventSeriesRepo(connection),
81
83
  event: new event_1.EventRepo(connection),
82
84
  eventSeries: new eventSeries_1.EventSeriesRepo(connection),
83
85
  movieTheater: new movieTheater_1.MovieTheaterRepo(connection),
@@ -12,6 +12,7 @@ const categoryCode_1 = require("../../repo/categoryCode");
12
12
  const creativeWork_1 = require("../../repo/creativeWork");
13
13
  const credentials_1 = require("../../repo/credentials");
14
14
  const adminEvent_1 = require("../../repo/adminEvent");
15
+ const adminEventSeries_1 = require("../../repo/adminEventSeries");
15
16
  const eventSeries_1 = require("../../repo/eventSeries");
16
17
  const movieTheater_1 = require("../../repo/place/movieTheater");
17
18
  const screeningRoom_1 = require("../../repo/place/screeningRoom");
@@ -71,7 +72,7 @@ function call(params) {
71
72
  },
72
73
  categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
73
74
  creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
74
- eventSeries: new eventSeries_1.EventSeriesRepo(connection),
75
+ adminEventSeries: new adminEventSeries_1.AdminEventSeriesRepo(connection),
75
76
  movieTheater: new movieTheater_1.MovieTheaterRepo(connection),
76
77
  masterService
77
78
  });
@@ -88,6 +89,7 @@ function call(params) {
88
89
  categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
89
90
  creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
90
91
  adminEvent: new adminEvent_1.AdminEventRepo(connection),
92
+ adminEventSeries: new adminEventSeries_1.AdminEventSeriesRepo(connection),
91
93
  eventSeries: new eventSeries_1.EventSeriesRepo(connection),
92
94
  movieTheater: new movieTheater_1.MovieTheaterRepo(connection),
93
95
  screeningRoom: new screeningRoom_1.ScreeningRoomRepo(connection),
package/package.json CHANGED
@@ -88,5 +88,5 @@
88
88
  "postversion": "git push origin --tags",
89
89
  "prepublishOnly": "npm run clean && npm run build"
90
90
  },
91
- "version": "28.0.0-alpha.7"
91
+ "version": "28.0.0-alpha.9"
92
92
  }