@chevre/domain 24.1.0-alpha.1 → 24.1.0-alpha.3

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.
@@ -49,28 +49,30 @@ class AccountingReportRepo {
49
49
  $match: { 'mainEntity.orderDate': { $lte: orderDateLte } }
50
50
  });
51
51
  }
52
- const reservationForStartDateGte = params.order?.acceptedOffers?.itemOffered?.reservationFor?.startDate?.$gte;
53
- if (reservationForStartDateGte instanceof Date) {
54
- matchStages.push({
55
- $match: {
56
- 'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate': {
57
- $exists: true,
58
- $gte: reservationForStartDateGte
59
- }
60
- }
61
- });
62
- }
63
- const reservationForStartDateLte = params.order?.acceptedOffers?.itemOffered?.reservationFor?.startDate?.$lte;
64
- if (reservationForStartDateLte instanceof Date) {
65
- matchStages.push({
66
- $match: {
67
- 'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate': {
68
- $exists: true,
69
- $lte: reservationForStartDateLte
70
- }
71
- }
72
- });
73
- }
52
+ // discontinue(2026-05-01~)
53
+ // const reservationForStartDateGte = params.order?.acceptedOffers?.itemOffered?.reservationFor?.startDate?.$gte;
54
+ // if (reservationForStartDateGte instanceof Date) {
55
+ // matchStages.push({
56
+ // $match: {
57
+ // 'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate': {
58
+ // $exists: true,
59
+ // $gte: reservationForStartDateGte
60
+ // }
61
+ // }
62
+ // });
63
+ // }
64
+ // discontinue(2026-05-01~)
65
+ // const reservationForStartDateLte = params.order?.acceptedOffers?.itemOffered?.reservationFor?.startDate?.$lte;
66
+ // if (reservationForStartDateLte instanceof Date) {
67
+ // matchStages.push({
68
+ // $match: {
69
+ // 'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate': {
70
+ // $exists: true,
71
+ // $lte: reservationForStartDateLte
72
+ // }
73
+ // }
74
+ // });
75
+ // }
74
76
  return matchStages;
75
77
  }
76
78
  async syncMainEntity(params) {
@@ -54,5 +54,11 @@ export declare class AggregateReservationRepo {
54
54
  filter: any;
55
55
  $unset: any;
56
56
  }): Promise<import("mongoose").UpdateWriteOpResult>;
57
+ /**
58
+ * イベント開始日時が指定以前の集計を削除する
59
+ */
60
+ deleteManyByEventStartDate(params: {
61
+ reservationForStartDateLte: Date;
62
+ }): Promise<import("mongodb").DeleteResult>;
57
63
  }
58
64
  export {};
@@ -132,5 +132,14 @@ class AggregateReservationRepo {
132
132
  return this.aggregateReservationModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
133
133
  .exec();
134
134
  }
135
+ /**
136
+ * イベント開始日時が指定以前の集計を削除する
137
+ */
138
+ async deleteManyByEventStartDate(params) {
139
+ return this.aggregateReservationModel.deleteMany({
140
+ 'reservationFor.startDate': { $lte: params.reservationForStartDateLte }
141
+ })
142
+ .exec();
143
+ }
135
144
  }
136
145
  exports.AggregateReservationRepo = AggregateReservationRepo;
@@ -117,15 +117,16 @@ const indexes = [
117
117
  }
118
118
  }
119
119
  ],
120
- [
121
- { 'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate': 1, 'mainEntity.orderDate': -1 },
122
- {
123
- name: 'searchByItemOfferedReservationForStartDate',
124
- partialFilterExpression: {
125
- 'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate': { $exists: true }
126
- }
127
- }
128
- ]
120
+ // discontinue(2026-05-01~)
121
+ // [
122
+ // { 'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate': 1, 'mainEntity.orderDate': -1 },
123
+ // {
124
+ // name: 'searchByItemOfferedReservationForStartDate',
125
+ // partialFilterExpression: {
126
+ // 'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate': { $exists: true }
127
+ // }
128
+ // }
129
+ // ]
129
130
  ];
130
131
  exports.indexes = indexes;
