@chevre/domain 20.1.0-alpha.28 → 20.1.0-alpha.29

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,157 @@
1
+ // tslint:disable:no-console
2
+ // import * as moment from 'moment';
3
+ import * as mongoose from 'mongoose';
4
+
5
+ import { chevre } from '../../../lib/index';
6
+
7
+ // const project = { id: String(process.env.PROJECT_ID) };
8
+ const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
+
10
+ // tslint:disable-next-line:max-func-body-length
11
+ async function main() {
12
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
+
14
+ const accountTitleRepo = new chevre.repository.AccountTitle(mongoose.connection);
15
+
16
+ const cursor = accountTitleRepo.getCursor(
17
+ {
18
+ // 'project.id': { $eq: project.id },
19
+ 'project.id': { $ne: EXCLUDED_PROJECT_ID }
20
+ // typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
21
+ // starDate: { $gte: new Date() }
22
+ // _id: { $eq: 'al6aff83w' }
23
+ },
24
+ {
25
+ // _id: 1,
26
+ }
27
+ );
28
+ console.log('accountTitles found');
29
+
30
+ const additionalPropertyNamesOnCategories: string[] = [];
31
+ const additionalPropertyNames: string[] = [];
32
+ const additionalPropertyNamesOnTitles: string[] = [];
33
+ const projectIdsOnCategories: string[] = [];
34
+ const projectIds: string[] = [];
35
+ const projectIdsOnTitles: string[] = [];
36
+ const unexpextedprojectIdsOnCategories: string[] = [];
37
+ const unexpextedprojectIds: string[] = [];
38
+ const unexpextedprojectIdsOnTitles: string[] = [];
39
+
40
+ let i = 0;
41
+ let updateCount = 0;
42
+ // tslint:disable-next-line:max-func-body-length
43
+ await cursor.eachAsync(async (doc) => {
44
+ i += 1;
45
+ const accountTitleCategory: chevre.factory.accountTitle.IAccountTitle = doc.toObject();
46
+
47
+ const additionalPropertyNamesOnCategory = accountTitleCategory.additionalProperty?.map((p) => p.name);
48
+ console.log(
49
+ (Array.isArray(additionalPropertyNamesOnCategory)) ? additionalPropertyNamesOnCategory.length : 0,
50
+ 'additionalPropertyNamesOnCategory found',
51
+ accountTitleCategory.project.id,
52
+ accountTitleCategory.codeValue
53
+ );
54
+ if (Array.isArray(additionalPropertyNamesOnCategory) && additionalPropertyNamesOnCategory.length > 0) {
55
+ console.log(
56
+ additionalPropertyNamesOnCategory.length,
57
+ 'additionalPropertyNamesOnResource found',
58
+ accountTitleCategory.project.id,
59
+ accountTitleCategory.codeValue
60
+ );
61
+ additionalPropertyNamesOnCategories.push(...additionalPropertyNamesOnCategory);
62
+ projectIdsOnCategories.push(accountTitleCategory.project.id);
63
+ additionalPropertyNamesOnCategory.forEach((name) => {
64
+ if (!name.match(/^[a-zA-Z]*$/)) {
65
+ // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
66
+ unexpextedprojectIdsOnCategories.push(accountTitleCategory.project.id);
67
+ }
68
+ // tslint:disable-next-line:no-magic-numbers
69
+ if (name.length < 5) {
70
+ // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
71
+ unexpextedprojectIdsOnCategories.push(accountTitleCategory.project.id);
72
+ }
73
+ });
74
+ }
75
+
76
+ if (Array.isArray(accountTitleCategory.hasCategoryCode)) {
77
+ accountTitleCategory.hasCategoryCode.forEach((accountTitleSet) => {
78
+ const additionalPropertyNamesOnResource = accountTitleSet.additionalProperty?.map((p) => p.name);
79
+ console.log(
80
+ (Array.isArray(additionalPropertyNamesOnResource)) ? additionalPropertyNamesOnResource.length : 0,
81
+ 'additionalPropertyNamesOnResource found',
82
+ accountTitleCategory.project.id,
83
+ accountTitleCategory.codeValue
84
+ );
85
+ if (Array.isArray(additionalPropertyNamesOnResource) && additionalPropertyNamesOnResource.length > 0) {
86
+ console.log(
87
+ additionalPropertyNamesOnResource.length,
88
+ 'additionalPropertyNamesOnResource found',
89
+ accountTitleCategory.project.id,
90
+ accountTitleCategory.codeValue
91
+ );
92
+ additionalPropertyNames.push(...additionalPropertyNamesOnResource);
93
+ projectIds.push(accountTitleCategory.project.id);
94
+ additionalPropertyNamesOnResource.forEach((name) => {
95
+ if (!name.match(/^[a-zA-Z]*$/)) {
96
+ // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
97
+ unexpextedprojectIds.push(accountTitleCategory.project.id);
98
+ }
99
+ // tslint:disable-next-line:no-magic-numbers
100
+ if (name.length < 5) {
101
+ // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
102
+ unexpextedprojectIds.push(accountTitleCategory.project.id);
103
+ }
104
+ });
105
+ }
106
+
107
+ if (Array.isArray(accountTitleSet.hasCategoryCode)) {
108
+ accountTitleSet.hasCategoryCode.forEach((accountTitl) => {
109
+ const additionalPropertyNamesOnSection = accountTitl.additionalProperty?.map((p) => p.name);
110
+ console.log(
111
+ (Array.isArray(additionalPropertyNamesOnSection)) ? additionalPropertyNamesOnSection.length : 0,
112
+ 'additionalPropertyNamesOnSection found',
113
+ accountTitleCategory.project.id,
114
+ accountTitleCategory.codeValue
115
+ );
116
+ if (Array.isArray(additionalPropertyNamesOnSection) && additionalPropertyNamesOnSection.length > 0) {
117
+ console.log(
118
+ additionalPropertyNamesOnSection.length,
119
+ 'additionalPropertyNamesOnSection found',
120
+ accountTitleCategory.project.id,
121
+ accountTitleCategory.codeValue
122
+ );
123
+ additionalPropertyNamesOnTitles.push(...additionalPropertyNamesOnSection);
124
+ projectIdsOnTitles.push(accountTitleCategory.project.id);
125
+ additionalPropertyNamesOnSection.forEach((name) => {
126
+ if (!name.match(/^[a-zA-Z]*$/)) {
127
+ // throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
128
+ unexpextedprojectIdsOnTitles.push(accountTitleCategory.project.id);
129
+ }
130
+ // tslint:disable-next-line:no-magic-numbers
131
+ if (name.length < 5) {
132
+ // throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
133
+ unexpextedprojectIdsOnTitles.push(accountTitleCategory.project.id);
134
+ }
135
+ });
136
+ }
137
+ });
138
+ }
139
+ });
140
+ }
141
+ });
142
+ console.log(i, 'places checked');
143
+ console.log(updateCount, 'places updated');
144
+ console.log([...new Set(additionalPropertyNamesOnCategories)], 'categories');
145
+ console.log([...new Set(projectIdsOnCategories)], 'categories');
146
+ console.log([...new Set(unexpextedprojectIdsOnCategories)], 'categories');
147
+ console.log([...new Set(additionalPropertyNames)], 'sets');
148
+ console.log([...new Set(projectIds)], 'sets');
149
+ console.log([...new Set(unexpextedprojectIds)], 'sets');
150
+ console.log([...new Set(additionalPropertyNamesOnTitles)], 'titles');
151
+ console.log([...new Set(projectIdsOnTitles)], 'titles');
152
+ console.log([...new Set(unexpextedprojectIdsOnTitles)], 'titles');
153
+ }
154
+
155
+ main()
156
+ .then()
157
+ .catch(console.error);
@@ -9,24 +9,28 @@ const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
9
 
