@chevre/domain 21.11.0-alpha.3 → 21.12.0-alpha.0

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 (47) hide show
  1. package/example/src/chevre/place/migrateHasPOS.ts +76 -0
  2. package/lib/chevre/repo/assetTransaction.d.ts +1 -1
  3. package/lib/chevre/repo/mongoose/schemas/account.js +2 -1
  4. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +2 -1
  5. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +2 -1
  6. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +2 -1
  7. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +3 -3
  8. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +2 -1
  9. package/lib/chevre/repo/mongoose/schemas/aggregation.js +2 -1
  10. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +2 -1
  11. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +3 -3
  12. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +2 -1
  13. package/lib/chevre/repo/mongoose/schemas/customer.js +2 -1
  14. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +3 -3
  15. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +2 -1
  16. package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
  17. package/lib/chevre/repo/mongoose/schemas/event.js +2 -1
  18. package/lib/chevre/repo/mongoose/schemas/member.js +2 -1
  19. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +2 -1
  20. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +3 -3
  21. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -1
  22. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +2 -1
  23. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +3 -3
  24. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +2 -1
  25. package/lib/chevre/repo/mongoose/schemas/place.js +2 -1
  26. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +2 -1
  27. package/lib/chevre/repo/mongoose/schemas/product.js +2 -1
  28. package/lib/chevre/repo/mongoose/schemas/project.d.ts +3 -3
  29. package/lib/chevre/repo/mongoose/schemas/project.js +2 -1
  30. package/lib/chevre/repo/mongoose/schemas/role.js +2 -1
  31. package/lib/chevre/repo/mongoose/schemas/seller.js +2 -1
  32. package/lib/chevre/repo/mongoose/schemas/telemetry.js +2 -1
  33. package/lib/chevre/repo/mongoose/schemas/trip.js +2 -1
  34. package/lib/chevre/repo/place/hasPOS.d.ts +1 -1
  35. package/lib/chevre/repo/place/hasPOS.js +6 -6
  36. package/lib/chevre/repo/place.d.ts +0 -13
  37. package/lib/chevre/repo/place.js +36 -20
  38. package/lib/chevre/repo/task.d.ts +1 -1
  39. package/lib/chevre/repo/transaction.d.ts +1 -1
  40. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +16 -0
  41. package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +75 -0
  42. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +15 -0
  43. package/lib/chevre/service/task/onResourceUpdated.js +9 -0
  44. package/lib/chevre/settings.d.ts +1 -0
  45. package/lib/chevre/settings.js +4 -1
  46. package/package.json +2 -2
  47. package/example/src/chevre/migrateScreeningRoomOrganizer.ts +0 -91