131
132
  /**
@@ -40,9 +40,6 @@ export declare class ProjectRepo {
40
40
  id: string;
41
41
  makesOffer: factory.project.IMakesOffer[];
42
42
  }): Promise<void>;
43
- activateOptionalAggregationSettings(params: {
44
- id: string;
45
- }): Promise<void>;
46
43
  updateAggregateReservation(params: {
47
44
  id: string;
48
45
  aggregateReservation?: any;
@@ -157,16 +157,6 @@ class ProjectRepo {
157
157
  }, { projection: { _id: 1 } })
158
158
  .exec();
159
159
  }
160
- async activateOptionalAggregationSettings(params) {
161
- await this.projectModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
162
- $set: {
163
- 'settings.useAggregateEntranceGate': true,
164
- 'settings.useAggregateOffer': true,
165
- 'settings.useOfferRateLimit': true
166
- }
167
- }, { projection: { _id: 1 } })
168
- .exec();
169
- }
170
160
  async updateAggregateReservation(params) {
171
161
  await this.projectModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
172
162
  $set: {
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": "8.0.0",
14
+ "@chevre/factory": "8.1.0-alpha.0",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "24.1.0-alpha.1"
94
+ "version": "24.1.0-alpha.3"
95
95
  }
@@ -1,33 +0,0 @@
1
- import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
- import { IVirtuals } from '../virtuals';
3
- import { factory } from '../../../factory';
4
- export interface IProductModel {
5
- id: string;
6
- project: {
7
- id: string;
8
- typeOf: factory.organizationType.Project;
9
- };
10
- typeOf: 'ProductModel';
11
- category: Pick<factory.categoryCode.ICategoryCode, 'codeValue' | 'inCodeSet'> & {
12
- /**
13
- * 区分ID
14
- * 削除時同期に必要
15
- */
16
- id: string;
17
- };
18
- name: factory.multilingualString;
19
- offers: {
20
- typeOf: factory.offerType.Offer;
21
- eligibleCustomerType?: {
22
- codeValue: string;
23
- }[];
24
- }[];
25
- }
26
- type IDocType = Omit<IProductModel, 'id'>;
27
- type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
28
- type ISchemaDefinition = SchemaDefinition<IDocType>;
29
- type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
30
- declare const modelName = "ProductModel";
31
- declare const indexes: [d: IndexDefinition, o: IndexOptions][];
32
- declare function createSchema(): ISchema;
33
- export { createSchema, IDocType, IModel, indexes, modelName };
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.modelName = exports.indexes = void 0;
4
- exports.createSchema = createSchema;
5
- const mongoose_1 = require("mongoose");
6
- const writeConcern_1 = require("../writeConcern");
7
- const settings_1 = require("../../../settings");
8
- const modelName = 'ProductModel';
9
- exports.modelName = modelName;
10
- const schemaDefinition = {
11
- project: mongoose_1.SchemaTypes.Mixed,
12
- typeOf: { type: String, required: true },
13
- category: mongoose_1.SchemaTypes.Mixed,
14
- name: mongoose_1.SchemaTypes.Mixed,
15
- offers: mongoose_1.SchemaTypes.Mixed
16
- };
17
- const schemaOptions = {
18
- autoIndex: settings_1.MONGO_AUTO_INDEX,
19
- autoCreate: false,
20
- collection: 'productModels',
21
- id: true,
22
- read: settings_1.MONGO_READ_PREFERENCE,
23
- writeConcern: writeConcern_1.writeConcern,
24
- strict: true,
25
- strictQuery: false,
26
- timestamps: false, // 2024-09-03~
27
- versionKey: false, // 2024-09-03~
28
- toJSON: {
29
- getters: false,
30
- virtuals: false,
31
- minimize: false,
32
- versionKey: false
33
- },
34
- toObject: {
35
- getters: false,
36
- virtuals: true,
37
- minimize: false,
38
- versionKey: false
39
- }
40
- };
41
- const indexes = [];
42
- exports.indexes = indexes;
43
- /**
44
- * プロダクトモデルスキーマ
45
- */
46
- let schema;
47
- function createSchema() {
48
- if (schema === undefined) {
49
- schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
50
- if (settings_1.MONGO_AUTO_INDEX) {
51
- indexes.forEach((indexParams) => {
52
- schema?.index(...indexParams);
53
- });
54
- }
55
- }
56
- return schema;
57
- }