@chevre/domain 28.0.0-alpha.13 → 28.0.0-alpha.14

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.
@@ -24,11 +24,6 @@ export declare class POSRepo {
24
24
  $eq?: string;
25
25
  $regex?: string;
26
26
  };
27
- }, options: {
28
- /**
29
- * 2026-09-18~
30
- */
31
- excludePOSId: boolean;
32
27
  }): Promise<Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'>[]>;
33
28
  private countPOS;
34
29
  addPOSByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'> & {
@@ -37,22 +32,16 @@ export declare class POSRepo {
37
32
  };
38
33
  }, options: {
39
34
  maxNumPOS: number;
40
- }): Promise<{
41
- id: string;
42
- }>;
43
- updateByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'> & {
35
+ }): Promise<void>;
36
+ updatePOSByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode' | 'name'> & {
44
37
  project: {
45
38
  id: string;
46
39
  };
47
- }): Promise<{
48
- id: string;
49
- }>;
50
- deleteByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode'> & {
40
+ }): Promise<void>;
41
+ deletePOSByBranchCode(params: Pick<factory.place.movieTheater.IPOS, 'branchCode'> & {
51
42
  project: {
52
43
  id: string;
53
44
  };
54
- }): Promise<{
55
- id: string;
56
- }>;
45
+ }): Promise<void>;
57
46
  }
58
47
  export {};
@@ -15,7 +15,7 @@ class POSRepo {
15
15
  this.civicStructureModel = connection.model(civicStructure_1.modelName, (0, civicStructure_1.createSchema)());
16
16
  this.operator = operater;
17
17
  }
18
- async findPOS(params, options) {
18
+ async findPOS(params) {
19
19
  const matchStages = [];
20
20
  const branchCodeEq = params.branchCode?.$eq;
21
21
  if (typeof branchCodeEq === 'string') {
@@ -25,7 +25,6 @@ class POSRepo {
25
25
  if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
26
26
  matchStages.push({ $match: { 'hasPOS.branchCode': { $regex: new RegExp(branchCodeRegex) } } });
27
27
  }
28
- const { excludePOSId } = options;
29
28
  const aggregate = this.civicStructureModel.aggregate([
30
29
  // まず施設ドキュメントで絞る
31
30
  {
@@ -46,7 +45,7 @@ class POSRepo {
46
45
  _id: 0,
47
46
  branchCode: '$hasPOS.branchCode',
48
47
  name: '$hasPOS.name',
49
- ...((!excludePOSId) && { id: '$hasPOS.branchCode' })
48
+ // ...((!excludePOSId) && { id: '$hasPOS.branchCode' }) // discontinue(2026-09-22~)
50
49
  }
51
50
  }
52
51
  ]);
@@ -85,12 +84,13 @@ class POSRepo {
85
84
  }
86
85
  async addPOSByBranchCode(params, options) {
87
86
  // 施設存在確認
88
- let doc = await this.civicStructureModel.findOne({
87
+ const movieTheaterDoc = await this.civicStructureModel.findOne({
89
88
  'project.id': { $eq: params.project.id },
90
89
  _id: { $eq: this.operator.id }
91
- }, { _id: 1, typeOf: 1 })
90
+ }, { _id: 1 })
91
+ .lean()
92
92
  .exec();
93
- if (doc === null) {
93
+ if (movieTheaterDoc === null) {
94
94
  throw new factory_1.factory.errors.NotFound(factory_1.factory.placeType.MovieTheater);
95
95
  }
96
96
  // 最大数検証(2026-09-20~)
@@ -100,12 +100,12 @@ class POSRepo {
100
100
  throw new factory_1.factory.errors.Argument('operator.id', 'maxNumPOS exceeded');
101
101
  }
102
102
  const creatingPOS = {
103
- // 互換性維持対応としてidを保管
104
- id: params.branchCode, // eslint-disable-line @typescript-eslint/no-explicit-any
103
+ // // 互換性維持対応としてidを保管
104
+ // id: params.branchCode as any, // discontinue(2026-09-22~)
105
105
  branchCode: params.branchCode,
106
106
  name: params.name
107
107
  };
108
- doc = await this.civicStructureModel.findOneAndUpdate({
108
+ const doc = await this.civicStructureModel.findOneAndUpdate({
109
109
  'project.id': { $eq: params.project.id },
110
110
  _id: { $eq: this.operator.id },
111
111
  'hasPOS.branchCode': { $ne: params.branchCode }
@@ -120,14 +120,14 @@ class POSRepo {
120
120
  new: true,
121
121
  projection: { _id: 1 }
122
122
  })
123
+ .lean()
123
124
  .exec();
124
125
  // 存在しなければID重複
125
126
  if (doc === null) {
126
127
  throw new factory_1.factory.errors.AlreadyInUse('hasPOS', ['id']);
127
128
  }
128
- return doc.toObject({ virtuals: true });
129
129
  }
130
- async updateByBranchCode(params) {
130
+ async updatePOSByBranchCode(params) {
131
131
  const doc = await this.civicStructureModel.findOneAndUpdate({
132
132
  'project.id': { $eq: params.project.id },
133
133
  _id: { $eq: this.operator.id },
@@ -145,13 +145,13 @@ class POSRepo {
145
145
  ],
146
146
  projection: { _id: 1 }
147
147
  })
148
+ .lean()
148
149
  .exec();
149
150
  if (doc === null) {
150
151
  throw new factory_1.factory.errors.NotFound('hasPOS');
151
152
  }
152
- return doc.toObject({ virtuals: true });
153
153
  }
154
- async deleteByBranchCode(params) {
154
+ async deletePOSByBranchCode(params) {
155
155
  const doc = await this.civicStructureModel.findOneAndUpdate({
156
156
  'project.id': { $eq: params.project.id },
157
157
  _id: { $eq: this.operator.id },
@@ -161,11 +161,11 @@ class POSRepo {
161
161
  }, {
162
162
  projection: { _id: 1 }
163
163
  })
164
+ .lean()
164
165
  .exec();
165
166
  if (doc === null) {
166
167
  throw new factory_1.factory.errors.NotFound('hasPOS');
167
168
  }
168
- return doc.toObject({ virtuals: true });
169
169
  }
170
170
  }
171
171
  exports.POSRepo = POSRepo;
@@ -28,7 +28,7 @@ function createInformHasPOSTasks(params) {
28
28
  repos.pos.operator.id = movieTheater.id;
29
29
  const hasPOS = await repos.pos.findPOS({
30
30
  projectId: params.project.id
31
- }, { excludePOSId: true }); // pos.idを除外(2026-09-18~)
31
+ }); // pos.idを除外(2026-09-18~)
32
32
  const movieTheaters4inform = [{
33
33
  hasPOS: (Array.isArray(hasPOS)) ? hasPOS : [],
34
34
  id: movieTheater.id,
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.13"
91
+ "version": "28.0.0-alpha.14"
92
92
  }