@chevre/domain 21.2.0-alpha.125 → 21.2.0-alpha.127
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,31 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// import * as redis from 'redis';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
import * as redis from 'redis';
|
|
5
|
+
|
|
6
|
+
import { chevre } from '../../../lib/index';
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
11
|
+
socket: {
|
|
12
|
+
host: process.env.REDIS_HOST,
|
|
13
|
+
port: Number(process.env.REDIS_PORT)
|
|
14
|
+
},
|
|
15
|
+
password: process.env.REDIS_KEY
|
|
16
|
+
});
|
|
17
|
+
await client.connect();
|
|
18
|
+
|
|
19
|
+
const stockHolderRepo = new chevre.repository.StockHolder(client, mongoose.connection);
|
|
20
|
+
|
|
21
|
+
const holdReservations = await stockHolderRepo.search({
|
|
22
|
+
limit: 100,
|
|
23
|
+
page: 1
|
|
24
|
+
});
|
|
25
|
+
console.log(holdReservations[0]?.reservationFor.aggregateReservation, holdReservations[0]?.objectSize);
|
|
26
|
+
console.log(holdReservations.length);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
main()
|
|
30
|
+
.then(console.log)
|
|
31
|
+
.catch(console.error);
|
|
@@ -526,9 +526,16 @@ class StockHolderRepository {
|
|
|
526
526
|
_id: 0,
|
|
527
527
|
id: '$reservations.subReservation.id',
|
|
528
528
|
identifier: '$reservations.subReservation.identifier',
|
|
529
|
-
reservationFor:
|
|
529
|
+
reservationFor: {
|
|
530
|
+
id: '$reservationFor.id',
|
|
531
|
+
startDate: '$reservationFor.startDate',
|
|
532
|
+
aggregateReservation: {
|
|
533
|
+
reservationCount: '$reservationCount'
|
|
534
|
+
}
|
|
535
|
+
},
|
|
530
536
|
reservationNumber: '$reservations.reservationNumber',
|
|
531
|
-
reservedTicket: '$reservations.subReservation.reservedTicket'
|
|
537
|
+
reservedTicket: '$reservations.subReservation.reservedTicket',
|
|
538
|
+
objectSize: { $bsonSize: '$$ROOT' }
|
|
532
539
|
}
|
|
533
540
|
}
|
|
534
541
|
]);
|
package/package.json
CHANGED