@chevre/domain 21.2.0-alpha.111 → 21.2.0-alpha.113
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,27 @@
|
|
|
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 = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
const aggregation = await eventRepo.aggregateScreeningEventMaxVersion({
|
|
15
|
+
project: { id: { $eq: project.id } },
|
|
16
|
+
workPerformed: { identifier: { $eq: '00001' } },
|
|
17
|
+
location: { branchCode: { $in: ['118', '203'] } }
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
console.log('result:', aggregation);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
main()
|
|
24
|
+
.then(() => {
|
|
25
|
+
console.log('success!');
|
|
26
|
+
})
|
|
27
|
+
.catch(console.error);
|
|
@@ -179,6 +179,28 @@ export declare class MongoRepository {
|
|
|
179
179
|
filter: any;
|
|
180
180
|
$unset: any;
|
|
181
181
|
}): Promise<import("mongodb").UpdateResult>;
|
|
182
|
+
/**
|
|
183
|
+
* 既存施設コンテンツの最大バージョンを集計する
|
|
184
|
+
*/
|
|
185
|
+
aggregateScreeningEventMaxVersion(params: {
|
|
186
|
+
project: {
|
|
187
|
+
id: {
|
|
188
|
+
$eq: string;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
workPerformed: {
|
|
192
|
+
identifier: {
|
|
193
|
+
$eq: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
location: {
|
|
197
|
+
branchCode: {
|
|
198
|
+
$in: string[];
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
}): Promise<{
|
|
202
|
+
maxVersion: string;
|
|
203
|
+
}>;
|
|
182
204
|
aggregateEvent(params: {
|
|
183
205
|
project?: {
|
|
184
206
|
id?: {
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -832,6 +832,41 @@ class MongoRepository {
|
|
|
832
832
|
.exec();
|
|
833
833
|
});
|
|
834
834
|
}
|
|
835
|
+
/**
|
|
836
|
+
* 既存施設コンテンツの最大バージョンを集計する
|
|
837
|
+
*/
|
|
838
|
+
aggregateScreeningEventMaxVersion(params) {
|
|
839
|
+
var _a;
|
|
840
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
841
|
+
const aggregations = yield this.eventModel.aggregate([
|
|
842
|
+
{
|
|
843
|
+
$match: {
|
|
844
|
+
typeOf: { $eq: factory.eventType.ScreeningEventSeries },
|
|
845
|
+
'project.id': { $eq: params.project.id.$eq },
|
|
846
|
+
'workPerformed.identifier': { $exists: true, $eq: params.workPerformed.identifier.$eq },
|
|
847
|
+
'workPerformed.version': { $exists: true },
|
|
848
|
+
'location.branchCode': { $exists: true, $in: params.location.branchCode.$in }
|
|
849
|
+
}
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
$project: {
|
|
853
|
+
workPerformed: '$workPerformed'
|
|
854
|
+
}
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
$group: {
|
|
858
|
+
_id: '$typeOf',
|
|
859
|
+
maxVersion: { $max: '$workPerformed.version' }
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
])
|
|
863
|
+
.exec();
|
|
864
|
+
const maxVersion = (aggregations.length > 0)
|
|
865
|
+
? (_a = aggregations.shift()) === null || _a === void 0 ? void 0 : _a.maxVersion
|
|
866
|
+
: '0';
|
|
867
|
+
return { maxVersion };
|
|
868
|
+
});
|
|
869
|
+
}
|
|
835
870
|
aggregateEvent(params) {
|
|
836
871
|
return __awaiter(this, void 0, void 0, function* () {
|
|
837
872
|
const statuses = yield Promise.all([
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.313.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.157.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.313.0-alpha.35",
|
|
13
|
+
"@cinerino/sdk": "3.157.0-alpha.12",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.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.113"
|
|
121
121
|
}
|