@@ -0,0 +1,76 @@
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 placeRepo = new chevre.repository.Place(mongoose.connection);
15
+
16
+ const cursor = placeRepo.getCursor(
17
+ {
18
+ // 'project.id': { $eq: project.id },
19
+ // 'project.id': { $ne: EXCLUDED_PROJECT_ID },
20
+ typeOf: {
21
+ $eq: chevre.factory.placeType.MovieTheater
22
+ }
23
+ // organizer: { $exists: false }
24
+ },
25
+ {
26
+ branchCode: 1,
27
+ _id: 1, name: 1, project: 1, hasPOS: 1
28
+ }
29
+ );
30
+ console.log('places found');
31
+
32
+ let i = 0;
33
+ let updateCount = 0;
34
+ await cursor.eachAsync(async (doc) => {
35
+ i += 1;
36
+ const movieTheater: Pick<chevre.factory.place.movieTheater.IPlace,
37
+ 'branchCode' | 'id' | 'name' | 'project' | 'hasPOS'> = doc.toObject();
38
+ console.log(movieTheater);
39
+
40
+ if (!Array.isArray(movieTheater.hasPOS)) {
41
+ console.log('has no pos', movieTheater.project.id, movieTheater.branchCode, movieTheater.name.ja, i);
42
+ } else {
43
+ const alreadyMigrated = movieTheater.hasPOS.every((pos) => pos.branchCode === pos.id);
44
+ if (alreadyMigrated) {
45
+ console.log('already migrated...', movieTheater.project.id, movieTheater.branchCode, movieTheater.name.ja, i);
46
+ } else {
47
+ if (movieTheater.hasPOS.length > 0) {
48
+ const newHasPOS: chevre.factory.place.movieTheater.IPOS[] = movieTheater.hasPOS.map((pos) => {
49
+ return {
50
+ id: pos.id,
51
+ branchCode: pos.id,
52
+ name: pos.name
53
+ };
54
+ });
55
+ console.log('updating place...', movieTheater.project.id, movieTheater.branchCode, movieTheater.name.ja, i, newHasPOS);
56
+ await placeRepo.saveMovieTheater(<any>{
57
+ project: movieTheater.project,
58
+ branchCode: movieTheater.branchCode,
59
+ id: movieTheater.id,
60
+ typeOf: chevre.factory.placeType.MovieTheater,
61
+ hasPOS: newHasPOS
62
+ });
63
+ updateCount += 1;
64
+ console.log('updated.', movieTheater.project.id, movieTheater.branchCode, movieTheater.name.ja, i);
65
+ }
66
+ }
67
+ }
68
+ });
69
+
70
+ console.log(i, 'places checked');
71
+ console.log(updateCount, 'places updated');
72
+ }
73
+
74
+ main()
75
+ .then()
76
+ .catch(console.error);
@@ -131,7 +131,7 @@ export declare class MongoRepository {
131
131
  status: {
132
132
  $in: factory.transactionStatusType[];
133
133
  };
134
- }): Promise<Pick<import("@chevre/factory/lib/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/assetTransaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/assetTransaction/reserve").ITransaction | import("@chevre/factory/lib/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/assetTransaction/registerService").ITransaction, "id" | "typeOf" | "status">[]>;
134
+ }): Promise<Pick<import("@chevre/factory/lib/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/assetTransaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/assetTransaction/reserve").ITransaction | import("@chevre/factory/lib/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/assetTransaction/registerService").ITransaction, "typeOf" | "id" | "status">[]>;
135
135
  /**
136
136
  * set task status exported by transaction id
137
137
  * IDでタスクをエクスポート済に変更する
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Account';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -11,7 +12,7 @@ exports.modelName = modelName;
11
12
  const schema = new mongoose_1.Schema({}, {
12
13
  collection: 'accounts',
13
14
  id: true,
14
- read: 'primaryPreferred',
15
+ read: settings_1.MONGO_READ_PREFERENCE,
15
16
  writeConcern: writeConcern_1.writeConcern,
16
17
  strict: false,
17
18
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'AccountTitle';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -26,7 +27,7 @@ const schema = new mongoose_1.Schema({
26
27
  }, {
27
28
  collection: 'accountTitles',
28
29
  id: true,
29
- read: 'primaryPreferred',
30
+ read: settings_1.MONGO_READ_PREFERENCE,
30
31
  writeConcern: writeConcern_1.writeConcern,
31
32
  strictQuery: false,
32
33
  timestamps: {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'AccountingReport';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -15,7 +16,7 @@ const schema = new mongoose_1.Schema({
15
16
  }, {
16
17
  collection: 'accountingReports',
17
18
  id: true,
18
- read: 'primaryPreferred',
19
+ read: settings_1.MONGO_READ_PREFERENCE,
19
20
  writeConcern: writeConcern_1.writeConcern,
20
21
  strict: false,
21
22
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'AdditionalProperty';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -23,7 +24,7 @@ const schema = new mongoose_1.Schema({
23
24
  }, {
24
25
  collection: 'additionalProperties',
25
26
  id: true,
26
- read: 'primaryPreferred',
27
+ read: settings_1.MONGO_READ_PREFERENCE,
27
28
  writeConcern: writeConcern_1.writeConcern,
28
29
  strict: true,
29
30
  strictQuery: false,
@@ -53,20 +53,20 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
53
53
  }, {
54
54
  offers: any[];
55
55
  includedInDataCatalog: any[];
56
- _id?: string | undefined;
57
56
  typeOf?: string | undefined;
57
+ _id?: string | undefined;
58
58
  project?: any;
59
59
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
60
60
  offers: any[];
61
61
  includedInDataCatalog: any[];
62
- _id?: string | undefined;
63
62
  typeOf?: string | undefined;
63
+ _id?: string | undefined;
64
64
  project?: any;
65
65
  }>> & Omit<import("mongoose").FlatRecord<{
66
66
  offers: any[];
67
67
  includedInDataCatalog: any[];
68
- _id?: string | undefined;
69
68
  typeOf?: string | undefined;
69
+ _id?: string | undefined;
70
70
  project?: any;
71
71
  }> & Required<{
72
72
  _id: string;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'AggregateOffer';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -17,7 +18,7 @@ const schema = new mongoose_1.Schema({
17
18
  }, {
18
19
  collection: 'aggregateOffers',
19
20
  id: true,
20
- read: 'primaryPreferred',
21
+ read: settings_1.MONGO_READ_PREFERENCE,
21
22
  writeConcern: writeConcern_1.writeConcern,
22
23
  strict: true,
23
24
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Aggregation';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -11,7 +12,7 @@ exports.modelName = modelName;
11
12
  const schema = new mongoose_1.Schema({}, {
12
13
  collection: 'aggregations',
13
14
  id: true,
14
- read: 'primaryPreferred',
15
+ read: settings_1.MONGO_READ_PREFERENCE,
15
16
  writeConcern: writeConcern_1.writeConcern,
16
17
  strict: false,
17
18
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'CategoryCode';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -27,7 +28,7 @@ const schema = new mongoose_1.Schema({
27
28
  }, {
28
29
  collection: 'categoryCodes',
29
30
  id: true,
30
- read: 'primaryPreferred',
31
+ read: settings_1.MONGO_READ_PREFERENCE,
31
32
  writeConcern: writeConcern_1.writeConcern,
32
33
  strict: true,
33
34
  strictQuery: false,
@@ -52,8 +52,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
52
52
  versionKey: false;
53
53
  };
54
54
  }, {
55
- text: string;
56
55
  typeOf: string;
56
+ text: string;
57
57
  additionalProperty: any[];
58
58
  commentCount: number;
59
59
  mentions: any[];
@@ -63,8 +63,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
63
63
  dateCreated?: Date | undefined;
64
64
  dateModified?: Date | undefined;
65
65
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
66
- text: string;
67
66
  typeOf: string;
67
+ text: string;
68
68
  additionalProperty: any[];
69
69
  commentCount: number;
70
70
  mentions: any[];
@@ -74,8 +74,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
74
74
  dateCreated?: Date | undefined;
75
75
  dateModified?: Date | undefined;
76
76
  }>> & Omit<import("mongoose").FlatRecord<{
77
- text: string;
78
77
  typeOf: string;
78
+ text: string;
79
79
  additionalProperty: any[];
80
80
  commentCount: number;
81
81
  mentions: any[];
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'CreativeWork';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -33,7 +34,7 @@ const schema = new mongoose_1.Schema({
33
34
  }, {
34
35
  collection: 'creativeWorks',
35
36
  id: true,
36
- read: 'primaryPreferred',
37
+ read: settings_1.MONGO_READ_PREFERENCE,
37
38
  writeConcern: writeConcern_1.writeConcern,
38
39
  strict: true,
39
40
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Customer';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -24,7 +25,7 @@ const schema = new mongoose_1.Schema({
24
25
  }, {
25
26
  collection: 'customers',
26
27
  id: true,
27
- read: 'primaryPreferred',
28
+ read: settings_1.MONGO_READ_PREFERENCE,
28
29
  writeConcern: writeConcern_1.writeConcern,
29
30
  strict: true,
30
31
  strictQuery: false,
@@ -53,24 +53,24 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
53
53
  };
54
54
  }, {
55
55
  typeOf: string;
56
- text?: string | undefined;
57
56
  name?: any;
57
+ text?: string | undefined;
58
58
  project?: any;
59
59
  identifier?: string | undefined;
60
60
  about?: any;
61
61
  sender?: any;
62
62
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
63
63
  typeOf: string;
64
- text?: string | undefined;
65
64
  name?: any;
65
+ text?: string | undefined;
66
66
  project?: any;
67
67
  identifier?: string | undefined;
68
68
  about?: any;
69
69
  sender?: any;
70
70
  }>> & Omit<import("mongoose").FlatRecord<{
71
71
  typeOf: string;
72
- text?: string | undefined;
73
72
  name?: any;
73
+ text?: string | undefined;
74
74
  project?: any;
75
75
  identifier?: string | undefined;
76
76
  about?: any;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'EmailMessage';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -22,7 +23,7 @@ const schema = new mongoose_1.Schema({
22
23
  }, {
23
24
  collection: 'emailMessages',
24
25
  id: true,
25
- read: 'primaryPreferred',
26
+ read: settings_1.MONGO_READ_PREFERENCE,
26
27
  writeConcern: writeConcern_1.writeConcern,
27
28
  strict: true,
28
29
  strictQuery: false,
@@ -57,8 +57,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
57
57
  organizer: any;
58
58
  checkInCount: number;
59
59
  attendeeCount: number;
60
- _id?: string | undefined;
61
60
  name?: any;
61
+ _id?: string | undefined;
62
62
  alternateName?: any;
63
63
  description?: any;
64
64
  additionalProperty?: any;
@@ -91,8 +91,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
91
91
  organizer: any;
92
92
  checkInCount: number;
93
93
  attendeeCount: number;
94
- _id?: string | undefined;
95
94
  name?: any;
95
+ _id?: string | undefined;
96
96
  alternateName?: any;
97
97
  description?: any;
98
98
  additionalProperty?: any;
@@ -125,8 +125,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
125
125
  organizer: any;
126
126
  checkInCount: number;
127
127
  attendeeCount: number;
128
- _id?: string | undefined;
129
128
  name?: any;
129
+ _id?: string | undefined;
130
130
  alternateName?: any;
131
131
  description?: any;
132
132
  additionalProperty?: any;
@@ -4,6 +4,7 @@ exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
6
  const factory = require("../../../factory");
7
+ const settings_1 = require("../../../settings");
7
8
  const modelName = 'Event';
8
9
  exports.modelName = modelName;
9
10
  /**
@@ -57,7 +58,7 @@ const schema = new mongoose_1.Schema({
57
58
  }, {
58
59
  collection: 'events',
59
60
  id: true,
60
- read: 'primaryPreferred',
61
+ read: settings_1.MONGO_READ_PREFERENCE,
61
62
  writeConcern: writeConcern_1.writeConcern,
62
63
  strict: true,
63
64
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Member';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -24,7 +25,7 @@ const schema = new mongoose_1.Schema({
24
25
  }, {
25
26
  collection: 'members',
26
27
  id: true,
27
- read: 'primaryPreferred',
28
+ read: settings_1.MONGO_READ_PREFERENCE,
28
29
  writeConcern: writeConcern_1.writeConcern,
29
30
  strict: true,
30
31
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'MerchantReturnPolicy';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -22,7 +23,7 @@ const schema = new mongoose_1.Schema({
22
23
  }, {
23
24
  collection: 'merchantReturnPolicies',
24
25
  id: true,
25
- read: 'primaryPreferred',
26
+ read: settings_1.MONGO_READ_PREFERENCE,
26
27
  writeConcern: writeConcern_1.writeConcern,
27
28
  strict: true,
28
29
  strictQuery: false,
@@ -55,8 +55,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
55
55
  additionalProperty: any[];
56
56
  identifier: string;
57
57
  itemListElement: any[];
58
- _id?: string | undefined;
59
58
  name?: any;
59
+ _id?: string | undefined;
60
60
  project?: any;
61
61
  alternateName?: any;
62
62
  description?: any;
@@ -67,8 +67,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
67
67
  additionalProperty: any[];
68
68
  identifier: string;
69
69
  itemListElement: any[];
70
- _id?: string | undefined;
71
70
  name?: any;
71
+ _id?: string | undefined;
72
72
  project?: any;
73
73
  alternateName?: any;
74
74
  description?: any;
@@ -79,8 +79,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
79
79
  additionalProperty: any[];
80
80
  identifier: string;
81
81
  itemListElement: any[];
82
- _id?: string | undefined;
83
82
  name?: any;
83
+ _id?: string | undefined;
84
84
  project?: any;
85
85
  alternateName?: any;
86
86
  description?: any;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'OfferCatalog';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -31,7 +32,7 @@ const schema = new mongoose_1.Schema({
31
32
  }, {
32
33
  collection: 'offerCatalogs',
33
34
  id: true,
34
- read: 'primaryPreferred',
35
+ read: settings_1.MONGO_READ_PREFERENCE,
35
36
  writeConcern: writeConcern_1.writeConcern,
36
37
  strict: true,
37
38
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'OfferCatalogItem';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -29,7 +30,7 @@ const schema = new mongoose_1.Schema({
29
30
  }, {
30
31
  collection: 'offerCatalogItems',
31
32
  id: true,
32
- read: 'primaryPreferred',
33
+ read: settings_1.MONGO_READ_PREFERENCE,
33
34
  writeConcern: writeConcern_1.writeConcern,
34
35
  strict: true,
35
36
  strictQuery: false,
@@ -51,20 +51,20 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
51
51
  versionKey: false;
52
52
  };
53
53
  }, {
54
- name?: any;
55
54
  typeOf?: string | undefined;
55
+ name?: any;
56
56
  project?: any;
57
57
  identifier?: string | undefined;
58
58
  itemOffered?: any;
59
59
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
60
- name?: any;
61
60
  typeOf?: string | undefined;
61
+ name?: any;
62
62
  project?: any;
63
63
  identifier?: string | undefined;
64
64
  itemOffered?: any;
65
65
  }>> & Omit<import("mongoose").FlatRecord<{
66
- name?: any;
67
66
  typeOf?: string | undefined;
67
+ name?: any;
68
68
  project?: any;
69
69
  identifier?: string | undefined;
70
70
  itemOffered?: any;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'OfferItemCondition';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -17,7 +18,7 @@ const schema = new mongoose_1.Schema({
17
18
  }, {
18
19
  collection: 'offerItemConditions',
19
20
  id: true,
20
- read: 'primaryPreferred',
21
+ read: settings_1.MONGO_READ_PREFERENCE,
21
22
  writeConcern: writeConcern_1.writeConcern,
22
23
  strict: true,
23
24
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Place';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -46,7 +47,7 @@ const schema = new mongoose_1.Schema({
46
47
  }, {
47
48
  collection: 'places',
48
49
  id: true,
49
- read: 'primaryPreferred',
50
+ read: settings_1.MONGO_READ_PREFERENCE,
50
51
  writeConcern: writeConcern_1.writeConcern,
51
52
  strict: true,
52
53
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'PriceSpecification';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -25,7 +26,7 @@ const schema = new mongoose_1.Schema({
25
26
  }, {
26
27
  collection: 'priceSpecifications',
27
28
  id: true,
28
- read: 'primaryPreferred',
29
+ read: settings_1.MONGO_READ_PREFERENCE,
29
30
  writeConcern: writeConcern_1.writeConcern,
30
31
  strict: true,
31
32
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Product';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -30,7 +31,7 @@ const schema = new mongoose_1.Schema({
30
31
  }, {
31
32
  collection: 'products',
32
33
  id: true,
33
- read: 'primaryPreferred',
34
+ read: settings_1.MONGO_READ_PREFERENCE,
34
35
  writeConcern: writeConcern_1.writeConcern,
35
36
  strict: true,
36
37
  strictQuery: false,
@@ -53,8 +53,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
53
53
  };
54
54
  }, {
55
55
  typeOf: string;
56
- _id?: string | undefined;
57
56
  name?: string | undefined;
57
+ _id?: string | undefined;
58
58
  logo?: string | undefined;
59
59
  alternateName?: string | undefined;
60
60
  settings?: any;
@@ -62,8 +62,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
62
62
  subscription?: any;
63
63
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
64
64
  typeOf: string;
65
- _id?: string | undefined;
66
65
  name?: string | undefined;
66
+ _id?: string | undefined;
67
67
  logo?: string | undefined;
68
68
  alternateName?: string | undefined;
69
69
  settings?: any;
@@ -71,8 +71,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
71
71
  subscription?: any;
72
72
  }>> & Omit<import("mongoose").FlatRecord<{
73
73
  typeOf: string;
74
- _id?: string | undefined;
75
74
  name?: string | undefined;
75
+ _id?: string | undefined;
76
76
  logo?: string | undefined;
77
77
  alternateName?: string | undefined;
78
78
  settings?: any;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Project';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -23,7 +24,7 @@ const schema = new mongoose_1.Schema({
23
24
  }, {
24
25
  collection: 'projects',
25
26
  id: true,
26
- read: 'primaryPreferred',
27
+ read: settings_1.MONGO_READ_PREFERENCE,
27
28
  writeConcern: writeConcern_1.writeConcern,
28
29
  strict: true,
29
30
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Role';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -14,7 +15,7 @@ const schema = new mongoose_1.Schema({
14
15
  }, {
15
16
  collection: 'roles',
16
17
  id: true,
17
- read: 'primaryPreferred',
18
+ read: settings_1.MONGO_READ_PREFERENCE,
18
19
  writeConcern: writeConcern_1.writeConcern,
19
20
  strict: false,
20
21
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Seller';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -27,7 +28,7 @@ const schema = new mongoose_1.Schema({
27
28
  }, {
28
29
  collection: 'sellers',
29
30
  id: true,
30
- read: 'primaryPreferred',
31
+ read: settings_1.MONGO_READ_PREFERENCE,
31
32
  writeConcern: writeConcern_1.writeConcern,
32
33
  strict: true,
33
34
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Telemetry';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -19,7 +20,7 @@ const schema = new mongoose_1.Schema({
19
20
  }, {
20
21
  collection: 'telemetries',
21
22
  id: true,
22
- read: 'primaryPreferred',
23
+ read: settings_1.MONGO_READ_PREFERENCE,
23
24
  writeConcern: writeConcern_1.writeConcern,
24
25
  strict: true,
25
26
  strictQuery: false,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.schema = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
+ const settings_1 = require("../../../settings");
6
7
  const modelName = 'Trip';
7
8
  exports.modelName = modelName;
8
9
  /**
@@ -17,7 +18,7 @@ const schema = new mongoose_1.Schema({
17
18
  }, {
18
19
  collection: 'trips',
19
20
  id: true,
20
- read: 'primaryPreferred',
21
+ read: settings_1.MONGO_READ_PREFERENCE,
21
22
  writeConcern: writeConcern_1.writeConcern,
22
23
  strict: false,
23
24
  strictQuery: false,
@@ -14,7 +14,7 @@ interface IOperator {
14
14
  */