10
10
  // tslint:disable-next-line:max-func-body-length
11
11
  async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
12
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
13
 
14
14
  // const customerRepo = new chevre.repository.Customer(mongoose.connection);
15
15
  // const sellerRepo = new chevre.repository.Seller(mongoose.connection);
16
16
  // const eventRepo = new chevre.repository.Event(mongoose.connection);
17
- const creativeWorkRepo = new chevre.repository.CreativeWork(mongoose.connection);
17
+ // const creativeWorkRepo = new chevre.repository.CreativeWork(mongoose.connection);
18
18
  // const placeRepo = new chevre.repository.Place(mongoose.connection);
19
19
  // const offerRepo = new chevre.repository.Offer(mongoose.connection);
20
20
  // const categoryCodeRepo = new chevre.repository.CategoryCode(mongoose.connection);
21
21
  // const additionalPropertyRepo = new chevre.repository.AdditionalProperty(mongoose.connection);
22
+ // const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
23
+ const merchantReturnPolicyRepo = new chevre.repository.MerchantReturnPolicy(mongoose.connection);
22
24
 
23
25
  // const cursor = customerRepo.getCursor(
24
26
  // const cursor = sellerRepo.getCursor(
25
27
  // const cursor = eventRepo.getCursor(
26
28
  // const cursor = categoryCodeRepo.getCursor(
27
29
  // const cursor = offerRepo.getCursor(
