@chevre/domain 26.0.0 → 26.1.0-alpha.1

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 (53) hide show
  1. package/lib/chevre/repo/action/acceptCOAOffer.d.ts +8 -0
  2. package/lib/chevre/repo/action/acceptCOAOffer.js +17 -0
  3. package/lib/chevre/repo/action/acceptPay.d.ts +8 -0
  4. package/lib/chevre/repo/action/acceptPay.js +19 -2
  5. package/lib/chevre/repo/action/anyAction/actionProcess.d.ts +12 -21
  6. package/lib/chevre/repo/action/anyAction/actionProcess.js +4 -360
  7. package/lib/chevre/repo/action/anyAction/actionRecipe.d.ts +1 -1
  8. package/lib/chevre/repo/action/authorizeInvoice.js +1 -1
  9. package/lib/chevre/repo/action/authorizeOffer.js +1 -5
  10. package/lib/chevre/repo/action/authorizePaymentMethod.d.ts +8 -0
  11. package/lib/chevre/repo/action/authorizePaymentMethod.js +18 -1
  12. package/lib/chevre/repo/action/checkMovieTicket.d.ts +46 -53
  13. package/lib/chevre/repo/action/checkMovieTicket.js +85 -63
  14. package/lib/chevre/repo/action/dedicatedAction/dedicatedActionProcess.d.ts +46 -0
  15. package/lib/chevre/repo/action/dedicatedAction/dedicatedActionProcess.js +92 -0
  16. package/lib/chevre/repo/action/inform.d.ts +2 -1
  17. package/lib/chevre/repo/action/inform.js +14 -45
  18. package/lib/chevre/repo/action/pay.js +1 -1
  19. package/lib/chevre/repo/action/update.d.ts +8 -6
  20. package/lib/chevre/repo/action/update.js +14 -51
  21. package/lib/chevre/repo/action/use.d.ts +2 -1
  22. package/lib/chevre/repo/action/use.js +14 -45
  23. package/lib/chevre/repo/adminAction.d.ts +1 -1
  24. package/lib/chevre/repo/adminAction.js +27 -1
  25. package/lib/chevre/repo/factory/action/createMongoConditions.d.ts +4 -0
  26. package/lib/chevre/repo/factory/action/createMongoConditions.js +335 -0
  27. package/lib/chevre/repo/mongoose/schemas/action/abstractAction.d.ts +5 -0
  28. package/lib/chevre/repo/mongoose/schemas/action/abstractAction.js +2 -0
  29. package/lib/chevre/repo/mongoose/schemas/action/checkMovieTicket.d.ts +11 -0
  30. package/lib/chevre/repo/mongoose/schemas/action/checkMovieTicket.js +108 -0
  31. package/lib/chevre/service/assetTransaction/pay/check.d.ts +3 -1
  32. package/lib/chevre/service/assetTransaction/pay/start/processAuthorize.d.ts +1 -1
  33. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +1 -1
  34. package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
  35. package/lib/chevre/service/offer/eventServiceByCOA/findAcceptAction.js +4 -5
  36. package/lib/chevre/service/payment/any/authorize.d.ts +1 -1
  37. package/lib/chevre/service/payment/any/findAcceptAction.js +4 -5
  38. package/lib/chevre/service/payment/any/findAuthorizeAction.js +4 -5
  39. package/lib/chevre/service/payment/any/findCheckAction.d.ts +3 -1
  40. package/lib/chevre/service/payment/any/findCheckAction.js +5 -6
  41. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +1 -1
  42. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +3 -1
  43. package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +3 -3
  44. package/lib/chevre/service/payment/movieTicket/validation.d.ts +3 -1
  45. package/lib/chevre/service/payment/movieTicket/validation.js +13 -43
  46. package/lib/chevre/service/task/acceptCOAOffer.js +4 -5
  47. package/lib/chevre/service/task/authorizePayment.js +5 -6
  48. package/lib/chevre/service/task/checkMovieTicket.js +7 -6
  49. package/lib/chevre/service/task/pay.js +3 -2
  50. package/lib/chevre/service/task/payment/payByTask.d.ts +3 -1
  51. package/lib/chevre/service/task/payment/payByTask.js +1 -1
  52. package/lib/chevre/service/task/publishPaymentUrl.js +4 -5
  53. package/package.json +1 -1
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UpdateActionRepo = void 0;
4
- const factory_1 = require("../../factory");
5
4
  const settings_1 = require("../../settings");