15
15
  export declare class MongoRepository {
16
16
  private readonly placeModel;
17
- private readonly operater;
17
+ private readonly operator;
18
18
  constructor(connection: Connection, operater: IOperator);
19
19
  search(params: {
20
20
  limit?: number;
@@ -20,13 +20,13 @@ const settings_1 = require("../../settings");
20
20
  class MongoRepository {
21
21
  constructor(connection, operater) {
22
22
  this.placeModel = connection.model(place_1.modelName, place_1.schema);
23
- this.operater = operater;
23
+ this.operator = operater;
24
24
  }
25
25
  search(params) {
26
26
  var _a, _b, _c, _d;
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  const matchStages = [
29
- { $match: { _id: { $eq: new mongoose_1.Types.ObjectId(this.operater.id) } } }
29
+ { $match: { _id: { $eq: new mongoose_1.Types.ObjectId(this.operator.id) } } }
30
30
  ];
31
31
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
32
32
  if (typeof projectIdEq === 'string') {
@@ -71,7 +71,7 @@ class MongoRepository {
71
71
  // 施設存在確認
72
72
  let doc = yield this.placeModel.findOne({
73
73
  'project.id': { $eq: params.project.id },
74
- _id: { $eq: this.operater.id }
74
+ _id: { $eq: this.operator.id }
75
75
  }, { _id: 1, typeOf: 1 })
76
76
  .exec();
77
77
  if (doc === null) {
@@ -84,7 +84,7 @@ class MongoRepository {
84
84
  };
85
85
  doc = yield this.placeModel.findOneAndUpdate({
86
86
  'project.id': { $eq: params.project.id },
87
- _id: { $eq: this.operater.id },
87
+ _id: { $eq: this.operator.id },
88
88
  'hasPOS.branchCode': { $ne: params.branchCode }
89
89
  }, {
90
90
  $push: { hasPOS: creatingPOS }
@@ -104,7 +104,7 @@ class MongoRepository {
104
104
  return __awaiter(this, void 0, void 0, function* () {
105
105
  const doc = yield this.placeModel.findOneAndUpdate({
106
106
  'project.id': { $eq: params.project.id },
107
- _id: { $eq: this.operater.id },
107
+ _id: { $eq: this.operator.id },
108
108
  'hasPOS.branchCode': { $eq: params.branchCode }
109
109
  }, Object.assign({}, (params.name !== undefined && params.name !== null)
110
110
  ? { 'hasPOS.$[pos].name': params.name }
@@ -126,7 +126,7 @@ class MongoRepository {
126
126
  return __awaiter(this, void 0, void 0, function* () {
127
127
  const doc = yield this.placeModel.findOneAndUpdate({
128
128
  'project.id': { $eq: params.project.id },
129
- _id: { $eq: this.operater.id },
129
+ _id: { $eq: this.operator.id },
130
130
  'hasPOS.branchCode': { $eq: params.branchCode }
131
131
  }, {
132
132
  $pull: { hasPOS: { branchCode: { $eq: params.branchCode } } }
@@ -81,19 +81,6 @@ export declare class MongoRepository {
81
81
  };
82
82
  typeOf: factory.placeType.ScreeningRoom;
83
83
  }>;
84
- addParentOrganization2ScreeningRoom(screeningRoom: Pick<factory.place.screeningRoom.IPlace, 'branchCode' | 'parentOrganization' | 'project'> & {
85
- containedInPlace: {
86
- branchCode: string;
87
- };
88
- }): Promise<{
89
- containedInPlace: {
90
- /**
91
- * 施設ID
92
- */
93
- id: string;
94
- };
95
- typeOf: factory.placeType.ScreeningRoom;
96
- }>;
97
84
  updateScreeningRoomsByContainedInPlaceId(screeningRoom: {
98
85
  project: {
99
86
  id: string;
@@ -423,26 +423,42 @@ class MongoRepository {
423
423
  return doc.toObject();
424
424
  });
425
425
  }
426
- addParentOrganization2ScreeningRoom(screeningRoom) {
427
- return __awaiter(this, void 0, void 0, function* () {
428
- const doc = yield this.placeModel.findOneAndUpdate({
429
- typeOf: { $eq: factory.placeType.ScreeningRoom },
430
- 'project.id': { $eq: screeningRoom.project.id },
431
- 'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode },
432
- branchCode: screeningRoom.branchCode
433
- }, {
434
- parentOrganization: screeningRoom.parentOrganization
435
- }, {
436
- new: true,
437
- projection: { 'containedInPlace.id': 1, typeOf: 1 }
438
- })
439
- .exec();
440
- if (doc === null) {
441
- throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
442
- }
443
- return doc.toObject();
444
- });
445
- }
426
+ // public async addParentOrganization2ScreeningRoom(
427
+ // screeningRoom: Pick<factory.place.screeningRoom.IPlace, 'branchCode' | 'parentOrganization' | 'project'> & {
428
+ // containedInPlace: {
429
+ // branchCode: string;
430
+ // };
431
+ // }
432
+ // ): Promise<{
433
+ // containedInPlace: {
434
+ // /**
435
+ // * 施設ID
436
+ // */
437
+ // id: string;
438
+ // };
439
+ // typeOf: factory.placeType.ScreeningRoom;
440
+ // }> {
441
+ // const doc = await this.placeModel.findOneAndUpdate(
442
+ // {
443
+ // typeOf: { $eq: factory.placeType.ScreeningRoom },
444
+ // 'project.id': { $eq: screeningRoom.project.id },
445
+ // 'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode },
446
+ // branchCode: screeningRoom.branchCode
447
+ // },
448
+ // {
449
+ // parentOrganization: screeningRoom.parentOrganization
450
+ // },
451
+ // {
452
+ // new: true,
453
+ // projection: { 'containedInPlace.id': 1, typeOf: 1 }
454
+ // }
455
+ // )
456
+ // .exec();
457
+ // if (doc === null) {
458
+ // throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
459
+ // }
460
+ // return doc.toObject();
461
+ // }
446
462
  updateScreeningRoomsByContainedInPlaceId(screeningRoom) {
447
463
  var _a;
448
464
  return __awaiter(this, void 0, void 0, function* () {
@@ -74,7 +74,7 @@ export declare class MongoRepository {
74
74
  */
75
75
  $nin?: factory.taskName[];
76
76
  };
77
- }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
77
+ }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "name" | "id" | "status">[]>;
78
78
  retry(params: {
79
79
  intervalInMinutes: number;
80
80
  }): Promise<void>;
@@ -159,7 +159,7 @@ export declare class MongoRepository {
159
159
  status: {
160
160
  $in: factory.transactionStatusType[];
161
161
  };
162
- }): Promise<Pick<import("@chevre/factory/lib/transaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/transaction/placeOrder").ITransaction | import("@chevre/factory/lib/transaction/returnOrder").ITransaction, "id" | "typeOf" | "status">[]>;
162
+ }): Promise<Pick<import("@chevre/factory/lib/transaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/transaction/placeOrder").ITransaction | import("@chevre/factory/lib/transaction/returnOrder").ITransaction, "typeOf" | "id" | "status">[]>;
163
163
  /**
164
164
  * set task status exported by transaction id
165
165
  * IDでタスクをエクスポート済に変更する
@@ -0,0 +1,16 @@
1
+ import * as factory from '../../../factory';
2
+ import { MongoRepository as PlaceRepo } from '../../../repo/place';
3
+ import { MongoRepository as TaskRepo } from '../../../repo/task';
4
+ export declare function createInformHasPOSTasks(params: {
5
+ project: {
6
+ id: string;
7
+ };
8
+ /**
9
+ * 施設ID
10
+ */
11
+ ids: string[];
12
+ typeOf: factory.placeType.MovieTheater;
13
+ }): (repos: {
14
+ place: PlaceRepo;
15
+ task: TaskRepo;
16
+ }) => Promise<void>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.createInformHasPOSTasks = void 0;
13
+ const factory = require("../../../factory");
14
+ const settings_1 = require("../../../settings");
15
+ const informResources = settings_1.settings.onResourceUpdated.informResource;
16
+ function createInformHasPOSTasks(params) {
17
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
18
+ if (params.ids.length !== 1) {
19
+ throw new factory.errors.Argument('id', 'id.length must be 1');
20
+ }
21
+ // 施設のhasPOSを全て連携する
22
+ const movieTheaters = yield repos.place.searchMovieTheaters({
23
+ limit: 1,
24
+ page: 1,
25
+ project: { id: { $eq: params.project.id } },
26
+ id: { $eq: params.ids[0] }
27
+ }, ['hasPOS'], []);
28
+ const movieTheater = movieTheaters.shift();
29
+ if (movieTheater === undefined) {
30
+ throw new factory.errors.NotFound(factory.placeType.MovieTheater);
31
+ }
32
+ const movieTheaters4inform = [{
33
+ hasPOS: (Array.isArray(movieTheater.hasPOS)) ? movieTheater.hasPOS : [],
34
+ id: movieTheater.id,
35
+ typeOf: factory.placeType.MovieTheater
36
+ }];
37
+ if (movieTheaters4inform.length > 0) {
38
+ const taskRunsAt = new Date();
39
+ const informTasks = [];
40
+ informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
41
+ var _a;
42
+ const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
43
+ movieTheaters4inform.forEach((movieTheater4inform) => {
44
+ var _a;
45
+ const informActionAttributes = {
46
+ agent: { id: params.project.id, typeOf: factory.organizationType.Project },
47
+ object: movieTheater4inform,
48
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
49
+ recipient: {
50
+ id: '',
51
+ name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
52
+ typeOf: factory.creativeWorkType.WebApplication,
53
+ url: informUrl
54
+ },
55
+ typeOf: factory.actionType.InformAction
56
+ };
57
+ informTasks.push({
58
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
59
+ name: factory.taskName.TriggerWebhook,
60
+ status: factory.taskStatus.Ready,
61
+ runsAt: taskRunsAt,
62
+ remainingNumberOfTries: 10,
63
+ numberOfTried: 0,
64
+ executionResults: [],
65
+ data: informActionAttributes
66
+ });
67
+ });
68
+ });
69
+ if (informTasks.length > 0) {
70
+ yield repos.task.saveMany(informTasks, { emitImmediately: true });
71
+ }
72
+ }
73
+ });
74
+ }
75
+ exports.createInformHasPOSTasks = createInformHasPOSTasks;
@@ -11,11 +11,26 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.onResourceDeleted = void 0;
13
13
  const factory = require("../../../factory");
14
+ const onHasPOSUpdated_1 = require("./onHasPOSUpdated");
14
15
  const syncOfferCatalog_1 = require("./syncOfferCatalog");
16
+ // tslint:disable-next-line:max-func-body-length
15
17
  function onResourceDeleted(params) {
16
18
  return (repos) => __awaiter(this, void 0, void 0, function* () {
17
19
  const isDeleted = params.isDeleted === true;
18
20
  if (isDeleted) {
21
+ if (params.useInform === true) {
22
+ switch (params.typeOf) {
23
+ case 'POS':
24
+ yield (0, onHasPOSUpdated_1.createInformHasPOSTasks)({
25
+ project: { id: params.project.id },
26
+ ids: [params.operator.id],
27
+ typeOf: factory.placeType.MovieTheater
28
+ })(repos);
29
+ break;
30
+ default:
31
+ // no op
32
+ }
33
+ }
19
34
  switch (params.typeOf) {
20
35
  case factory.eventType.ScreeningEventSeries:
21
36
  yield deleteResourcesByScreeningEventSeries({
@@ -26,6 +26,7 @@ const place_1 = require("../../repo/place");
26
26
  const product_1 = require("../../repo/product");
27
27
  const productOffer_1 = require("../../repo/productOffer");
28
28
  const task_1 = require("../../repo/task");
29
+ const onHasPOSUpdated_1 = require("./onResourceUpdated/onHasPOSUpdated");
29
30
  const onOfferCatalogUpdated_1 = require("./onResourceUpdated/onOfferCatalogUpdated");
30
31
  const onResourceDeleted_1 = require("./onResourceUpdated/onResourceDeleted");
31
32
  const settings_1 = require("../../settings");
@@ -55,6 +56,7 @@ function call(data) {
55
56
  });
56
57
  }
57
58
  exports.call = call;
59
+ // tslint:disable-next-line:max-func-body-length
58
60
  function onResourceUpdated(params) {
59
61
  return (repos) => __awaiter(this, void 0, void 0, function* () {
60
62
  const isDeleted = params.isDeleted === true;
@@ -99,6 +101,13 @@ function onResourceUpdated(params) {
99
101
  typeOf: params.typeOf
100
102
  })(repos);
101
103
  break;
104
+ case 'POS':
105
+ yield (0, onHasPOSUpdated_1.createInformHasPOSTasks)({
106
+ project: { id: params.project.id },
107
+ ids: [params.operator.id],
108
+ typeOf: factory.placeType.MovieTheater
109
+ })(repos);
110
+ break;
102
111
  default:
103
112
  // no op
104
113
  }
@@ -44,6 +44,7 @@ export declare const USE_ORDER_PAYMENT_DUE_ON_PLACED: boolean;
44
44
  export declare const USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY: boolean;
45
45
  export declare const USE_OPTIMIZE_TICKET_OFFER: boolean;
46
46
  export declare const MONGO_MAX_TIME_MS: number;
47
+ export declare const MONGO_READ_PREFERENCE: string;
47
48
  /**
48
49
  * グローバル設定
49
50
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = exports.MONGO_MAX_TIME_MS = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY = exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_ADVANCE_BOOKING_REQUIREMENT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
3
+ exports.settings = exports.MONGO_READ_PREFERENCE = exports.MONGO_MAX_TIME_MS = exports.USE_OPTIMIZE_TICKET_OFFER = exports.USE_AUTHORIZE_PAYMENT_RESULT_AS_ARRAY = exports.USE_ORDER_PAYMENT_DUE_ON_PLACED = exports.USE_DELETE_EVENT_BY_ORDER = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_ADVANCE_BOOKING_REQUIREMENT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
4
4
  const moment = require("moment");
5
5
  const factory = require("./factory");
6
6
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
@@ -73,6 +73,9 @@ exports.MONGO_MAX_TIME_MS = (typeof process.env.MONGO_MAX_TIME_MS === 'string')
73
73
  ? Number(process.env.MONGO_MAX_TIME_MS)
74
74
  // tslint:disable-next-line:no-magic-numbers
75
75
  : 10000;
76
+ exports.MONGO_READ_PREFERENCE = (typeof process.env.MONGO_READ_PREFERENCE === 'string')
77
+ ? process.env.MONGO_READ_PREFERENCE
78
+ : 'primaryPreferred';
76
79
  /**
77
80
  * グローバル設定
78
81
  */
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.333.0",
12
+ "@chevre/factory": "4.334.0",
13
13
  "@cinerino/sdk": "3.170.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.11.0-alpha.3"
120
+ "version": "21.12.0-alpha.0"
121
121
  }
@@ -1,91 +0,0 @@
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 placeRepo = new chevre.repository.Place(mongoose.connection);
15
-
16
- const cursor = placeRepo.getCursor(
17
- {
18
- // 'project.id': { $eq: project.id },
19
- // 'project.id': { $ne: EXCLUDED_PROJECT_ID },
20
- typeOf: {
21
- $in: [
22
- chevre.factory.placeType.ScreeningRoom
23
- ]
24
- }
25
- // organizer: { $exists: false }
26
- },
27
- {
28
- containsPlace: 0
29
- }
30
- );
31
- console.log('places found');
32
-
33
- let i = 0;
34
- let updateCount = 0;
35
- await cursor.eachAsync(async (doc) => {
36
- i += 1;
37
- const screeningRoom: chevre.factory.place.screeningRoom.IPlace = doc.toObject();
38
- console.log(screeningRoom);
39
-
40
- const organizerId = screeningRoom.parentOrganization?.id;
41
- const alreadyMigrated = typeof organizerId === 'string';
42
-
43
- if (alreadyMigrated) {
44
- console.log('already exist...', screeningRoom.project.id, screeningRoom.branchCode, organizerId, i);
45
- } else {
46
- const movieTheaterId = screeningRoom.containedInPlace?.id;
47
- if (typeof movieTheaterId !== 'string') {
48
- throw new Error('containedInPlace?.id undefined');
49
- }
50
- const movieTheaters = <Pick<chevre.factory.place.movieTheater.IPlaceWithoutScreeningRoom, 'parentOrganization'>[]>
51
- await placeRepo.searchMovieTheaters(
52
- {
53
- limit: 1,
54
- page: 1,
55
- project: { id: { $eq: screeningRoom.project.id } },
56
- id: { $eq: movieTheaterId }
57
- },
58
- ['parentOrganization'],
59
- []
60
- );
61
- const movieTheater = movieTheaters.shift();
62
- const sellerId = movieTheater?.parentOrganization?.id;
63
- console.log('movieTheater found', screeningRoom.project.id, screeningRoom.branchCode, 'sellerId:', sellerId, i);
64
- // if (typeof sellerId !== 'string') {
65
- // throw new Error('movieTheater not found');
66
- // }
67
- if (typeof sellerId === 'string') {
68
- const newParentOrganization: chevre.factory.place.screeningRoom.IParentOrganization = {
69
- id: sellerId,
70
- typeOf: chevre.factory.organizationType.Corporation
71
- };
72
- console.log('updating room...', screeningRoom.project.id, screeningRoom.branchCode, i);
73
- await placeRepo.addParentOrganization2ScreeningRoom({
74
- project: screeningRoom.project,
75
- branchCode: screeningRoom.branchCode,
76
- containedInPlace: { branchCode: String(screeningRoom.containedInPlace?.branchCode) },
77
- parentOrganization: newParentOrganization
78
- });
79
- updateCount += 1;
80
- console.log('updated.', screeningRoom.project.id, screeningRoom.branchCode, i);
81
- }
82
- }
83
- });
84
-
85
- console.log(i, 'rooms checked');
86
- console.log(updateCount, 'rooms updated');
87
- }
88
-
89
- main()
90
- .then()
91
- .catch(console.error);