28
- const cursor = creativeWorkRepo.getCursor(
29
- // const cursor = placeRepo.getCursor(
30
+ // const cursor = creativeWorkRepo.getCursor(
31
+ // const cursor = placeRepo.getCursor(
32
+ // const cursor = offerCatalogRepo.getCursor(
33
+ const cursor = merchantReturnPolicyRepo.getCursor(
30
34
  {
31
35
  // 'project.id': { $eq: project.id },
32
36
  'project.id': { $ne: EXCLUDED_PROJECT_ID },
@@ -9,14 +9,14 @@ const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
9
9
 
10
10
  // tslint:disable-next-line:max-func-body-length
11
11
  async function main() {
12
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
12
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
13
13
 
14
14
  const placeRepo = new chevre.repository.Place(mongoose.connection);
15
15
 
16
16
  const cursor = placeRepo.getCursor(
17
17
  {
18
18
  // 'project.id': { $eq: project.id },
19
- 'project.id': { $ne: EXCLUDED_PROJECT_ID },
19
+ 'project.id': { $ne: EXCLUDED_PROJECT_ID }
20
20
  // typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
21
21
  // starDate: { $gte: new Date() }
22
22
  // _id: { $eq: 'al6aff83w' }
@@ -7,7 +7,7 @@ const project = { id: String(process.env.PROJECT_ID) };
7
7
  const DELETING_PROPERTY_NAME: string = 'COA_ENDPOINT';
8
8
 
9
9
  async function main() {
10
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
10
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
11
11
 
12
12
  const eventRepo = new chevre.repository.Event(mongoose.connection);
13
13
 
@@ -15,7 +15,8 @@ async function main() {
15
15
  {
16
16
  'project.id': { $eq: project.id },
17
17
  typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries }
18
- // typeOf: { $eq: chevre.factory.eventType.ScreeningEvent }
18
+ // typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
19
+ // startDate: { $gte: new Date() }
19
20
  },
20
21
  {
21
22
  // _id: 1,
@@ -9,46 +9,28 @@ export declare type IAction<T extends factory.actionType> = T extends factory.ac
9
9
  export declare class MongoRepository {
10
10
  private readonly actionModel;
11
11
  constructor(connection: Connection);
12
- static CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params: factory.account.action.moneyTransfer.ISearchConditions): any[];
13
12
  /**
14
13
  * アクション開始
15
14
  */
16
- startByIdentifier<T extends factory.actionType>(params: factory.account.action.moneyTransfer.IAttributes): Promise<IAction<T>>;
17
15
  /**
18
16
  * アクション完了
19
17
  */
20
- complete<T extends factory.actionType>(typeOf: T, actionId: string, result: any): Promise<IAction<T>>;
21
18
  /**
22
19
  * アクション中止
23
20
  */
24
- cancel<T extends factory.actionType>(typeOf: T, actionId: string): Promise<IAction<T>>;
25
21
  /**
26
22
  * アクション失敗
27
23
  */
28
- giveUp<T extends factory.actionType>(typeOf: T, actionId: string, error: any): Promise<IAction<T>>;
29
24
  /**
30
25
  * アクション検索
31
26
  */
32
- findById<T extends factory.actionType>(typeOf: T, actionId: string): Promise<IAction<T>>;
33
- countTransferActions(params: factory.account.action.moneyTransfer.ISearchConditions): Promise<number>;
34
27
  /**
35
28
  * 転送アクションを検索する
36
29
  */
37
- searchTransferActions(params: factory.account.action.moneyTransfer.ISearchConditions): Promise<factory.account.action.moneyTransfer.IAction[]>;
38
30
  /**
39
31
  * アクションを検索する
40
32
  * @param searchConditions 検索条件
41
33
  */
42
- search<T extends factory.actionType>(searchConditions: {
43
- typeOf: T;
44
- actionStatuses?: factory.account.AccountStatusType[];
45
- startDateFrom?: Date;
46
- startDateThrough?: Date;
47
- purposeTypeOfs?: factory.account.transactionType[];
48
- fromLocationAccountNumbers?: string[];
49
- toLocationAccountNumbers?: string[];
50
- limit: number;
51
- }): Promise<IAction<T>[]>;
52
34
  clean(params: {
53
35
  project?: {
54
36
  id?: string;
@@ -21,174 +21,175 @@ class MongoRepository {
21
21
  this.actionModel = connection.model(accountAction_1.modelName);
22
22
  }
23
23
  // tslint:disable-next-line:max-func-body-length
24
- static CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params) {
25
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
26
- const andConditions = [
27
- { typeOf: factory.actionType.MoneyTransfer }
28
- ];
29
- // tslint:disable-next-line:no-single-line-block-comment
30
- /* istanbul ignore else */
31
- if (params.project !== undefined && params.project !== null) {
32
- // tslint:disable-next-line:no-single-line-block-comment
33
- /* istanbul ignore else */
34
- if (params.project.id !== undefined && params.project.id !== null) {
35
- // tslint:disable-next-line:no-single-line-block-comment
36
- /* istanbul ignore else */
37
- if (typeof params.project.id.$eq === 'string') {
38
- andConditions.push({
39
- 'project.id': {
40
- $eq: params.project.id.$eq
41
- }
42
- });
43
- }
44
- // tslint:disable-next-line:no-single-line-block-comment
45
- /* istanbul ignore else */
46
- if (typeof params.project.id.$ne === 'string') {
47
- andConditions.push({
48
- 'project.id': {
49
- $ne: params.project.id.$ne
50
- }
51
- });
52
- }
53
- }
54
- }
55
- // tslint:disable-next-line:no-single-line-block-comment
56
- /* istanbul ignore else */
57
- // if (typeof params.accountNumber === 'string') {
58
- // andConditions.push({
59
- // $or: [
60
- // {
61
- // 'fromLocation.accountNumber': {
62
- // $exists: true,
63
- // $eq: params.accountNumber
64
- // }
65
- // },
66
- // {
67
- // 'toLocation.accountNumber': {
68
- // $exists: true,
69
- // $eq: params.accountNumber
70
- // }
71
- // }
72
- // ]
73
- // });
74
- // }
75
- const actionStatusIn = (_a = params.actionStatus) === null || _a === void 0 ? void 0 : _a.$in;
76
- // tslint:disable-next-line:no-single-line-block-comment
77
- /* istanbul ignore else */
78
- if (Array.isArray(actionStatusIn)) {
79
- andConditions.push({
80
- actionStatus: { $in: actionStatusIn }
81
- });
82
- }
83
- const amountCurrencyEq = (_c = (_b = params.amount) === null || _b === void 0 ? void 0 : _b.currency) === null || _c === void 0 ? void 0 : _c.$eq;
84
- if (typeof amountCurrencyEq === 'string') {
85
- andConditions.push({
86
- 'amount.currency': {
87
- $exists: true,
88
- $eq: amountCurrencyEq
89
- }
90
- });
91
- }
92
- const locationAccountNumberEq = (_e = (_d = params.location) === null || _d === void 0 ? void 0 : _d.accountNumber) === null || _e === void 0 ? void 0 : _e.$eq;
93
- if (typeof locationAccountNumberEq === 'string') {
94
- andConditions.push({
95
- $or: [
96
- {
97
- 'fromLocation.accountNumber': {
98
- $exists: true,
99
- $eq: locationAccountNumberEq
100
- }
101
- },
102
- {
103
- 'toLocation.accountNumber': {
104
- $exists: true,
105
- $eq: locationAccountNumberEq
106
- }
107
- }
108
- ]
109
- });
110
- }
111
- const locationTypeOfEq = (_g = (_f = params.location) === null || _f === void 0 ? void 0 : _f.typeOf) === null || _g === void 0 ? void 0 : _g.$eq;
112
- if (typeof locationTypeOfEq === 'string') {
113
- andConditions.push({
114
- $or: [
115
- {
116
- 'fromLocation.typeOf': {
117
- $exists: true,
118
- $eq: locationTypeOfEq
119
- }
120
- },
121
- {
122
- 'toLocation.typeOf': {
123
- $exists: true,
124
- $eq: locationTypeOfEq
125
- }
126
- }
127
- ]
128
- });
129
- }
130
- const purposeTypeOfEq = (_j = (_h = params.purpose) === null || _h === void 0 ? void 0 : _h.typeOf) === null || _j === void 0 ? void 0 : _j.$eq;
131
- // tslint:disable-next-line:no-single-line-block-comment
132
- /* istanbul ignore else */
133
- if (typeof purposeTypeOfEq === 'string') {
134
- andConditions.push({
135
- 'purpose.typeOf': {
136
- $exists: true,
137
- $eq: purposeTypeOfEq
138
- }
139
- });
140
- }
141
- const purposeIdEq = (_l = (_k = params.purpose) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.$eq;
142
- // tslint:disable-next-line:no-single-line-block-comment
143
- /* istanbul ignore else */
144
- if (typeof purposeIdEq === 'string') {
145
- andConditions.push({
146
- 'purpose.id': {
147
- $exists: true,
148
- $eq: purposeIdEq
149
- }
150
- });
151
- }
152
- const purposeIdentifierEq = (_o = (_m = params.purpose) === null || _m === void 0 ? void 0 : _m.identifier) === null || _o === void 0 ? void 0 : _o.$eq;
153
- // tslint:disable-next-line:no-single-line-block-comment
154
- /* istanbul ignore else */
155
- if (typeof purposeIdentifierEq === 'string') {
156
- andConditions.push({
157
- 'purpose.identifier': {
158
- $exists: true,
159
- $eq: purposeIdentifierEq
160
- }
161
- });
162
- }
163
- const purposeTransactionNumberEq = (_q = (_p = params.purpose) === null || _p === void 0 ? void 0 : _p.transactionNumber) === null || _q === void 0 ? void 0 : _q.$eq;
164
- // tslint:disable-next-line:no-single-line-block-comment
165
- /* istanbul ignore else */
166
- if (typeof purposeTransactionNumberEq === 'string') {
167
- andConditions.push({
168
- 'purpose.transactionNumber': {
169
- $exists: true,
170
- $eq: purposeTransactionNumberEq
171
- }
172
- });
173
- }
174
- const startDateGte = (_r = params.startDate) === null || _r === void 0 ? void 0 : _r.$gte;
175
- // tslint:disable-next-line:no-single-line-block-comment
176
- /* istanbul ignore else */
177
- if (startDateGte instanceof Date) {
178
- andConditions.push({
179
- startDate: { $gte: startDateGte }
180
- });
181
- }
182
- const startDateLte = (_s = params.startDate) === null || _s === void 0 ? void 0 : _s.$lte;
183
- // tslint:disable-next-line:no-single-line-block-comment
184
- /* istanbul ignore else */
185
- if (startDateLte instanceof Date) {
186
- andConditions.push({
187
- startDate: { $lte: startDateLte }
188
- });
189
- }
190
- return andConditions;
191
- }
24
+ // public static CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(
25
+ // params: factory.account.action.moneyTransfer.ISearchConditions
26
+ // ) {
27
+ // const andConditions: any[] = [
28
+ // { typeOf: factory.actionType.MoneyTransfer }
29
+ // ];
30
+ // // tslint:disable-next-line:no-single-line-block-comment
31
+ // /* istanbul ignore else */
32
+ // if (params.project !== undefined && params.project !== null) {
33
+ // // tslint:disable-next-line:no-single-line-block-comment
34
+ // /* istanbul ignore else */
35
+ // if (params.project.id !== undefined && params.project.id !== null) {
36
+ // // tslint:disable-next-line:no-single-line-block-comment
37
+ // /* istanbul ignore else */
38
+ // if (typeof params.project.id.$eq === 'string') {
39
+ // andConditions.push({
40
+ // 'project.id': {
41
+ // $eq: params.project.id.$eq
42
+ // }
43
+ // });
44
+ // }
45
+ // // tslint:disable-next-line:no-single-line-block-comment
46
+ // /* istanbul ignore else */
47
+ // if (typeof params.project.id.$ne === 'string') {
48
+ // andConditions.push({
49
+ // 'project.id': {
50
+ // $ne: params.project.id.$ne
51
+ // }
52
+ // });
53
+ // }
54
+ // }
55
+ // }
56
+ // // tslint:disable-next-line:no-single-line-block-comment
57
+ // /* istanbul ignore else */
58
+ // // if (typeof params.accountNumber === 'string') {
59
+ // // andConditions.push({
60
+ // // $or: [
61
+ // // {
62
+ // // 'fromLocation.accountNumber': {
63
+ // // $exists: true,
64
+ // // $eq: params.accountNumber
65
+ // // }
66
+ // // },
67
+ // // {
68
+ // // 'toLocation.accountNumber': {
69
+ // // $exists: true,
70
+ // // $eq: params.accountNumber
71
+ // // }
72
+ // // }
73
+ // // ]
74
+ // // });
75
+ // // }
76
+ // const actionStatusIn = params.actionStatus?.$in;
77
+ // // tslint:disable-next-line:no-single-line-block-comment
78
+ // /* istanbul ignore else */
79
+ // if (Array.isArray(actionStatusIn)) {
80
+ // andConditions.push({
81
+ // actionStatus: { $in: actionStatusIn }
82
+ // });
83
+ // }
84
+ // const amountCurrencyEq = params.amount?.currency?.$eq;
85
+ // if (typeof amountCurrencyEq === 'string') {
86
+ // andConditions.push({
87
+ // 'amount.currency': {
88
+ // $exists: true,
89
+ // $eq: amountCurrencyEq
90
+ // }
91
+ // });
92
+ // }
93
+ // const locationAccountNumberEq = params.location?.accountNumber?.$eq;
94
+ // if (typeof locationAccountNumberEq === 'string') {
95
+ // andConditions.push({
96
+ // $or: [
97
+ // {
98
+ // 'fromLocation.accountNumber': {
99
+ // $exists: true,
100
+ // $eq: locationAccountNumberEq
101
+ // }
102
+ // },
103
+ // {
104
+ // 'toLocation.accountNumber': {
105
+ // $exists: true,
106
+ // $eq: locationAccountNumberEq
107
+ // }
108
+ // }
109
+ // ]
110
+ // });
111
+ // }
112
+ // const locationTypeOfEq = params.location?.typeOf?.$eq;
113
+ // if (typeof locationTypeOfEq === 'string') {
114
+ // andConditions.push({
115
+ // $or: [
116
+ // {
117
+ // 'fromLocation.typeOf': {
118
+ // $exists: true,
119
+ // $eq: locationTypeOfEq
120
+ // }
121
+ // },
122
+ // {
123
+ // 'toLocation.typeOf': {
124
+ // $exists: true,
125
+ // $eq: locationTypeOfEq
126
+ // }
127
+ // }
128
+ // ]
129
+ // });
130
+ // }
131
+ // const purposeTypeOfEq = params.purpose?.typeOf?.$eq;
132
+ // // tslint:disable-next-line:no-single-line-block-comment
133
+ // /* istanbul ignore else */
134
+ // if (typeof purposeTypeOfEq === 'string') {
135
+ // andConditions.push({
136
+ // 'purpose.typeOf': {
137
+ // $exists: true,
138
+ // $eq: purposeTypeOfEq
139
+ // }
140
+ // });
141
+ // }
142
+ // const purposeIdEq = params.purpose?.id?.$eq;
143
+ // // tslint:disable-next-line:no-single-line-block-comment
144
+ // /* istanbul ignore else */
145
+ // if (typeof purposeIdEq === 'string') {
146
+ // andConditions.push({
147
+ // 'purpose.id': {
148
+ // $exists: true,
149
+ // $eq: purposeIdEq
150
+ // }
151
+ // });
152
+ // }
153
+ // const purposeIdentifierEq = params.purpose?.identifier?.$eq;
154
+ // // tslint:disable-next-line:no-single-line-block-comment
155
+ // /* istanbul ignore else */
156
+ // if (typeof purposeIdentifierEq === 'string') {
157
+ // andConditions.push({
158
+ // 'purpose.identifier': {
159
+ // $exists: true,
160
+ // $eq: purposeIdentifierEq
161
+ // }
162
+ // });
163
+ // }
164
+ // const purposeTransactionNumberEq = params.purpose?.transactionNumber?.$eq;
165
+ // // tslint:disable-next-line:no-single-line-block-comment
166
+ // /* istanbul ignore else */
167
+ // if (typeof purposeTransactionNumberEq === 'string') {
168
+ // andConditions.push({
169
+ // 'purpose.transactionNumber': {
170
+ // $exists: true,
171
+ // $eq: purposeTransactionNumberEq
172
+ // }
173
+ // });
174
+ // }
175
+ // const startDateGte = params.startDate?.$gte;
176
+ // // tslint:disable-next-line:no-single-line-block-comment
177
+ // /* istanbul ignore else */
178
+ // if (startDateGte instanceof Date) {
179
+ // andConditions.push({
180
+ // startDate: { $gte: startDateGte }
181
+ // });
182
+ // }
183
+ // const startDateLte = params.startDate?.$lte;
184
+ // // tslint:disable-next-line:no-single-line-block-comment
185
+ // /* istanbul ignore else */
186
+ // if (startDateLte instanceof Date) {
187
+ // andConditions.push({
188
+ // startDate: { $lte: startDateLte }
189
+ // });
190
+ // }
191
+ // return andConditions;
192
+ // }
192
193
  /**
193
194
  * アクション開始
194
195
  */
@@ -204,212 +205,258 @@ class MongoRepository {
204
205
  // (doc) => doc.toObject()
205
206
  // );
206
207
  // }
207
- startByIdentifier(params) {
208
- return __awaiter(this, void 0, void 0, function* () {
209
- if (typeof params.identifier === 'string') {
210
- return this.actionModel.findOneAndUpdate({
211
- identifier: {
212
- $exists: true,
213
- $eq: params.identifier
214
- }
215
- }, {
216
- $setOnInsert: Object.assign(Object.assign({}, params), { actionStatus: factory.actionStatusType.ActiveActionStatus, startDate: new Date() })
217
- }, {
218
- new: true,
219
- upsert: true
220
- })
221
- .exec()
222
- .then((doc) => {
223
- if (doc === null) {
224
- throw new factory.errors.NotFound(this.actionModel.modelName);
225
- }
226
- return doc.toObject();
227
- });
228
- }
229
- else {
230
- return this.actionModel.create(Object.assign(Object.assign({}, params), { actionStatus: factory.actionStatusType.ActiveActionStatus, startDate: new Date() }))
231
- .then((doc) => doc.toObject());
232
- }
233
- });
234
- }
208
+ // public async startByIdentifier<T extends factory.actionType>(
209
+ // params: factory.account.action.moneyTransfer.IAttributes
210
+ // ): Promise<IAction<T>> {
211
+ // if (typeof params.identifier === 'string') {
212
+ // return this.actionModel.findOneAndUpdate(
213
+ // {
214
+ // identifier: {
215
+ // $exists: true,
216
+ // $eq: params.identifier
217
+ // }
218
+ // },
219
+ // {
220
+ // $setOnInsert: {
221
+ // ...params,
222
+ // actionStatus: factory.actionStatusType.ActiveActionStatus,
223
+ // startDate: new Date()
224
+ // }
225
+ // },
226
+ // {
227
+ // new: true,
228
+ // upsert: true
229
+ // }
230
+ // )
231
+ // .exec()
232
+ // .then((doc) => {
233
+ // if (doc === null) {
234
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
235
+ // }
236
+ // return doc.toObject();
237
+ // });
238
+ // } else {
239
+ // return this.actionModel.create({
240
+ // ...params,
241
+ // actionStatus: factory.actionStatusType.ActiveActionStatus,
242
+ // startDate: new Date()
243
+ // })
244
+ // .then(
245
+ // (doc) => doc.toObject()
246
+ // );
247
+ // }
248
+ // }
235
249
  /**
236
250
  * アクション完了
237
251
  */
238
- complete(typeOf, actionId, result) {
239
- return __awaiter(this, void 0, void 0, function* () {
240
- return this.actionModel.findOneAndUpdate({
241
- typeOf: typeOf,
242
- _id: actionId
243
- }, {
244
- actionStatus: factory.actionStatusType.CompletedActionStatus,
245
- result: result,
246
- endDate: new Date()
247
- }, { new: true })
248
- .exec()
249
- .then((doc) => {
250
- if (doc === null) {
251
- throw new factory.errors.NotFound(this.actionModel.modelName);
252
- }
253
- return doc.toObject();
254
- });
255
- });
256
- }
252
+ // public async complete<T extends factory.actionType>(
253
+ // typeOf: T,
254
+ // actionId: string,
255
+ // result: any
256
+ // ): Promise<IAction<T>> {
257
+ // return this.actionModel.findOneAndUpdate(
258
+ // {
259
+ // typeOf: typeOf,
260
+ // _id: actionId
261
+ // },
262
+ // {
263
+ // actionStatus: factory.actionStatusType.CompletedActionStatus,
264
+ // result: result,
265
+ // endDate: new Date()
266
+ // },
267
+ // { new: true }
268
+ // )
269
+ // .exec()
270
+ // .then((doc) => {
271
+ // if (doc === null) {
272
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
273
+ // }
274
+ // return doc.toObject();
275
+ // });
276
+ // }
257
277
  /**
258
278
  * アクション中止
259
279
  */
260
- cancel(typeOf, actionId) {
261
- return __awaiter(this, void 0, void 0, function* () {
262
- return this.actionModel.findOneAndUpdate({
263
- typeOf: typeOf,
264
- _id: actionId
265
- }, { actionStatus: factory.actionStatusType.CanceledActionStatus }, { new: true })
266
- .exec()
267
- .then((doc) => {
268
- if (doc === null) {
269
- throw new factory.errors.NotFound(this.actionModel.modelName);
270
- }
271
- return doc.toObject();
272
- });
273
- });
274
- }
280
+ // public async cancel<T extends factory.actionType>(
281
+ // typeOf: T,
282
+ // actionId: string
283
+ // ): Promise<IAction<T>> {
284
+ // return this.actionModel.findOneAndUpdate(
285
+ // {
286
+ // typeOf: typeOf,
287
+ // _id: actionId
288
+ // },
289
+ // { actionStatus: factory.actionStatusType.CanceledActionStatus },
290
+ // { new: true }
291
+ // )
292
+ // .exec()
293
+ // .then((doc) => {
294
+ // if (doc === null) {
295
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
296
+ // }
297
+ // return doc.toObject();
298
+ // });
299
+ // }
275
300
  /**
276
301
  * アクション失敗
277
302
  */
278
- giveUp(typeOf, actionId, error) {
279
- return __awaiter(this, void 0, void 0, function* () {
280
- return this.actionModel.findOneAndUpdate({
281
- typeOf: typeOf,
282
- _id: actionId
283
- }, {
284
- actionStatus: factory.actionStatusType.FailedActionStatus,
285
- error: error,
286
- endDate: new Date()
287
- }, { new: true })
288
- .exec()
289
- .then((doc) => {
290
- if (doc === null) {
291
- throw new factory.errors.NotFound(this.actionModel.modelName);
292
- }
293
- return doc.toObject();
294
- });
295
- });
296
- }
303
+ // public async giveUp<T extends factory.actionType>(
304
+ // typeOf: T,
305
+ // actionId: string,
306
+ // error: any
307
+ // ): Promise<IAction<T>> {
308
+ // return this.actionModel.findOneAndUpdate(
309
+ // {
310
+ // typeOf: typeOf,
311
+ // _id: actionId
312
+ // },
313
+ // {
314
+ // actionStatus: factory.actionStatusType.FailedActionStatus,
315
+ // error: error,
316
+ // endDate: new Date()
317
+ // },
318
+ // { new: true }
319
+ // )
320
+ // .exec()
321
+ // .then((doc) => {
322
+ // if (doc === null) {
323
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
324
+ // }
325
+ // return doc.toObject();
326
+ // });
327
+ // }
297
328
  /**
298
329
  * アクション検索
299
330
  */
300
- findById(typeOf, actionId) {
301
- return __awaiter(this, void 0, void 0, function* () {
302
- return this.actionModel.findOne({
303
- typeOf: typeOf,
304
- _id: actionId
305
- })
306
- .exec()
307
- .then((doc) => {
308
- if (doc === null) {
309
- throw new factory.errors.NotFound(this.actionModel.modelName);
310
- }
311
- return doc.toObject();
312
- });
313
- });
314
- }
315
- countTransferActions(params) {
316
- return __awaiter(this, void 0, void 0, function* () {
317
- const conditions = MongoRepository.CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params);
318
- return this.actionModel.countDocuments({ $and: conditions })
319
- .setOptions({ maxTimeMS: 10000 })
320
- .exec();
321
- });
322
- }
331
+ // public async findById<T extends factory.actionType>(
332
+ // typeOf: T,
333
+ // actionId: string
334
+ // ): Promise<IAction<T>> {
335
+ // return this.actionModel.findOne(
336
+ // {
337
+ // typeOf: typeOf,
338
+ // _id: actionId
339
+ // }
340
+ // )
341
+ // .exec()
342
+ // .then((doc) => {
343
+ // if (doc === null) {
344
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
345
+ // }
346
+ // return doc.toObject();
347
+ // });
348
+ // }
349
+ // public async countTransferActions(
350
+ // params: factory.account.action.moneyTransfer.ISearchConditions
351
+ // ): Promise<number> {
352
+ // const conditions = MongoRepository.CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params);
353
+ // return this.actionModel.countDocuments({ $and: conditions })
354
+ // .setOptions({ maxTimeMS: 10000 })
355
+ // .exec();
356
+ // }
323
357
  /**
324
358
  * 転送アクションを検索する
325
359
  */
326
- searchTransferActions(params) {
327
- return __awaiter(this, void 0, void 0, function* () {
328
- const conditions = MongoRepository.CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params);
329
- const query = this.actionModel.find({ $and: conditions }, {
330
- __v: 0,
331
- createdAt: 0,
332
- updatedAt: 0
333
- });
334
- // tslint:disable-next-line:no-single-line-block-comment
335
- /* istanbul ignore else */
336
- if (params.limit !== undefined && params.page !== undefined) {
337
- query.limit(params.limit)
338
- .skip(params.limit * (params.page - 1));
339
- }
340
- // tslint:disable-next-line:no-single-line-block-comment
341
- /* istanbul ignore else */
342
- if (params.sort !== undefined) {
343
- query.sort(params.sort);
344
- }
345
- return query.setOptions({ maxTimeMS: 10000 })
346
- .exec()
347
- .then((docs) => docs.map((doc) => doc.toObject()));
348
- });
349
- }
360
+ // public async searchTransferActions(
361
+ // params: factory.account.action.moneyTransfer.ISearchConditions
362
+ // ): Promise<factory.account.action.moneyTransfer.IAction[]> {
363
+ // const conditions = MongoRepository.CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params);
364
+ // const query = this.actionModel.find(
365
+ // { $and: conditions },
366
+ // {
367
+ // __v: 0,
368
+ // createdAt: 0,
369
+ // updatedAt: 0
370
+ // }
371
+ // );
372
+ // // tslint:disable-next-line:no-single-line-block-comment
373
+ // /* istanbul ignore else */
374
+ // if (params.limit !== undefined && params.page !== undefined) {
375
+ // query.limit(params.limit)
376
+ // .skip(params.limit * (params.page - 1));
377
+ // }
378
+ // // tslint:disable-next-line:no-single-line-block-comment
379
+ // /* istanbul ignore else */
380
+ // if (params.sort !== undefined) {
381
+ // query.sort(params.sort);
382
+ // }
383
+ // return query.setOptions({ maxTimeMS: 10000 })
384
+ // .exec()
385
+ // .then((docs) => docs.map((doc) => doc.toObject()));
386
+ // }
350
387
  /**
351
388
  * アクションを検索する
352
389
  * @param searchConditions 検索条件
353
390
  */
354
- search(searchConditions) {
355
- return __awaiter(this, void 0, void 0, function* () {
356
- const andConditions = [
357
- { typeOf: searchConditions.typeOf },
358
- {
359
- startDate: {
360
- $exists: true,
361
- $gte: searchConditions.startDateFrom,
362
- $lte: searchConditions.startDateThrough
363
- }
364
- }
365
- ];
366
- // tslint:disable-next-line:no-single-line-block-comment
367
- /* istanbul ignore else */
368
- if (Array.isArray(searchConditions.actionStatuses) && searchConditions.actionStatuses.length > 0) {
369
- andConditions.push({
370
- actionStatus: { $in: searchConditions.actionStatuses }
371
- });
372
- }
373
- // tslint:disable-next-line:no-single-line-block-comment
374
- /* istanbul ignore else */
375
- if (Array.isArray(searchConditions.purposeTypeOfs) && searchConditions.purposeTypeOfs.length > 0) {
376
- andConditions.push({
377
- 'purpose.typeOf': {
378
- $exists: true,
379
- $in: searchConditions.purposeTypeOfs
380
- }
381
- });
382
- }
383
- // tslint:disable-next-line:no-single-line-block-comment
384
- /* istanbul ignore else */
385
- if (Array.isArray(searchConditions.fromLocationAccountNumbers) && searchConditions.fromLocationAccountNumbers.length > 0) {
386
- andConditions.push({
387
- 'fromLocation.accountNumber': {
388
- $exists: true,
389
- $in: searchConditions.fromLocationAccountNumbers
390
- }
391
- });
392
- }
393
- // tslint:disable-next-line:no-single-line-block-comment
394
- /* istanbul ignore else */
395
- if (Array.isArray(searchConditions.toLocationAccountNumbers) && searchConditions.toLocationAccountNumbers.length > 0) {
396
- andConditions.push({
397
- 'toLocation.accountNumber': {
398
- $exists: true,
399
- $in: searchConditions.toLocationAccountNumbers
400
- }
401
- });
402
- }
403
- return this.actionModel.find({ $and: andConditions }, {
404
- __v: 0,
405
- createdAt: 0,
406
- updatedAt: 0
407
- })
408
- .limit(searchConditions.limit)
409
- .exec()
410
- .then((docs) => docs.map((doc) => doc.toObject()));
411
- });
412
- }
391
+ // public async search<T extends factory.actionType>(searchConditions: {
392
+ // typeOf: T;
393
+ // actionStatuses?: factory.account.AccountStatusType[];
394
+ // startDateFrom?: Date;
395
+ // startDateThrough?: Date;
396
+ // purposeTypeOfs?: factory.account.transactionType[];
397
+ // fromLocationAccountNumbers?: string[];
398
+ // toLocationAccountNumbers?: string[];
399
+ // limit: number;
400
+ // }): Promise<IAction<T>[]> {
401
+ // const andConditions: any[] = [
402
+ // { typeOf: searchConditions.typeOf },
403
+ // {
404
+ // startDate: {
405
+ // $exists: true,
406
+ // $gte: searchConditions.startDateFrom,
407
+ // $lte: searchConditions.startDateThrough
408
+ // }
409
+ // }
410
+ // ];
411
+ // // tslint:disable-next-line:no-single-line-block-comment
412
+ // /* istanbul ignore else */
413
+ // if (Array.isArray(searchConditions.actionStatuses) && searchConditions.actionStatuses.length > 0) {
414
+ // andConditions.push({
415
+ // actionStatus: { $in: searchConditions.actionStatuses }
416
+ // });
417
+ // }
418
+ // // tslint:disable-next-line:no-single-line-block-comment
419
+ // /* istanbul ignore else */
420
+ // if (Array.isArray(searchConditions.purposeTypeOfs) && searchConditions.purposeTypeOfs.length > 0) {
421
+ // andConditions.push({
422
+ // 'purpose.typeOf': {
423
+ // $exists: true,
424
+ // $in: searchConditions.purposeTypeOfs
425
+ // }
426
+ // });
427
+ // }
428
+ // // tslint:disable-next-line:no-single-line-block-comment
429
+ // /* istanbul ignore else */
430
+ // if (Array.isArray(searchConditions.fromLocationAccountNumbers) && searchConditions.fromLocationAccountNumbers.length > 0) {
431
+ // andConditions.push({
432
+ // 'fromLocation.accountNumber': {
433
+ // $exists: true,
434
+ // $in: searchConditions.fromLocationAccountNumbers
435
+ // }
436
+ // });
437
+ // }
438
+ // // tslint:disable-next-line:no-single-line-block-comment
439
+ // /* istanbul ignore else */
440
+ // if (Array.isArray(searchConditions.toLocationAccountNumbers) && searchConditions.toLocationAccountNumbers.length > 0) {
441
+ // andConditions.push({
442
+ // 'toLocation.accountNumber': {
443
+ // $exists: true,
444
+ // $in: searchConditions.toLocationAccountNumbers
445
+ // }
446
+ // });
447
+ // }
448
+ // return this.actionModel.find(
449
+ // { $and: andConditions },
450
+ // {
451
+ // __v: 0,
452
+ // createdAt: 0,
453
+ // updatedAt: 0
454
+ // }
455
+ // )
456
+ // .limit(searchConditions.limit)
457
+ // .exec()
458
+ // .then((docs) => docs.map((doc) => doc.toObject()));
459
+ // }
413
460
  clean(params) {
414
461
  var _a;
415
462
  return __awaiter(this, void 0, void 0, function* () {
@@ -10,4 +10,5 @@ export declare class MongoRepository {
10
10
  id: string;
11
11
  };
12
12
  }): Promise<void>;
13
+ getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
13
14
  }
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
- // import * as factory from '../factory';
13
+ const factory = require("../factory");
14
14
  const accountTitle_1 = require("./mongoose/model/accountTitle");
15
15
  /**
16
16
  * 科目リポジトリ
@@ -27,5 +27,10 @@ class MongoRepository {
27
27
  .exec();
28
28
  });
29
29
  }
30
+ getCursor(conditions, projection) {
31
+ return this.accountTitleModel.find(conditions, projection)
32
+ .sort({ codeValue: factory.sortType.Descending })
33
+ .cursor();
34
+ }
30
35
  }
31
36
  exports.MongoRepository = MongoRepository;
@@ -22,4 +22,5 @@ export declare class MongoRepository {
22
22
  id: string;
23
23
  };
24
24
  }): Promise<void>;
25
+ getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
25
26
  }
@@ -163,5 +163,10 @@ class MongoRepository {
163
163
  .exec();
164
164
  });
165
165
  }
166
+ getCursor(conditions, projection) {
167
+ return this.merchantReturnPolicyModel.find(conditions, projection)
168
+ .sort({ identifier: factory.sortType.Descending })
169
+ .cursor();
170
+ }
166
171
  }
167
172
  exports.MongoRepository = MongoRepository;
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.279.0-alpha.5",
13
- "@cinerino/sdk": "3.134.0-alpha.4",
12
+ "@chevre/factory": "4.280.0-alpha.0",
13
+ "@cinerino/sdk": "3.134.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.1.0-alpha.28"
123
+ "version": "20.1.0-alpha.29"
124
124
  }