6
5
  const update_1 = require("../mongoose/schemas/action/update");
7
- const unknown2actionError_1 = require("./unknown2actionError");
6
+ const dedicatedActionProcess_1 = require("./dedicatedAction/dedicatedActionProcess");
8
7
  const AVAILABLE_PROJECT_FIELDS = [
9
8
  'project',
10
9
  'actionStatus',
@@ -24,10 +23,18 @@ const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
24
23
  /**
25
24
  * リソース編集アクションリポジトリ
26
25
  */
27
- class UpdateActionRepo {
26
+ class UpdateActionRepo extends dedicatedActionProcess_1.DedicatedActionProcessRepo {
28
27
  updateActionModel;
29
28
  constructor(connection) {
30
- this.updateActionModel = connection.model(update_1.modelName, (0, update_1.createSchema)());
29
+ const updateActionModel = connection.model(update_1.modelName, (0, update_1.createSchema)());
30
+ super({
31
+ connection,
32
+ actionModel: updateActionModel
33
+ }, {
34
+ expireAfterSeconds: EXPIRE_AFTER_SECONDS,
35
+ recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
36
+ });
37
+ this.updateActionModel = updateActionModel;
31
38
  }
32
39
  static CREATE_MONGO_CONDITIONS(params) {
33
40
  const andConditions = [];
@@ -64,60 +71,16 @@ class UpdateActionRepo {
64
71
  * アクション開始
65
72
  */
66
73
  async startUpdateAction(attributes) {
67
- const startDate = new Date();
68
- const expires = new Date(startDate.getTime() + EXPIRE_AFTER_SECONDS * 1000);
69
- const creatingAction = {
70
- ...attributes,
71
- actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
72
- startDate,
73
- expires
74
- };
75
- const result = await this.updateActionModel.insertMany(creatingAction, { rawResult: true });
76
- const id = result.insertedIds?.[0]?.toHexString();
77
- if (typeof id !== 'string') {
78
- throw new factory_1.factory.errors.Internal('action not saved');
79
- }
80
- return { id, startDate, typeOf: creatingAction.typeOf };
74
+ return this.startAction(attributes); // eslint-disable-line @typescript-eslint/no-explicit-any
81
75
  }
82
76
  async completeUpdateAction(params) {
83
- const doc = await this.updateActionModel.findOneAndUpdate({
84
- _id: { $eq: params.id },
85
- typeOf: { $eq: params.typeOf }
86
- }, {
87
- $set: {
88
- actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
89
- result: params.result,
90
- endDate: new Date()
91
- }
92
- }, { new: false, projection: { _id: 1 } })
93
- .lean()
94
- .exec();
95
- if (doc === null) {
96
- throw new factory_1.factory.errors.NotFound(this.updateActionModel.modelName);
97
- }
77
+ await this.completeAction(params);
98
78
  }
99
79
  /**
100
80
  * アクション失敗
101
81
  */
102
82
  async giveUpUpdateAction(params) {
103
- const actionError = Array.isArray(params.error)
104
- ? params.error.map(unknown2actionError_1.unknown2actionError)
105
- : (0, unknown2actionError_1.unknown2actionError)(params.error);
106
- const doc = await this.updateActionModel.findOneAndUpdate({
107
- typeOf: { $eq: params.typeOf },
108
- _id: { $eq: params.id }
109
- }, {
110
- $set: {
111
- actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
112
- error: actionError,
113
- endDate: new Date()
114
- }
115
- }, { new: true, projection: { _id: 1 } })
116
- .lean()
117
- .exec();
118
- if (doc === null) {
119
- throw new factory_1.factory.errors.NotFound(this.updateActionModel.modelName);
120
- }
83
+ await this.giveUpAction(params);
121
84
  }
122
85
  async findUpdateActions(params, inclusion) {
123
86
  const conditions = UpdateActionRepo.CREATE_MONGO_CONDITIONS(params);
@@ -1,6 +1,7 @@
1
1
  import { Connection, FilterQuery } from 'mongoose';
2
2
  import { factory } from '../../factory';
3
3
  import { IDocType } from '../mongoose/schemas/action/use';
4
+ import { DedicatedActionProcessRepo } from './dedicatedAction/dedicatedActionProcess';
4
5
  type StartableActionType = factory.actionType.UseAction;
5
6
  type IAction = IDocType & {
6
7
  id: string;
@@ -10,7 +11,7 @@ type IFindParams = factory.action.consume.use.reservation.IFindParams;
10
11
  /**
11
12
  * 予約使用アクションリポジトリ
12
13
  */
13
- export declare class UseActionRepo {
14
+ export declare class UseActionRepo extends DedicatedActionProcessRepo<StartableActionType, never> {
14
15
  private readonly useActionModel;
15
16
  constructor(connection: Connection);
16
17
  static CREATE_MONGO_CONDITIONS(params: Pick<IFindParams, 'actionStatus' | 'id' | 'object' | 'project' | 'startFrom' | 'startThrough'>): FilterQuery<IDocType>[];
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UseActionRepo = void 0;
4
- const factory_1 = require("../../factory");
5
4
  const settings_1 = require("../../settings");
6
5
  const use_1 = require("../mongoose/schemas/action/use");
7
- const unknown2actionError_1 = require("./unknown2actionError");
6
+ const dedicatedActionProcess_1 = require("./dedicatedAction/dedicatedActionProcess");
8
7
  const AVAILABLE_PROJECT_FIELDS = [
9
8
  'project',
10
9
  'actionStatus',
@@ -22,10 +21,18 @@ const EXPIRE_AFTER_SECONDS = 2592000; // 30 days
22
21
  /**
23
22
  * 予約使用アクションリポジトリ
24
23
  */
25
- class UseActionRepo {
24
+ class UseActionRepo extends dedicatedActionProcess_1.DedicatedActionProcessRepo {
26
25
  useActionModel;
27
26
  constructor(connection) {
28
- this.useActionModel = connection.model(use_1.modelName, (0, use_1.createSchema)());
27
+ const useActionModel = connection.model(use_1.modelName, (0, use_1.createSchema)());
28
+ super({
29
+ connection,
30
+ actionModel: useActionModel
31
+ }, {
32
+ expireAfterSeconds: EXPIRE_AFTER_SECONDS,
33
+ recipeExpireAfterSeconds: EXPIRE_AFTER_SECONDS
34
+ });
35
+ this.useActionModel = useActionModel;
29
36
  }
30
37
  static CREATE_MONGO_CONDITIONS(params) {
31
38
  const andConditions = [];
@@ -59,54 +66,16 @@ class UseActionRepo {
59
66
  * アクション開始
60
67
  */
61
68
  async startUseAction(attributes) {
62
- const startDate = new Date();
63
- const expires = new Date(startDate.getTime() + EXPIRE_AFTER_SECONDS * 1000);
64
- const creatingAction = {
65
- ...attributes,
66
- actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
67
- startDate,
68
- expires
69
- };
70
- const result = await this.useActionModel.insertMany(creatingAction, { rawResult: true });
71
- const id = result.insertedIds?.[0]?.toHexString();
72
- if (typeof id !== 'string') {
73
- throw new factory_1.factory.errors.Internal('action not saved');
74
- }
75
- return { id, startDate, typeOf: creatingAction.typeOf };
69
+ return this.startAction(attributes);
76
70
  }
77
71
  async completeUseAction(params) {
78
- const doc = await this.useActionModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
79
- $set: {
80
- actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
81
- // result: params.result,
82
- endDate: new Date()
83
- }
84
- }, { new: false, projection: { _id: 1 } })
85
- .lean()
86
- .exec();
87
- if (doc === null) {
88
- throw new factory_1.factory.errors.NotFound(this.useActionModel.modelName);
89
- }
72
+ await this.completeAction(params);
90
73
  }
91
74
  /**
92
75
  * アクション失敗
93
76
  */
94
77
  async giveUpUseAction(params) {
95
- const actionError = Array.isArray(params.error)
96
- ? params.error.map(unknown2actionError_1.unknown2actionError)
97
- : (0, unknown2actionError_1.unknown2actionError)(params.error);
98
- const doc = await this.useActionModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
99
- $set: {
100
- actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
101
- error: actionError,
102
- endDate: new Date()
103
- }
104
- }, { new: true, projection: { _id: 1 } })
105
- .lean()
106
- .exec();
107
- if (doc === null) {
108
- throw new factory_1.factory.errors.NotFound(this.useActionModel.modelName);
109
- }
78
+ await this.giveUpAction(params);
110
79
  }
111
80
  async findUseActions(params, inclusion) {
112
81
  const conditions = UseActionRepo.CREATE_MONGO_CONDITIONS(params);
@@ -17,7 +17,7 @@ export declare class AdminActionRepo extends ActionProcessRepo<IAction<Startable
17
17
  /**
18
18
  * 汎用アクション検索
19
19
  */
20
- adminFindAnyActions(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IAction<factory.actionType>[]>;
20
+ adminFindAnyActions(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IAction<StartableActionType>[]>;
21
21
  /**
22
22
  * 取引に対するアクションを検索する
23
23
  */
@@ -2,7 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AdminActionRepo = void 0;
4
4
  const factory_1 = require("../factory");
5
+ const settings_1 = require("../settings");
5
6
  const actionProcess_1 = require("./action/anyAction/actionProcess");
7
+ const createMongoConditions_1 = require("./factory/action/createMongoConditions");
6
8
  /**
7
9
  * アクション管理リポジトリ
8
10
  */
@@ -17,7 +19,31 @@ class AdminActionRepo extends actionProcess_1.ActionProcessRepo {
17
19
  * 汎用アクション検索
18
20
  */
19
21
  async adminFindAnyActions(params, inclusion) {
20
- return this.findAnyActions(params, inclusion);
22
+ const conditions = (0, createMongoConditions_1.createMongoConditions)(params);
23
+ let positiveProjectionFields = actionProcess_1.AVAILABLE_PROJECT_FIELDS;
24
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
25
+ positiveProjectionFields = inclusion.filter((key) => actionProcess_1.AVAILABLE_PROJECT_FIELDS.includes(key));
26
+ }
27
+ const projection = {
28
+ _id: 0,
29
+ id: { $toString: '$_id' },
30
+ ...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
31
+ };
32
+ const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
33
+ if (typeof params.limit === 'number' && params.limit > 0) {
34
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
35
+ query.limit(params.limit)
36
+ .skip(params.limit * (page - 1));
37
+ }
38
+ /* istanbul ignore else */
39
+ if (params.sort?.startDate !== undefined) {
40
+ query.sort({ startDate: params.sort.startDate });
41
+ }
42
+ // const explainResult = await (<any>query).explain();
43
+ // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
44
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
45
+ .lean()
46
+ .exec();
21
47
  }
22
48
  /**
23
49
  * 取引に対するアクションを検索する
@@ -0,0 +1,4 @@
1
+ import { FilterQuery } from 'mongoose';
2
+ import { factory } from '../../../factory';
3
+ import { IDocType } from '../../mongoose/schemas/action';
4
+ export declare function createMongoConditions(params: factory.action.ISearchConditions): FilterQuery<IDocType>[];
@@ -0,0 +1,335 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMongoConditions = createMongoConditions;
4
+ function createMongoConditions(params) {
5
+ const andConditions = [];
6
+ const idIn = params.id?.$in;
7
+ if (Array.isArray(idIn)) {
8
+ andConditions.push({ _id: { $in: idIn } });
9
+ }
10
+ const idNin = params.id?.$nin;
11
+ if (Array.isArray(idNin)) {
12
+ andConditions.push({ _id: { $nin: idNin } });
13
+ }
14
+ const projectIdEq = params.project?.id?.$eq;
15
+ if (typeof projectIdEq === 'string') {
16
+ andConditions.push({
17
+ 'project.id': {
18
+ $eq: projectIdEq
19
+ }
20
+ });
21
+ }
22
+ const agentTypeOfIn = params.agent?.typeOf?.$in;
23
+ if (Array.isArray(agentTypeOfIn)) {
24
+ andConditions.push({
25
+ 'agent.typeOf': {
26
+ $exists: true,
27
+ $in: agentTypeOfIn
28
+ }
29
+ });
30
+ }
31
+ const agentIdIn = params.agent?.id?.$in;
32
+ if (Array.isArray(agentIdIn)) {
33
+ andConditions.push({
34
+ 'agent.id': {
35
+ $exists: true,
36
+ $in: agentIdIn
37
+ }
38
+ });
39
+ }
40
+ const instrumentTransactionNumberEq = params.instrument?.transactionNumber?.$eq;
41
+ if (typeof instrumentTransactionNumberEq === 'string') {
42
+ andConditions.push({ 'instrument.transactionNumber': { $exists: true, $eq: instrumentTransactionNumberEq } });
43
+ }
44
+ const instrumentTypeOfEq = params.instrument?.typeOf?.$eq;
45
+ if (typeof instrumentTypeOfEq === 'string') {
46
+ andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
47
+ }
48
+ const instrumentIdentifierEq = params.instrument?.identifier?.$eq;
49
+ if (typeof instrumentIdentifierEq === 'string') {
50
+ andConditions.push({ 'instrument.identifier': { $exists: true, $eq: instrumentIdentifierEq } });
51
+ }
52
+ const instrumentIdEq = params.instrument?.id?.$eq;
53
+ if (typeof instrumentIdEq === 'string') {
54
+ andConditions.push({ 'instrument.id': { $exists: true, $eq: instrumentIdEq } });
55
+ }
56
+ const instrumentOrderNumberEq = params.instrument?.orderNumber?.$eq;
57
+ if (typeof instrumentOrderNumberEq === 'string') {
58
+ andConditions.push({ 'instrument.orderNumber': { $exists: true, $eq: instrumentOrderNumberEq } });
59
+ }
60
+ const locationIdEq = params.location?.id?.$eq;
61
+ if (typeof locationIdEq === 'string') {
62
+ andConditions.push({
63
+ 'location.id': {
64
+ $exists: true,
65
+ $eq: locationIdEq
66
+ }
67
+ });
68
+ }
69
+ const locationIdentifierEq = params.location?.identifier?.$eq;
70
+ if (typeof locationIdentifierEq === 'string') {
71
+ andConditions.push({
72
+ 'location.identifier': {
73
+ $exists: true,
74
+ $eq: locationIdentifierEq
75
+ }
76
+ });
77
+ }
78
+ const objectMovieTicketsIdentifierEq = params.object?.movieTickets?.identifier?.$eq;
79
+ if (typeof objectMovieTicketsIdentifierEq === 'string') {
80
+ andConditions.push({
81
+ 'object.movieTickets.identifier': {
82
+ $exists: true,
83
+ $eq: objectMovieTicketsIdentifierEq
84
+ }
85
+ });
86
+ }
87
+ const objectMovieTicketsServiceOutputReservationForIdEq = params.object?.movieTickets?.serviceOutput?.reservationFor?.id?.$eq;
88
+ if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
89
+ andConditions.push({
90
+ 'object.movieTickets.serviceOutput.reservationFor.id': {
91
+ $exists: true,
92
+ $eq: objectMovieTicketsServiceOutputReservationForIdEq
93
+ }
94
+ });
95
+ }
96
+ const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
97
+ if (typeof objectPaymentMethodIdEq === 'string') {
98
+ andConditions.push({
99
+ 'object.paymentMethodId': {
100
+ $exists: true,
101
+ $eq: objectPaymentMethodIdEq
102
+ }
103
+ });
104
+ }
105
+ const objectObjectPaymentMethodIdEq = params.object?.object?.paymentMethodId?.$eq;
106
+ if (typeof objectObjectPaymentMethodIdEq === 'string') {
107
+ andConditions.push({
108
+ 'object.object.paymentMethodId': {
109
+ $exists: true,
110
+ $eq: objectObjectPaymentMethodIdEq
111
+ }
112
+ });
113
+ }
114
+ const objectReservationForIdEq = params.object?.reservationFor?.id?.$eq;
115
+ if (typeof objectReservationForIdEq === 'string') {
116
+ andConditions.push({
117
+ 'object.reservationFor.id': {
118
+ $exists: true,
119
+ $eq: objectReservationForIdEq
120
+ }
121
+ });
122
+ }
123
+ const objectReservationNumberEq = params.object?.reservationNumber?.$eq;
124
+ if (typeof objectReservationNumberEq === 'string') {
125
+ andConditions.push({
126
+ 'object.reservationNumber': {
127
+ $exists: true,
128
+ $eq: objectReservationNumberEq
129
+ }
130
+ });
131
+ }
132
+ const objectReservationNumberIn = params.object?.reservationNumber?.$in;
133
+ if (Array.isArray(objectReservationNumberIn)) {
134
+ andConditions.push({
135
+ 'object.reservationNumber': {
136
+ $exists: true,
137
+ $in: objectReservationNumberIn
138
+ }
139
+ });
140
+ }
141
+ const objectPaymentMethodAccountIdEq = params.object?.paymentMethod?.accountId?.$eq;
142
+ if (typeof objectPaymentMethodAccountIdEq === 'string') {
143
+ andConditions.push({
144
+ 'object.paymentMethod.accountId': {
145
+ $exists: true,
146
+ $eq: objectPaymentMethodAccountIdEq
147
+ }
148
+ });
149
+ }
150
+ const objectPaymentMethodPaymentMethodIdEq = params.object?.paymentMethod?.paymentMethodId?.$eq;
151
+ if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
152
+ andConditions.push({
153
+ 'object.paymentMethod.paymentMethodId': {
154
+ $exists: true,
155
+ $eq: objectPaymentMethodPaymentMethodIdEq
156
+ }
157
+ });
158
+ }
159
+ const objectPaymentMethodPaymentMethodIdIn = params.object?.paymentMethod?.paymentMethodId?.$in;
160
+ if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
161
+ andConditions.push({
162
+ 'object.paymentMethod.paymentMethodId': {
163
+ $exists: true,
164
+ $in: objectPaymentMethodPaymentMethodIdIn
165
+ }
166
+ });
167
+ }
168
+ const objectPaymentMethodTypeOfEq = params.object?.paymentMethod?.typeOf?.$eq;
169
+ if (typeof objectPaymentMethodTypeOfEq === 'string') {
170
+ andConditions.push({
171
+ 'object.paymentMethod.typeOf': {
172
+ $exists: true,
173
+ $eq: objectPaymentMethodTypeOfEq
174
+ }
175
+ });
176
+ }
177
+ const objectTypeOfEq = params.object?.typeOf?.$eq;
178
+ if (typeof objectTypeOfEq === 'string') {
179
+ andConditions.push({
180
+ 'object.typeOf': {
181
+ $exists: true,
182
+ $eq: objectTypeOfEq
183
+ }
184
+ });
185
+ }
186
+ const objectTypeOfIn = params.object?.typeOf?.$in;
187
+ if (Array.isArray(objectTypeOfIn)) {
188
+ andConditions.push({
189
+ 'object.typeOf': {
190
+ $exists: true,
191
+ $in: objectTypeOfIn
192
+ }
193
+ });
194
+ }
195
+ const objectIdEq = params.object?.id?.$eq;
196
+ if (typeof objectIdEq === 'string') {
197
+ andConditions.push({
198
+ 'object.id': {
199
+ $exists: true,
200
+ $eq: objectIdEq
201
+ }
202
+ });
203
+ }
204
+ const objectIdIn = params.object?.id?.$in;
205
+ if (Array.isArray(objectIdIn)) {
206
+ andConditions.push({
207
+ 'object.id': {
208
+ $exists: true,
209
+ $in: objectIdIn
210
+ }
211
+ });
212
+ }
213
+ const objectOrderNumberIn = params.object?.orderNumber?.$in;
214
+ if (Array.isArray(objectOrderNumberIn)) {
215
+ andConditions.push({
216
+ 'object.orderNumber': {
217
+ $exists: true,
218
+ $in: objectOrderNumberIn
219
+ }
220
+ });
221
+ }
222
+ const objectTransactionNumberEq = params.object?.transactionNumber?.$eq;
223
+ if (typeof objectTransactionNumberEq === 'string') {
224
+ andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
225
+ }
226
+ if (typeof params.typeOf === 'string') {
227
+ andConditions.push({
228
+ typeOf: params.typeOf
229
+ });
230
+ }
231
+ else {
232
+ const typeOfEq = params.typeOf?.$eq;
233
+ if (typeof typeOfEq === 'string') {
234
+ andConditions.push({
235
+ typeOf: { $eq: typeOfEq }
236
+ });
237
+ }
238
+ }
239
+ const actionStatusIn = params.actionStatus?.$in;
240
+ if (Array.isArray(actionStatusIn)) {
241
+ andConditions.push({
242
+ actionStatus: { $in: actionStatusIn }
243
+ });
244
+ }
245
+ if (Array.isArray(params.actionStatusTypes)) {
246
+ andConditions.push({
247
+ actionStatus: { $in: params.actionStatusTypes }
248
+ });
249
+ }
250
+ const startDateGte = params.startFrom;
251
+ if (startDateGte instanceof Date) {
252
+ andConditions.push({
253
+ startDate: { $gte: startDateGte }
254
+ });
255
+ }
256
+ const startDateLte = params.startThrough;
257
+ if (startDateLte instanceof Date) {
258
+ andConditions.push({
259
+ startDate: { $lte: startDateLte }
260
+ });
261
+ }
262
+ const purposeTypeOfIn = params.purpose?.typeOf?.$in;
263
+ if (Array.isArray(purposeTypeOfIn)) {
264
+ andConditions.push({
265
+ 'purpose.typeOf': {
266
+ $exists: true,
267
+ $in: purposeTypeOfIn
268
+ }
269
+ });
270
+ }
271
+ const purposeIdIn = params.purpose?.id?.$in;
272
+ if (Array.isArray(purposeIdIn)) {
273
+ andConditions.push({
274
+ 'purpose.id': {
275
+ $exists: true,
276
+ $in: purposeIdIn
277
+ }
278
+ });
279
+ }
280
+ const purposeOrderNumberIn = params.purpose?.orderNumber?.$in;
281
+ if (Array.isArray(purposeOrderNumberIn)) {
282
+ andConditions.push({
283
+ 'purpose.orderNumber': {
284
+ $exists: true,
285
+ $in: purposeOrderNumberIn
286
+ }
287
+ });
288
+ }
289
+ const resultTypeOfIn = params.result?.typeOf?.$in;
290
+ if (Array.isArray(resultTypeOfIn)) {
291
+ andConditions.push({
292
+ 'result.typeOf': {
293
+ $exists: true,
294
+ $in: resultTypeOfIn
295
+ }
296
+ });
297
+ }
298
+ const resultIdIn = params.result?.id?.$in;
299
+ if (Array.isArray(resultIdIn)) {
300
+ andConditions.push({
301
+ 'result.id': {
302
+ $exists: true,
303
+ $in: resultIdIn
304
+ }
305
+ });
306
+ }
307
+ const resultOrderNumberIn = params.result?.orderNumber?.$in;
308
+ if (Array.isArray(resultOrderNumberIn)) {
309
+ andConditions.push({
310
+ 'result.orderNumber': {
311
+ $exists: true,
312
+ $in: resultOrderNumberIn
313
+ }
314
+ });
315
+ }
316
+ const resultCodeIn = params.result?.code?.$in;
317
+ if (Array.isArray(resultCodeIn)) {
318
+ andConditions.push({
319
+ 'result.code': {
320
+ $exists: true,
321
+ $in: resultCodeIn
322
+ }
323
+ });
324
+ }
325
+ // sameAs(2024-04-23~)
326
+ const sameAsIdEq = params.sameAs?.id?.$eq;
327
+ if (typeof sameAsIdEq === 'string') {
328
+ andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
329
+ }
330
+ const aboutOrderNumberEq = params.about?.orderNumber?.$eq;
331
+ if (typeof aboutOrderNumberEq === 'string') {
332
+ andConditions.push({ 'about.orderNumber': { $exists: true, $eq: aboutOrderNumberEq } });
333
+ }
334
+ return andConditions;
335
+ }
@@ -0,0 +1,5 @@
1
+ import type { Model } from 'mongoose';
2
+ import type { IVirtuals } from '../../virtuals';
3
+ type IAbstractActionDocType = any;
4
+ type IAbstractActionModel = Model<IAbstractActionDocType, Record<string, never>, Record<string, never>, IVirtuals>;
5
+ export { IAbstractActionDocType, IAbstractActionModel };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
+ import { IVirtuals } from '../../virtuals';
3
+ import { factory } from '../../../../factory';
4
+ type IDocType = Pick<factory.action.check.paymentMethod.movieTicket.IAction, 'actionStatus' | 'agent' | 'endDate' | 'error' | 'expires' | 'instrument' | 'object' | 'potentialActions' | 'project' | 'purpose' | 'result' | 'sameAs' | 'startDate' | 'typeOf'>;
5
+ type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
6
+ type ISchemaDefinition = SchemaDefinition<IDocType>;
7
+ type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
8
+ declare const modelName = "Action.CheckMovieTicket";
9
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
10
+ declare function createSchema(): ISchema;
11
+ export { createSchema, IDocType, IModel, indexes, modelName };