@chevre/domain 21.2.0-alpha.139 → 21.2.0-alpha.140
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.
- package/example/src/chevre/searchScreeningRooms.ts +1 -1
- package/example/src/chevre/syncScreeningRooms.ts +21 -0
- package/lib/chevre/repo/place.d.ts +6 -0
- package/lib/chevre/repo/place.js +48 -0
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/task/syncScreeningRooms.d.ts +7 -0
- package/lib/chevre/service/task/syncScreeningRooms.js +23 -0
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
// const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
7
7
|
|
|
8
8
|
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex:
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
|
|
10
10
|
|
|
11
11
|
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
12
12
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
|
|
11
|
+
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
await placeRepo.syncScreeningRooms({
|
|
14
|
+
id: '60409176f60a46000a7a3787'
|
|
15
|
+
});
|
|
16
|
+
console.log('synced');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
main()
|
|
20
|
+
.then(console.log)
|
|
21
|
+
.catch(console.error);
|
|
@@ -211,6 +211,12 @@ export declare class MongoRepository {
|
|
|
211
211
|
id: string;
|
|
212
212
|
typeOf: factory.placeType.MovieTheater;
|
|
213
213
|
}>;
|
|
214
|
+
syncScreeningRooms(params: {
|
|
215
|
+
/**
|
|
216
|
+
* 施設ID
|
|
217
|
+
*/
|
|
218
|
+
id: string;
|
|
219
|
+
}): Promise<void>;
|
|
214
220
|
deleteByProject(params: {
|
|
215
221
|
project: {
|
|
216
222
|
id: string;
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -21,10 +21,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
|
+
const createDebug = require("debug");
|
|
24
25
|
const mongoose_1 = require("mongoose");
|
|
25
26
|
const place_1 = require("./mongoose/schemas/place");
|
|
26
27
|
const factory = require("../factory");
|
|
27
28
|
const settings_1 = require("../settings");
|
|
29
|
+
const debug = createDebug('chevre-domain:repo:place');
|
|
28
30
|
/**
|
|
29
31
|
* 施設リポジトリ
|
|
30
32
|
*/
|
|
@@ -1270,6 +1272,52 @@ class MongoRepository {
|
|
|
1270
1272
|
return doc.toObject();
|
|
1271
1273
|
});
|
|
1272
1274
|
}
|
|
1275
|
+
syncScreeningRooms(params) {
|
|
1276
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1277
|
+
const movieTheater = yield this.placeModel.findOne({ _id: { $eq: params.id } })
|
|
1278
|
+
.select({
|
|
1279
|
+
_id: 1, branchCode: 1, name: 1, project: 1, typeOf: 1, containsPlace: 1
|
|
1280
|
+
})
|
|
1281
|
+
.exec()
|
|
1282
|
+
.then((doc) => {
|
|
1283
|
+
if (doc === null) {
|
|
1284
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
1285
|
+
}
|
|
1286
|
+
return doc.toObject();
|
|
1287
|
+
});
|
|
1288
|
+
const creatingScreeningRooms = movieTheater.containsPlace.map((place) => {
|
|
1289
|
+
return Object.assign(Object.assign({}, place), { containedInPlace: {
|
|
1290
|
+
id: movieTheater.id,
|
|
1291
|
+
typeOf: movieTheater.typeOf,
|
|
1292
|
+
branchCode: movieTheater.branchCode,
|
|
1293
|
+
name: movieTheater.name
|
|
1294
|
+
}, containsPlace: (Array.isArray(place.containsPlace)) ? place.containsPlace : [], project: movieTheater.project });
|
|
1295
|
+
});
|
|
1296
|
+
debug('sync processing', creatingScreeningRooms.length, 'screeningRooms...', creatingScreeningRooms);
|
|
1297
|
+
yield Promise.all(creatingScreeningRooms.map((createScreeningRoom) => __awaiter(this, void 0, void 0, function* () {
|
|
1298
|
+
const { typeOf, project, branchCode } = createScreeningRoom, setFields = __rest(createScreeningRoom, ["typeOf", "project", "branchCode"]);
|
|
1299
|
+
const upsertScreeningRoomResult = yield this.placeModel.findOneAndUpdate({
|
|
1300
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
1301
|
+
'project.id': { $eq: createScreeningRoom.project.id },
|
|
1302
|
+
'containedInPlace.id': { $exists: true, $eq: createScreeningRoom.containedInPlace.id },
|
|
1303
|
+
branchCode: { $eq: createScreeningRoom.branchCode }
|
|
1304
|
+
}, {
|
|
1305
|
+
$setOnInsert: {
|
|
1306
|
+
typeOf: createScreeningRoom.typeOf,
|
|
1307
|
+
project: createScreeningRoom.project,
|
|
1308
|
+
branchCode: createScreeningRoom.branchCode
|
|
1309
|
+
},
|
|
1310
|
+
$set: setFields
|
|
1311
|
+
}, {
|
|
1312
|
+
upsert: true,
|
|
1313
|
+
new: true,
|
|
1314
|
+
projection: { _id: 1 }
|
|
1315
|
+
})
|
|
1316
|
+
.exec();
|
|
1317
|
+
debug('screeningRoom upserted. upsertScreeningRoomResult:', upsertScreeningRoomResult);
|
|
1318
|
+
})));
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1273
1321
|
deleteByProject(params) {
|
|
1274
1322
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1275
1323
|
yield this.placeModel.deleteMany({
|
|
@@ -63,7 +63,7 @@ export declare class MongoRepository {
|
|
|
63
63
|
*/
|
|
64
64
|
$nin?: factory.taskName[];
|
|
65
65
|
};
|
|
66
|
-
}): 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/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").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/orderProgramMembership").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/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">[]>;
|
|
66
|
+
}): 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/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").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/orderProgramMembership").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">[]>;
|
|
67
67
|
retry(params: {
|
|
68
68
|
intervalInMinutes: number;
|
|
69
69
|
}): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import { IConnectionSettings } from '../task';
|
|
3
|
+
export type IOperation<T> = (settings: IConnectionSettings) => Promise<T>;
|
|
4
|
+
/**
|
|
5
|
+
* タスク実行関数
|
|
6
|
+
*/
|
|
7
|
+
export declare function call(data: factory.task.syncScreeningRooms.IData): IOperation<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
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.call = void 0;
|
|
13
|
+
const place_1 = require("../../repo/place");
|
|
14
|
+
/**
|
|
15
|
+
* タスク実行関数
|
|
16
|
+
*/
|
|
17
|
+
function call(data) {
|
|
18
|
+
return (connectionSettings) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const placeRepo = new place_1.MongoRepository(connectionSettings.connection);
|
|
20
|
+
yield placeRepo.syncScreeningRooms({ id: data.id });
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.call = call;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.313.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.313.0-alpha.42",
|
|
13
13
|
"@cinerino/sdk": "3.157.0-alpha.17",
|
|
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.2.0-alpha.
|
|
120
|
+
"version": "21.2.0-alpha.140"
|
|
121
121
|
}
|